/* ═══════════════════════════════════════════════════════
   UNC FOTO — Production CSS v4.0
   Design: Dark glass-morphism · Fluid layout · Cinematic
   ═══════════════════════════════════════════════════════ */

/* ── Custom Properties ─────────────────────────────────── */
:root {
    /* Core palette */
    --ink:          #060810;
    --surface-0:    #0c1018;
    --surface-1:    #111827;
    --surface-2:    #1a2235;
    --surface-3:    #1f2a40;
    --rim:          rgba(255,255,255,0.06);
    --rim-active:   rgba(0,229,255,0.25);

    /* Accent */
    --cyan:         #00e5ff;
    --blue:         #0077ff;
    --cyan-glow:    rgba(0,229,255,0.18);
    --blue-glow:    rgba(0,119,255,0.18);

    /* Admin / gold accent */
    --gold:         #ffd700;
    --gold-dim:     #ffaa00;
    --gold-glow:    rgba(255,215,0,0.15);

    /* Gradients */
    --grad-accent:  linear-gradient(135deg, var(--cyan), var(--blue));
    --grad-surface: linear-gradient(145deg, #131c2d, #0c1018);

    /* Text */
    --text-primary:   #e8f0fe;
    --text-secondary: #8fa3c8;
    --text-muted:     #4a5d7a;

    /* Status */
    --error:        #ff4d6d;
    --error-glow:   rgba(255,77,109,0.15);
    --success:      #00e5a0;
    --success-glow: rgba(0,229,160,0.15);
    --warn:         #ffb347;

    /* Spacing */
    --gap:         1.5rem;
    --radius-sm:   10px;
    --radius-md:   18px;
    --radius-lg:   28px;
    --radius-xl:   40px;
    --radius-pill: 9999px;

    /* Typography */
    --font-body:   'Outfit', sans-serif;
    --font-mono:   'Space Mono', monospace;

    /* Motion */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --nav-h:         64px;
    --max-w:         1200px;
    --admin-w:       260px;
}

/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--ink);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100svh;
    overflow-x: hidden;
    line-height: 1.6;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, button, label { font-family: inherit; }

/* ── Background Orbs ──────────────────────────────────── */
.bg-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: orb-drift 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(0,119,255,0.5) 0%, transparent 70%);
    top: -200px; left: -150px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(0,229,255,0.4) 0%, transparent 70%);
    bottom: -100px; right: -100px;
    animation-delay: -7s;
}

.orb-3 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(0,50,180,0.3) 0%, transparent 70%);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes orb-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%       { transform: translate(30px, -40px) scale(1.05); }
    66%       { transform: translate(-20px, 30px) scale(0.97); }
}

/* ── Noise Texture ──────────────────────────────────────── */
.noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 256px;
}

/* ── App Shell ──────────────────────────────────────────── */
.app-shell {
    position: relative;
    z-index: 2;
    min-height: 100svh;
}

.screen {
    min-height: 100svh;
    width: 100%;
}

