/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:       #0e0e10;
    --surface:  #18181c;
    --surface2: #22222a;
    --border:   rgba(255,255,255,0.08);
    --gold:     #c9a84c;
    --gold-light: #e4c578;
    --text:     #f0ede8;
    --text-muted: #7a7880;
    --danger:   #e05a5a;
    --success:  #5acea0;
    --radius:   14px;
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body:    'DM Sans', system-ui, sans-serif;
    --shadow: 0 8px 40px rgba(0,0,0,0.6);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 2rem;
}

.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background: radial-gradient(ellipse at 20% 50%, #1a1408 0%, #0e0e10 60%);
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
}
.orb-1 {
    width: 500px; height: 500px;
    background: #c9a84c;
    top: -10%; left: -10%;
    animation: drift 12s ease-in-out infinite alternate;
}
.orb-2 {
    width: 350px; height: 350px;
    background: #6b4e1a;
    bottom: -5%; right: 5%;
    animation: drift 16s ease-in-out infinite alternate-reverse;
}
.orb-3 {
    width: 250px; height: 250px;
    background: #3d2d10;
    top: 40%; left: 55%;
    animation: drift 10s ease-in-out infinite alternate;
}

@keyframes drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(30px, -20px) scale(1.08); }
}

.login-card {
    position: relative;
    z-index: 1;
    background: rgba(24, 24, 28, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 32px 80px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06);
}

.login-icon {
    font-size: 2rem;
    color: var(--gold);
    margin-bottom: 1.25rem;
    display: block;
    animation: pulse-gold 3s ease-in-out infinite;
}

@keyframes pulse-gold {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(0.95); }
}

.login-title {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: 0.02em;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.login-form { display: flex; flex-direction: column; gap: 1rem; }

.input-group { position: relative; }

.input-group input {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 0.875rem 1.25rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    letter-spacing: 0.1em;
}

.input-group input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.12);
}

.input-group.error input {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(224, 90, 90, 0.12);
}

.error-msg {
    display: block;
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 0.4rem;
    text-align: left;
}

.btn-login {
    background: var(--gold);
    color: #0e0e10;
    border: none;
    border-radius: 10px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s, transform 0.15s;
}

.btn-login:hover { background: var(--gold-light); transform: translateY(-1px); }
.btn-login:active { transform: translateY(0); }
.btn-login span { font-size: 1.2rem; }

/* ============================================
   HEADER
   ============================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(14, 14, 16, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 400;
}

.brand-icon { color: var(--gold); font-size: 1rem; }

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn:hover { color: var(--text); background: var(--surface2); }
.nav-btn.active { color: var(--gold); background: rgba(201, 168, 76, 0.1); }

.badge {
    background: var(--gold);
    color: #0e0e10;
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.1rem 0.45rem;
    border-radius: 20px;
    min-width: 1.4em;
    text-align: center;
}

.nav-logout {
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
    margin-left: 0.25rem;
    display: flex;
    align-items: center;
}
.nav-logout:hover { color: var(--danger); background: rgba(224, 90, 90, 0.1); }

/* ============================================
   MAIN / TABS
   ============================================ */
.site-main { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.tab-section { display: none; }
.tab-section.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   UPLOAD SECTION
   ============================================ */
.upload-hero {
    text-align: center;
    padding: 2.5rem 0 2rem;
}

.upload-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 400;
    font-style: italic;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text) 0%, var(--gold-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.upload-desc { color: var(--text-muted); font-size: 0.9rem; }

.upload-container { max-width: 680px; margin: 0 auto; }

/* DROP ZONE */
.drop-zone {
    border: 2px dashed rgba(201, 168, 76, 0.25);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s;
    background: rgba(201, 168, 76, 0.02);
    position: relative;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--gold);
    background: rgba(201, 168, 76, 0.06);
    transform: scale(1.005);
}

.drop-icon {
    color: var(--gold);
    opacity: 0.7;
    margin-bottom: 1rem;
    transition: transform 0.2s;
}
.drop-zone:hover .drop-icon { transform: translateY(-4px); }

.drop-title {
    font-size: 1.1rem;
    font-weight: 400;
    margin-bottom: 0.25rem;
}

.drop-sub { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 1rem; }

.btn-choose {
    display: inline-block;
    background: var(--gold);
    color: #0e0e10;
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    margin-bottom: 1rem;
}
.btn-choose:hover { background: var(--gold-light); transform: translateY(-1px); }

.drop-hint { color: var(--text-muted); font-size: 0.78rem; }

