:root {
    --color-primary: #e11d48;
    --color-accent: #fb7185;
    --color-bg: #fff5f7;
    --color-text: #1f0a12;
    --color-muted: #6b4b57;
    --color-card: #ffffff;
    --shadow-soft: 0 20px 60px rgba(225, 29, 72, 0.15);
    --shadow-card: 0 10px 30px rgba(17, 12, 15, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    color: var(--color-text);
    background: radial-gradient(circle at top left, #ffe4ea 0%, #fff 45%, #fff0f4 100%);
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: linear-gradient(120deg, rgba(225, 29, 72, 0.06), rgba(251, 113, 133, 0.08));
    pointer-events: none;
    z-index: -1;
}

.auth-body {
    background: url('/assets/back.png') center/cover no-repeat fixed;
}

.auth-body::before {
    background: url('/assets/back.png') center/cover no-repeat fixed;
    filter: blur(6px);
    transform: scale(1.02);
}

h1, h2, h3 {
    font-family: 'Space Grotesk', sans-serif;
    margin: 0 0 0.5rem 0;
}

p {
    margin: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #fff;
    border-right: 1px solid #f4cbd6;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.brand-logo {
    width: 140px;
    height: auto;
    border-radius: 18px;
    object-fit: contain;
    box-shadow: var(--shadow-soft);
}

.brand-text {
    font-weight: 600;
    font-size: 1.1rem;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    padding: 0.75rem 1rem;
    border-radius: 14px;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--color-muted);
}

.nav-item:hover {
    background: var(--color-bg);
    color: var(--color-primary);
}

.sidebar-footer {
    margin-top: 2rem;
}

.user-chip {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    justify-content: center;
    background: var(--color-bg);
    padding: 0.75rem 1rem;
    border-radius: 18px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: var(--color-muted);
}

.main {
    flex: 1;
    padding: 2.5rem 3rem;
}

.auth-hero {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 140px;
    height: auto;
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    object-fit: contain;
}

.auth-card {
    max-width: 420px;
    margin: 0 auto;
    background: var(--color-card);
    padding: 2.5rem;
    border-radius: 24px;
    box-shadow: var(--shadow-card);
}

.card {
    background: var(--color-card);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow-card);
}

.card.highlight {
    background: linear-gradient(140deg, #fff, #ffe4ec);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.grid {
    display: grid;
    gap: 1.5rem;
}

.grid.two {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 2rem;
}

.actions {
    display: flex;
    gap: 0.75rem;
}

.btn {
    border: none;
    border-radius: 14px;
    padding: 0.75rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn.primary {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 12px 20px rgba(225, 29, 72, 0.2);
}

.btn.primary:hover {
    transform: translateY(-1px);
}

.btn.ghost {
    background: var(--color-bg);
    color: var(--color-primary);
}

.btn.danger {
    background: #fee2e2;
    color: #b91c1c;
}

.link {
    color: var(--color-primary);
    font-weight: 600;
}

.stack {
    display: grid;
    gap: 1rem;
}

label span {
    display: block;
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-bottom: 0.35rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: 1px solid #f2cbd7;
    font-family: inherit;
    background: #fff;
}

textarea {
    resize: vertical;
}

.password-wrap {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    border: 1px solid #f2cbd7;
    border-radius: 12px;
    overflow: hidden;
}

.password-wrap input {
    border: none;
    flex: 1;
}

.toggle-password {
    background: transparent;
    border: none;
    padding: 0 0.75rem;
    cursor: pointer;
    color: var(--color-muted);
}

.alert {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-weight: 500;
}

.alert.error {
    background: #fee2e2;
    color: #b91c1c;
}

.alert.success {
    background: #dcfce7;
    color: #15803d;
}

.muted {
    color: var(--color-muted);
}

.stat-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 0.75rem;
}

.stat-list li {
    display: flex;
    justify-content: space-between;
    font-weight: 500;
}

.gallery-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 220px));
    justify-content: start;
    gap: 1rem;
}

.thumb {
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #f4cbd6;
}

.thumb img,
.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.thumb-meta {
    padding: 0.75rem;
    display: grid;
    gap: 0.35rem;
    font-size: 0.8rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 240px));
    justify-content: start;
    gap: 1rem;
}

.gallery-item {
    background: #fff;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid #f4cbd6;
}

.gallery-caption {
    padding: 0.75rem;
    display: grid;
    gap: 0.3rem;
    font-size: 0.8rem;
}