/* ── Glass Card ─────────────────────────────────────────── */
.glass-card {
    background: rgba(17, 24, 39, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--rim);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ═══════════════════════════════════════════════════════
   AUTH SCREEN
   ═══════════════════════════════════════════════════════ */

.screen-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    padding-bottom: env(safe-area-inset-bottom, 2rem);
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    animation: fade-up 0.7s var(--ease-out-expo) both;
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Brand block */
.brand-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.brand-icon {
    width: 72px;
    height: 72px;
    background: var(--surface-2);
    border: 1px solid var(--rim-active);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    box-shadow: 0 0 30px rgba(0,119,255,0.2), 0 0 0 8px rgba(0,119,255,0.04);
    animation: icon-pulse 3s ease-in-out infinite;
}

.brand-icon svg { width: 100%; height: 100%; }

@keyframes icon-pulse {
    0%, 100% { box-shadow: 0 0 30px rgba(0,119,255,0.2), 0 0 0 8px rgba(0,119,255,0.04); }
    50%       { box-shadow: 0 0 45px rgba(0,229,255,0.3), 0 0 0 12px rgba(0,229,255,0.06); }
}

.brand-name {
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: var(--text-primary);
    line-height: 1;
}

.brand-accent {
    background: var(--grad-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.brand-tagline {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 400;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: var(--font-mono);
}

/* Auth card */
.auth-card {
    width: 100%;
    border-radius: var(--radius-xl);
    padding: 2rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.auth-card-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-card-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Fields */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.field-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.field-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding-left: 4px;
}

.field-inner {
    position: relative;
    display: flex;
    align-items: center;
}

.field-icon {
    position: absolute;
    left: 14px;
    width: 17px;
    height: 17px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s;
    flex-shrink: 0;
}

.field-input {
    width: 100%;
    padding: 0.875rem 3rem 0.875rem 2.75rem;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: var(--radius-pill);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-body);
    font-weight: 400;
    outline: none;
    transition: border-color 0.25s, box-shadow 0.25s;
    -webkit-appearance: none;
}

.field-input::placeholder {
    color: var(--text-muted);
    font-weight: 300;
}

.field-input:focus {
    border-color: rgba(0,229,255,0.4);
    box-shadow: 0 0 0 3px rgba(0,229,255,0.08), 0 0 20px rgba(0,229,255,0.08);
}

.field-inner:focus-within .field-icon {
    color: var(--cyan);
}

.toggle-password {
    position: absolute;
    right: 12px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
}

.toggle-password:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.06);
}

.eye-icon {
    width: 17px;
    height: 17px;
}

/* ── Primary Button ─────────────────────────────────────── */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.9rem 1.5rem;
    background: var(--grad-accent);
    border: none;
    border-radius: var(--radius-pill);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-body);
    letter-spacing: 0.5px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s var(--ease-spring),
    box-shadow 0.3s ease,
    opacity 0.2s;
    box-shadow: 0 4px 20px rgba(0,119,255,0.3);
    line-height: 1;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 8px 30px rgba(0,229,255,0.35), 0 0 0 1px rgba(0,229,255,0.2);
}

.btn-primary:hover::before { opacity: 1; }
.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-primary.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-arrow-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
    transition: transform 0.2s;
}

.btn-arrow-wrap svg {
    width: 18px;
    height: 18px;
    display: block;
}

.btn-primary:hover .btn-arrow-wrap {
    transform: translateX(3px);
}

/* Spinner */
.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.btn-spinner-sm {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.3rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Auth note */
.auth-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
    padding: 0 0.5rem;
}

/* ═══════════════════════════════════════════════════════
   MAIN APP SCREEN
   ═══════════════════════════════════════════════════════ */

.screen-main {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
}

/* ── Top Navigation Bar ────────────────────────────────── */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    border-radius: 0;
    border-top: none;
    border-left: none;
    border-right: none;
    border-bottom: 1px solid var(--rim);
    animation: slide-down 0.5s var(--ease-out-expo) both;
    flex-shrink: 0;
}

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.top-bar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.nav-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
}

.nav-icon svg { width: 100%; height: 100%; }

.nav-brand-text {
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--text-primary);
}

.top-bar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-2);
    border: 1px solid var(--rim);
    border-radius: var(--radius-pill);
    padding: 0.3rem 0.75rem 0.3rem 0.3rem;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--grad-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    font-family: var(--font-body);
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-ghost {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: transparent;
    border: 1px solid var(--rim);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-body);
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.btn-ghost svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-ghost:hover {
    color: var(--error);
    border-color: rgba(255,77,109,0.3);
    background: rgba(255,77,109,0.05);
}

/* ── App Body: sidebar layout ──────────────────────────── */
.app-body {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    /* reverse column order: admin panel on right, content on left */
    max-width: var(--max-w);
    width: 100%;
    margin: 0 auto;
    gap: 0;
    position: relative;
}