/* QUEUE */
.upload-queue {
    margin-top: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.queue-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.queue-title { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }

.btn-clear {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: color 0.2s;
    font-family: var(--font-body);
}
.btn-clear:hover { color: var(--danger); }

.queue-list { max-height: 320px; overflow-y: auto; }

.queue-item {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.queue-item:last-child { border-bottom: none; }
.queue-item:hover { background: var(--surface2); }

.item-thumb {
    width: 44px; height: 44px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--surface2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    overflow: hidden;
}
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }

.item-info { min-width: 0; }

.item-name {
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.3rem;
}

.item-progress-wrap {
    height: 3px;
    background: var(--surface2);
    border-radius: 2px;
    overflow: hidden;
}

.item-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--gold);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.item-status {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}
.item-status.done { color: var(--success); }
.item-status.error { color: var(--danger); }

.item-size {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* QUEUE ACTIONS */
.queue-actions {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid var(--border);
}

.global-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.global-bar {
    flex: 1;
    height: 5px;
    background: var(--surface2);
    border-radius: 3px;
    overflow: hidden;
}

.global-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: 3px;
    transition: width 0.4s ease;
}

.global-label { font-size: 0.78rem; color: var(--text-muted); min-width: 2.5rem; text-align: right; }

.btn-upload {
    background: var(--gold);
    color: #0e0e10;
    border: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.65rem 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    white-space: nowrap;
}
.btn-upload:hover:not(:disabled) { background: var(--gold-light); transform: translateY(-1px); }
.btn-upload:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-upload-icon { font-size: 1rem; }

/* ============================================
   GALLERY SECTION
   ============================================ */
.gallery-hero {
    text-align: center;
    padding: 2.5rem 0 2rem;
}

.gallery-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 400;
    font-style: italic;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--text) 0%, var(--gold-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gallery-desc { color: var(--text-muted); font-size: 0.9rem; }

.gallery-empty {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.gallery-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: var(--surface);
    cursor: pointer;
    aspect-ratio: 1;
    transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-item:hover { transform: scale(1.02); box-shadow: 0 12px 40px rgba(0,0,0,0.5); z-index: 1; }

.media-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--surface2);
}

.media-thumb img,
.media-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-thumb { position: relative; }

.play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: rgba(0,0,0,0.35);
    color: white;
    opacity: 0.85;
    transition: opacity 0.2s;
}
.gallery-item:hover .play-icon { opacity: 1; }

.media-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
}
.gallery-item:hover .media-overlay { opacity: 1; }

.media-size { font-size: 0.72rem; color: rgba(255,255,255,0.8); }

.media-dl {
    color: white;
    font-size: 1.1rem;
    text-decoration: none;
    background: rgba(201, 168, 76, 0.85);
    width: 28px; height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
.media-dl:hover { background: var(--gold); }

/* ============================================
   LIGHTBOX
   ============================================ */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(8, 8, 10, 0.97);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.25s ease;
}

.lb-close {
    position: absolute;
    top: 1.25rem; right: 1.5rem;
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--text);
    font-size: 1.1rem;
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
}
.lb-close:hover { background: rgba(255,255,255,0.16); }

.lb-prev, .lb-next {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--text);
    font-size: 2rem;
    width: 48px; height: 64px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lb-prev { left: 1rem; }
.lb-next { right: 1rem; }
.lb-prev:hover, .lb-next:hover { background: rgba(255,255,255,0.16); }

.lb-content {
    max-width: calc(100vw - 8rem);
    max-height: calc(100vh - 8rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lb-content img {
    max-width: 100%;
    max-height: calc(100vh - 8rem);
    object-fit: contain;
    border-radius: 6px;
    box-shadow: var(--shadow);
}

.lb-content video {
    max-width: 100%;
    max-height: calc(100vh - 8rem);
    border-radius: 6px;
    box-shadow: var(--shadow);
    outline: none;
}

.lb-bar {
    position: absolute;
    bottom: 1.5rem;
    left: 50%; transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(24,24,28,0.9);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 1.25rem;
    max-width: calc(100vw - 4rem);
}

.lb-name {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.lb-dl {
    color: var(--gold);
    font-size: 0.82rem;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s;
}
.lb-dl:hover { color: var(--gold-light); }

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #333; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
    .header-inner { padding: 0 1rem; }
    .site-main { padding: 1.5rem 1rem 3rem; }
    .login-card { padding: 2rem 1.5rem; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
    .drop-zone { padding: 2rem 1rem; }
    .lb-prev { left: 0.25rem; }
    .lb-next { right: 0.25rem; }
    .lb-content { max-width: calc(100vw - 5rem); }
    .queue-item { grid-template-columns: 36px 1fr auto; }
    .item-thumb { width: 36px; height: 36px; }
}

@media (max-width: 400px) {
    .nav-btn { padding: 0.4rem 0.6rem; font-size: 0.82rem; }
    .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
.lightbox[hidden] {
    display: none !important;
}