.table {
    display: grid;
    gap: 0.75rem;
}

.table-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 0.75rem;
    align-items: flex-start;
    justify-content: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f5cbd7;
}

.table-head {
    font-weight: 600;
    color: var(--color-muted);
    font-size: 0.85rem;
}

.inline-form {
    display: inline-flex;
    gap: 0.5rem;
    align-items: flex-start;
    justify-content: center;
    margin-right: 0.5rem;
}

@media (max-width: 900px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        align-items: flex-start;
    justify-content: center;
        padding: 1rem;
        gap: 1rem;
    }

    .sidebar-footer {
        display: none;
    }

    .nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    .nav-item {
        padding: 0.5rem 0.75rem;
    }

    .main {
        padding: 1.5rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .table-row {
        grid-template-columns: 1fr;
    }
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    justify-content: center;
    z-index: 999;
}

.lightbox.active {
    display: flex;
}

.lightbox-backdrop {
    position: static;
    inset: 0;
    background: rgba(16, 6, 10, 0.65);
    backdrop-filter: blur(2px);
}

.lightbox-panel {
    position: relative;
    background: #fff;
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
    max-width: min(920px, 92vw);
    max-height: 88vh;
    display: grid;
    gap: 1rem;
    z-index: 1;
}

.lightbox-image {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 18px;
    object-fit: contain;
    background: #fff1f5;
}

.lightbox-meta {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.lightbox-title {
    font-weight: 600;
}

.lightbox-sub {
    color: var(--color-muted);
    font-size: 0.85rem;
}

.lightbox-close {
    position: static;
    top: 1rem;
    right: 1rem;
    border: none;
    background: var(--color-primary);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
}

.lightbox-trigger {
    border: none;
    padding: 0;
    background: transparent;
    cursor: pointer;
    width: 100%;
    display: block;
}

.gallery-actions {
    display: flex;
    justify-content: flex-end;
    padding: 0.6rem 0.75rem 0.9rem;
    gap: 0.5rem;
}

.btn.sm {
    padding: 0.45rem 0.8rem;
    border-radius: 12px;
    font-size: 0.85rem;
}

/* Generate modal */
.generate-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: flex-start;
    justify-content: center;
    justify-content: center;
    z-index: 998;
}

.generate-modal.active {
    display: flex;
}

.generate-modal-backdrop {
    position: static;
    inset: 0;
    background: rgba(255, 240, 245, 0.9);
    backdrop-filter: blur(3px);
}

.generate-modal-card {
    position: relative;
    background: #fff;
    border-radius: 26px;
    padding: 2.2rem 2.8rem;
    text-align: center;
    box-shadow: 0 30px 70px rgba(225, 29, 72, 0.25);
    z-index: 1;
    display: grid;
    gap: 0.9rem;
    min-width: min(420px, 88vw);
    animation: modal-pop 0.5s ease;
}

.generate-spinner {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.generate-spinner span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary);
    animation: pulse 1s infinite ease-in-out;
}

.generate-spinner span:nth-child(2) {
    animation-delay: 0.15s;
}

.generate-spinner span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes pulse {
    0%, 100% {
        transform: translateY(0) scale(0.9);
        opacity: 0.35;
    }
    50% {
        transform: translateY(-10px) scale(1.1);
        opacity: 1;
    }
}

.gallery-item.full img {
    height: auto;
    max-height: 420px;
    object-fit: contain;
    background: #fff1f5;
}

.bulk-actions {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.bulk-actions .btn {
    margin-left: auto;
}

.gallery-select {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.gallery-item .select-box {
    position: static;
    top: 10px;
    left: 10px;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.35rem 0.5rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 6px 14px rgba(15, 8, 12, 0.12);
    z-index: 2;
}

.gallery-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.page-header .actions {
    margin-left: auto;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(17, 12, 15, 0.12);
}

.generate-logo {
    width: 88px;
    height: auto;
    object-fit: contain;
    margin: 0 auto 0.25rem;
}

@keyframes modal-pop {
    0% {
        transform: translateY(12px) scale(0.98);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.user-tag {
    display: inline-block;
    background: #ffe4ec;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    margin-bottom: 0.35rem;
}

.status-badge {
    display: inline-flex;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-queued {
    background: #fff3cd;
    color: #a16207;
}

.status-processing {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-completed {
    background: #dcfce7;
    color: #15803d;
}

.status-failed {
    background: #fee2e2;
    color: #b91c1c;
}

.cf-turnstile {
    min-height: 70px;
}