/* When admin panel is active, constrain main content */
.has-admin-panel .app-body {
    /* no change needed — flexbox handles it */
}

/* ── Main Content ──────────────────────────────────────── */
.main-content {
    flex: 1;
    min-width: 0;
    padding: var(--gap) 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    animation: fade-up 0.6s var(--ease-out-expo) 0.1s both;
}

/* ═══════════════════════════════════════════════════════
   ADMIN PANEL
   ═══════════════════════════════════════════════════════ */

.admin-panel {
    width: var(--admin-w);
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--nav-h) + 1.5rem);
    max-height: calc(100svh - var(--nav-h) - 3rem);
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin: 1.5rem 1.5rem 1.5rem 0;
    animation: slide-in-right 0.5s var(--ease-out-expo) 0.15s both;
    /* Visual: gold-tinted border to signal admin-only */
    border-color: rgba(255,215,0,0.12);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4),
    0 0 0 1px rgba(255,215,0,0.06),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

@keyframes slide-in-right {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* Panel header */
.admin-panel-header {
    padding: 1.25rem 1.25rem 0.75rem;
    border-bottom: 1px solid var(--rim);
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(255,215,0,0.04) 0%, transparent 100%);
}

.admin-panel-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.admin-badge {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 4px rgba(255,215,0,0.4));
}

.admin-badge svg {
    width: 100%;
    height: 100%;
}

.admin-panel-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.admin-panel-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.4;
    font-family: var(--font-mono);
}

/* User list scrollable area */
.admin-user-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.admin-user-list::-webkit-scrollbar { width: 4px; }
.admin-user-list::-webkit-scrollbar-track { background: transparent; }
.admin-user-list::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 2px;
}

/* Individual user item */
.admin-user-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    width: 100%;
    color: var(--text-secondary);
    transition: background 0.2s, border-color 0.2s, color 0.2s,
    transform 0.15s var(--ease-spring);
    position: relative;
}

.admin-user-item:hover {
    background: rgba(255,255,255,0.04);
    border-color: var(--rim);
    color: var(--text-primary);
    transform: translateX(2px);
}

.admin-user-item.active {
    background: rgba(0,229,255,0.06);
    border-color: rgba(0,229,255,0.2);
    color: var(--text-primary);
    box-shadow: 0 0 0 1px rgba(0,229,255,0.08) inset;
}

.admin-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-3);
    border: 1px solid var(--rim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-secondary);
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.admin-user-item.active .admin-user-avatar {
    background: linear-gradient(135deg, rgba(0,229,255,0.15), rgba(0,119,255,0.15));
    border-color: rgba(0,229,255,0.3);
    color: var(--cyan);
}

.admin-user-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    flex: 1;
}

.admin-user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.admin-user-count {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    line-height: 1.2;
}

.admin-user-active-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--cyan);
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(0,229,255,0.6);
    animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(0.8); }
}

/* Empty state inside admin panel */
.admin-empty {
    padding: 1.5rem 0.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* ── Admin Browsing Bar ──────────────────────────────────── */
/* Shows when admin is viewing someone else's vault */
.admin-browsing-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 1rem 0.65rem 1.1rem;
    background: linear-gradient(135deg, rgba(0,229,255,0.07), rgba(0,119,255,0.04));
    border: 1px solid rgba(0,229,255,0.18);
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
    /* Slide-in animation */
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s var(--ease-out-expo),
    transform 0.3s var(--ease-out-expo);
}

.admin-browsing-bar.visible {
    opacity: 1;
    transform: translateY(0);
}

.admin-browsing-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 0;
}

.admin-browsing-info strong {
    color: var(--cyan);
    font-weight: 700;
}

.admin-browsing-icon {
    width: 16px;
    height: 16px;
    color: var(--cyan);
    flex-shrink: 0;
    opacity: 0.7;
}

/* Back to my vault button */
.admin-back-btn {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.9rem;
    background: rgba(0,229,255,0.08);
    border: 1px solid rgba(0,229,255,0.22);
    border-radius: var(--radius-pill);
    color: var(--cyan);
    font-size: 0.8rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s,
    transform 0.15s var(--ease-spring),
    box-shadow 0.2s;
}

.admin-back-btn svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.admin-back-btn:hover {
    background: rgba(0,229,255,0.14);
    border-color: rgba(0,229,255,0.4);
    transform: translateX(-2px);
    box-shadow: 0 0 16px rgba(0,229,255,0.12);
}

.admin-back-btn:active {
    transform: translateX(0) scale(0.97);
}

/* ═══════════════════════════════════════════════════════
   UPLOAD ZONE
   ═══════════════════════════════════════════════════════ */

.upload-zone {
    border-radius: var(--radius-xl);
    padding: 0;
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.upload-zone.drag-over {
    border-color: var(--rim-active);
    box-shadow: 0 0 0 3px rgba(0,229,255,0.1),
    0 12px 40px rgba(0,229,255,0.1);
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 2rem;
    cursor: pointer;
    transition: background 0.25s;
    border-radius: inherit;
    gap: 1rem;
    text-align: center;
}

.upload-label:hover {
    background: rgba(0,229,255,0.03);
}

.upload-label:hover .upload-icon-ring {
    transform: scale(1.06);
}

.upload-idle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.upload-icon-ring {
    width: 72px;
    height: 72px;
    transition: transform 0.3s var(--ease-spring);
}

.upload-ring-dash {
    animation: ring-rotate 15s linear infinite;
    transform-origin: center;
}

@keyframes ring-rotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.upload-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Upload loading state */
.upload-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.upload-progress-ring {
    position: relative;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-progress-ring svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.progress-label {
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--cyan);
    z-index: 1;
}

.progress-circle {
    transition: stroke-dashoffset 0.3s ease;
}

.upload-loading-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ── Status Toast ──────────────────────────────────────── */
.status-toast {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    border-radius: var(--radius-pill);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

.status-toast.visible {
    max-height: 80px;
    opacity: 1;
    padding: 0.5rem 1.25rem;
    margin: 0 1rem 1rem;
}

.status-toast.error {
    color: var(--error);
    background: var(--error-glow);
    border: 1px solid rgba(255,77,109,0.2);
}

.status-toast.success {
    color: var(--success);
    background: var(--success-glow);
    border: 1px solid rgba(0,229,160,0.2);
}

/* ── Gallery ───────────────────────────────────────────── */
.gallery-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.gallery-title {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gallery-count {
    background: var(--surface-2);
    border: 1px solid var(--rim);
    border-radius: var(--radius-pill);
    padding: 0.15rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--cyan);
    letter-spacing: 0.5px;
}

.gallery-controls {
    display: flex;
    gap: 0.25rem;
    background: var(--surface-1);
    border: 1px solid var(--rim);
    border-radius: var(--radius-md);
    padding: 0.3rem;
}

.view-toggle {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: color 0.2s, background 0.2s;
}

.view-toggle svg {
    width: 16px;
    height: 16px;
}

.view-toggle:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

.view-toggle.active {
    color: var(--cyan);
    background: rgba(0,229,255,0.1);
}

/* ── Gallery Grid ──────────────────────────────────────── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

.gallery-grid.list-view {
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

/* ── Image Card ────────────────────────────────────────── */
.img-card {
    background: var(--surface-1);
    border: 1px solid var(--rim);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s var(--ease-spring),
    border-color 0.3s,
    box-shadow 0.3s;
    animation: card-in 0.5s var(--ease-out-expo) both;
}

@keyframes card-in {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.img-card:hover {
    transform: translateY(-5px) scale(1.01);
    border-color: rgba(0,229,255,0.25);
    box-shadow: 0 16px 40px rgba(0,0,0,0.5),
    0 0 0 1px rgba(0,229,255,0.1);
}

.img-card:active {
    transform: translateY(-2px) scale(0.99);
}

/* ── Card Thumbnail ─────────────────────────────────────── */
.img-card-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    position: relative;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-card-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    transition: transform 0.5s var(--ease-out-expo), opacity 0.3s;
    will-change: transform;
}

.img-card:hover .img-card-thumb img {
    transform: scale(1.06);
}

/* Skeleton loading */
.img-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
    var(--surface-2) 25%,
    var(--surface-3) 50%,
    var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    z-index: 1;
}

@keyframes shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* Card overlay on hover */
.img-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.1) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0.65rem 0.75rem;
    z-index: 2;
}

.img-card:hover .img-card-overlay {
    opacity: 1;
}

.overlay-hint {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    font-family: var(--font-mono);
    letter-spacing: 0.3px;
}

.overlay-hint svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* Overlay action button group */
.overlay-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

/* Delete button on card overlay */
.card-delete-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,77,109,0.15);
    border: 1px solid rgba(255,77,109,0.3);
    border-radius: 50%;
    color: rgba(255,255,255,0.85);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s,
    transform 0.2s var(--ease-spring);
    flex-shrink: 0;
}

.card-delete-btn svg {
    width: 14px;
    height: 14px;
}

.card-delete-btn:hover {
    background: rgba(255,77,109,0.35);
    border-color: rgba(255,77,109,0.7);
    color: #fff;
    transform: scale(1.12);
}

.card-delete-btn:active {
    transform: scale(0.95);
}

/* ── Copy button on card overlay (admin browsing) ──────── */
.card-copy-btn {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,229,255,0.12);
    border: 1px solid rgba(0,229,255,0.3);
    border-radius: 50%;
    color: rgba(255,255,255,0.9);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s,
    transform 0.2s var(--ease-spring);
    flex-shrink: 0;
}

.card-copy-btn svg {
    width: 14px;
    height: 14px;
}

.card-copy-btn:hover {
    background: rgba(0,229,255,0.28);
    border-color: rgba(0,229,255,0.65);
    color: #fff;
    transform: scale(1.12);
}

.card-copy-btn:active {
    transform: scale(0.95);
}

/* Copy success flash */
.card-copy-btn.copy-success,
.list-copy-btn.copy-success {
    background: rgba(0,229,160,0.25) !important;
    border-color: rgba(0,229,160,0.6) !important;
    color: var(--success) !important;
}

/* Card meta (list view) */
.img-card-meta {
    padding: 0 0.75rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* ── List view card ──────────────────────────────────────── */
.list-view .img-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.list-view .img-card-thumb {
    aspect-ratio: unset;
    width: 110px;
    height: 72px;
    flex-shrink: 0;
    border-radius: 0;
}

.list-view .img-card-thumb img {
    border-radius: 0;
}

.list-view .img-card-overlay {
    padding: 0.4rem 0.5rem;
    align-items: center;
}

/* List mode: hide the view hint text */
.list-view .overlay-hint {
    display: none;
}

/* Copy button for list view rows */
.list-copy-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(0,229,255,0.2);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 0;
    transition: background 0.2s, border-color 0.2s, color 0.2s,
    transform 0.2s var(--ease-spring);
}

.list-copy-btn svg {
    width: 15px;
    height: 15px;
}

.list-copy-btn:hover {
    background: rgba(0,229,255,0.1);
    border-color: rgba(0,229,255,0.5);
    color: var(--cyan);
    transform: scale(1.08);
}

.list-copy-btn:active {
    transform: scale(0.95);
}

/* Delete button for list view rows */
.list-delete-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(255,77,109,0.2);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 0.75rem;
    transition: background 0.2s, border-color 0.2s, color 0.2s,
    transform 0.2s var(--ease-spring);
}

.list-delete-btn svg {
    width: 15px;
    height: 15px;
}

.list-delete-btn:hover {
    background: rgba(255,77,109,0.1);
    border-color: rgba(255,77,109,0.5);
    color: var(--error);
    transform: scale(1.08);
}

.list-delete-btn:active {
    transform: scale(0.95);
}

/* Spacing when copy btn and delete btn are both present in list view */
.list-view .list-copy-btn {
    margin-right: 0.35rem;
}

/* ── Empty Gallery State ────────────────────────────────── */
.gallery-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.gallery-empty-icon {
    width: 60px;
    height: 60px;
    opacity: 0.3;
}

.gallery-empty p:first-of-type {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 1rem;
}

.gallery-empty p:last-of-type {
    font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════
   LIGHTBOX
   ═══════════════════════════════════════════════════════ */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: lb-in 0.25s ease both;
}

@keyframes lb-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: zoom-out;
}

.lightbox-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    max-width: min(900px, 100%);
    width: 100%;
    animation: lb-content-in 0.3s var(--ease-out-expo) both;
}

@keyframes lb-content-in {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

.lightbox-close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 40px;
    height: 40px;
    background: var(--surface-2);
    border: 1px solid var(--rim);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    z-index: 2;
    transition: background 0.2s, border-color 0.2s;
}

.lightbox-close:hover {
    background: var(--surface-3);
    border-color: rgba(255,77,109,0.4);
    color: var(--error);
}

.lightbox-close svg {
    width: 16px;
    height: 16px;
}

.lightbox-img {
    width: 100%;
    max-height: 75svh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    border: 1px solid var(--rim);
    box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}

.lightbox-actions {
    display: flex;
    gap: 0.75rem;
}

.lightbox-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--surface-2);
    border: 1px solid var(--rim);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-body);
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    cursor: pointer;
}

.lightbox-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.lightbox-btn:hover {
    color: var(--cyan);
    border-color: rgba(0,229,255,0.3);
    background: rgba(0,229,255,0.06);
}

/* ═══════════════════════════════════════════════════════
   DELETE CONFIRMATION MODAL
   ═══════════════════════════════════════════════════════ */

.delete-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(0,0,0,0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    transition: background 0.28s ease, backdrop-filter 0.28s ease;
}

.delete-modal.visible {
    background: rgba(0,0,0,0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.delete-modal-inner {
    position: relative;
    width: 100%;
    max-width: 400px;
    border-radius: var(--radius-xl);
    padding: 2rem 1.75rem 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    text-align: center;
    opacity: 0;
    transform: scale(0.88) translateY(20px);
    transition: opacity 0.28s var(--ease-out-expo),
    transform 0.28s var(--ease-out-expo);
    border-color: rgba(255,77,109,0.15);
    box-shadow: 0 24px 60px rgba(0,0,0,0.6),
    0 0 0 1px rgba(255,77,109,0.08),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

.delete-modal.visible .delete-modal-inner {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.delete-modal-x {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--rim);
    border-radius: 50%;
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.delete-modal-x svg {
    width: 14px;
    height: 14px;
}

.delete-modal-x:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
}

.delete-modal-icon-wrap {
    position: relative;
}

.delete-modal-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,77,109,0.08);
    border: 1.5px solid rgba(255,77,109,0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 0 8px rgba(255,77,109,0.04),
    0 0 24px rgba(255,77,109,0.12);
    animation: delete-icon-pulse 2.5s ease-in-out infinite;
}

.delete-modal-icon svg {
    width: 30px;
    height: 30px;
}

@keyframes delete-icon-pulse {
    0%, 100% { box-shadow: 0 0 0 8px rgba(255,77,109,0.04), 0 0 24px rgba(255,77,109,0.12); }
    50%       { box-shadow: 0 0 0 12px rgba(255,77,109,0.07), 0 0 36px rgba(255,77,109,0.18); }
}

.delete-modal-thumb-wrap {
    width: 100%;
    max-width: 200px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--rim);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    aspect-ratio: 4/3;
    background: var(--surface-2);
}

.delete-modal-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.delete-modal-text h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.delete-modal-text p {
    font-size: 0.83rem;
    color: var(--text-secondary);
    line-height: 1.55;
    max-width: 300px;
    margin: 0 auto;
}

.delete-modal-actions {
    display: flex;
    gap: 0.75rem;
    width: 100%;
    padding-top: 0.25rem;
}

.delete-modal-cancel {
    flex: 1;
    padding: 0.8rem 1rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--rim);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.delete-modal-cancel:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
    color: var(--text-primary);
}

.delete-modal-confirm {
    flex: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1rem;
    background: linear-gradient(135deg, #ff6b8a, #ff4d6d);
    border: none;
    border-radius: var(--radius-pill);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255,77,109,0.3);
    transition: transform 0.2s var(--ease-spring),
    box-shadow 0.2s,
    opacity 0.2s;
}

.delete-modal-confirm svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.delete-modal-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(255,77,109,0.4);
}

.delete-modal-confirm:active {
    transform: translateY(0) scale(0.98);
}

.delete-modal-confirm:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */

@media (min-width: 1100px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* Tablet and below: admin panel moves to bottom sheet / collapsed */
@media (max-width: 900px) {
    :root {
        --admin-w: 220px;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.875rem;
    }
}

@media (max-width: 768px) {
    :root { --nav-h: 58px; }

    /* On mobile: admin panel goes below nav as a horizontal scrolling pill row */
    .app-body {
        flex-direction: column;
    }

    .admin-panel {
        width: 100%;
        position: static;
        max-height: none;
        margin: 0.75rem 1rem 0;
        border-radius: var(--radius-lg);
        flex-direction: column;
    }

    .admin-user-list {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.6rem 0.75rem;
        gap: 0.5rem;
        flex-wrap: nowrap;
    }

    .admin-user-item {
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;
        padding: 0.6rem 0.75rem;
        min-width: 70px;
        flex-shrink: 0;
        text-align: center;
        border-radius: var(--radius-md);
    }

    .admin-user-item:hover {
        transform: translateY(-2px);
    }

    .admin-user-info {
        align-items: center;
    }

    .admin-user-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }

    .admin-user-name {
        font-size: 0.72rem;
    }

    .admin-user-count {
        display: none;
    }

    .admin-user-active-dot {
        position: absolute;
        top: 6px;
        right: 6px;
    }

    .admin-panel-header {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 1rem;
    }

    .admin-panel-subtitle {
        display: none;
    }

    .main-content {
        padding: 1rem 1rem 2rem;
    }

    .top-bar { padding: 0 1rem; }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
    }

    .user-name { display: none; }
    .btn-ghost span { display: none; }
    .btn-ghost { padding: 0.45rem; }
    .btn-ghost svg { width: 18px; height: 18px; }

    .user-chip { padding: 0.3rem; border-radius: 50%; }
    .upload-label { min-height: 150px; padding: 1.5rem; }

    .admin-browsing-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    :root { --gap: 1rem; }

    .brand-name { font-size: 2rem; }
    .auth-card { border-radius: var(--radius-lg); padding: 1.5rem 1.25rem; }
    .brand-icon { width: 60px; height: 60px; }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .main-content { gap: 1.25rem; }

    .upload-label { min-height: 130px; }
    .upload-icon-ring { width: 56px; height: 56px; }
    .upload-title { font-size: 0.9rem; }

    .lightbox { padding: 0.75rem; }

    .delete-modal-inner { padding: 1.75rem 1.25rem 1.5rem; }
    .delete-modal-thumb-wrap { max-width: 160px; }

    .admin-back-btn span {
        display: none;
    }
}

@media (max-width: 340px) {
    .gallery-grid { grid-template-columns: 1fr; }
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Focus visible ──────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
    border-radius: 4px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible) {
    outline: none;
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--surface-3);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--surface-2); }

/* ── Selection ─────────────────────────────────────────── */
::selection {
    background: rgba(0,229,255,0.2);
    color: var(--text-primary);
}