/* ===================================================================
   SKYLENS v5 — admin.css
   Dark Cinematic Admin Panel — Complete Rebuild
   =================================================================== */

:root {
    --void: #050507;
    --surface: #0a0a0f;
    --surface-2: #111118;
    --surface-3: #1a1a24;
    --text: #f0f0fa;
    --text-dim: #8a8f98;
    --text-ghost: #555566;
    --accent: #00FFCC;
    --accent-glow: rgba(0,255,204,0.12);
    --accent-hover: rgba(0,255,204,0.18);
    --border: rgba(255,255,255,0.06);
    --border-light: rgba(255,255,255,0.1);
    --danger: #ff3c3c;
    --danger-glow: rgba(255,60,60,0.15);
    --success: #00cc88;
    --warning: #ffc800;
    --radius: 8px;
    --radius-lg: 14px;
    --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --sidebar-width: 240px;
    --sidebar-collapsed: 60px;
    --transition: 0.25s ease;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--void);
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { opacity: 0.85; }

/* ===== SKYLENS BRANDING ===== */
.sky { color: #fff; }
.lens { color: var(--accent); }

/* ===== INPUTS ===== */
.input-field {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 12px 16px;
    color: var(--text);
    font-size: 15px;
    font-family: var(--font);
    width: 100%;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.input-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0,255,204,0.08);
}
.input-field::placeholder { color: var(--text-ghost); }
textarea.input-field { resize: vertical; min-height: 100px; }

/* ===== BUTTONS ===== */
.btn-primary {
    background: var(--accent);
    color: var(--void);
    border: none;
    border-radius: var(--radius);
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 10px 20px;
    font-size: 14px;
    font-family: var(--font);
    cursor: pointer;
    transition: border-color var(--transition), color var(--transition);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 10px 20px;
    font-size: 14px;
    font-family: var(--font);
    cursor: pointer;
    transition: opacity var(--transition);
}
.btn-danger:hover { opacity: 0.85; }

.btn-sm {
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: var(--surface-2);
    color: var(--text-dim);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
}
.btn-sm:hover { color: var(--text); border-color: var(--text-ghost); }
.btn-sm.btn-danger-sm {
    color: var(--text-dim);
    border-color: transparent;
    background: transparent;
}
.btn-sm.btn-danger-sm:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-glow); }

/* ===== LOGIN ===== */
.login-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--void);
    padding: 20px;
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-logo {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: 3px;
    margin-bottom: 6px;
}
.login-subtitle {
    color: var(--text-ghost);
    font-size: 14px;
    margin-bottom: 36px;
}
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.login-card .form-group { margin-bottom: 0; }
.login-error {
    color: var(--danger);
    font-size: 14px;
    min-height: 22px;
    text-align: center;
}

/* ===== ADMIN PANEL LAYOUT ===== */
.admin-panel {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ===== MOBILE TOP BAR ===== */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 52px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    align-items: center;
    padding: 0 16px;
    z-index: 999;
}
.mobile-brand {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-left: 12px;
}
.hamburger {
    background: none;
    border: none;
    color: var(--text);
    font-size: 22px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

/* ===== SIDEBAR ===== */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1000;
    transition: transform var(--transition);
}
.sidebar-brand {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 3px;
    text-align: center;
    padding: 28px 16px 20px;
    border-bottom: 1px solid var(--border);
}
.sidebar-links {
    list-style: none;
    flex: 1;
    padding: 12px 0;
}
.sidebar-links li a {
    display: block;
    padding: 12px 20px;
    margin: 2px 10px;
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all var(--transition);
}
.sidebar-links li a:hover {
    color: var(--text);
    background: var(--surface-2);
}
.sidebar-links li a.active {
    color: var(--accent);
    background: var(--accent-glow);
}
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}
.btn-logout {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-dim);
    font-size: 14px;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
}
.btn-logout:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-glow); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 999;
}

/* ===== MAIN CONTENT ===== */
.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 40px 48px;
    max-width: 1100px;
}
.admin-heading {
    font-size: 28px;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 28px;
}
.admin-section {
    display: none;
    animation: sectionFadeIn 0.35s ease;
}
.admin-section.active { display: block; }
@keyframes sectionFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

/* ===== DASHBOARD ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 36px;
}
.dash-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    text-align: center;
    transition: border-color var(--transition);
}
.dash-card:hover { border-color: var(--border-light); }
.dash-number {
    display: block;
    font-size: 38px;
    font-weight: 700;
    margin-bottom: 8px;
}
.dash-number.accent { color: var(--accent); font-size: 20px; }
.dash-label { font-size: 13px; color: var(--text-dim); }
.quick-actions { margin-top: 8px; }
.quick-actions h3 { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.quick-actions .btn-primary,
.quick-actions .btn-ghost {
    margin-right: 12px;
    margin-bottom: 8px;
}

/* ===== FORMS ===== */
.admin-form { max-width: 600px; }
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-dim);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-status { font-size: 14px; margin-top: 10px; min-height: 20px; }
.admin-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 44px 0 36px;
}

/* ===== TOGGLE SWITCH ===== */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
    border-bottom: 1px solid var(--border);
}
.toggle-row span {
    font-size: 15px;
    font-weight: 500;
}
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}
.toggle-switch input { display: none; }
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--surface-3);
    border-radius: 14px;
    transition: background var(--transition);
}
.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 22px; height: 22px;
    background: var(--text-dim);
    border-radius: 50%;
    transition: all var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent-glow); }
.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(24px);
    background: var(--accent);
}

/* ===== GALLERY UPLOAD ===== */
.gallery-upload-area {
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    color: var(--text-ghost);
    cursor: pointer;
    margin-bottom: 28px;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.gallery-upload-area:hover,
.gallery-upload-area.dragover {
    border-color: var(--accent);
    color: var(--text-dim);
    background: rgba(0,255,204,0.03);
}
.upload-icon { font-size: 40px; margin-bottom: 12px; }
.upload-hint { font-size: 13px; margin-top: 6px; color: var(--text-ghost); }

/* Upload Preview */
.upload-preview {
    margin-bottom: 32px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.upload-preview h3 { font-size: 16px; margin-bottom: 16px; }
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.preview-thumb {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 1;
}
.preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.preview-thumb .remove-preview {
    position: absolute;
    top: 4px; right: 4px;
    width: 24px; height: 24px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.upload-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.upload-actions .input-field { max-width: 300px; }
.upload-status { font-size: 14px; margin-top: 10px; }

/* ===== ADMIN GALLERY GRID ===== */
.admin-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}
.admin-gallery-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--transition);
}
.admin-gallery-item:hover { border-color: var(--border-light); }
.admin-gallery-item img {
    width: 100%;
    height: 170px;
    object-fit: cover;
    display: block;
}
.admin-gallery-item .item-info { padding: 14px; }
.admin-gallery-item .item-filename {
    font-size: 12px;
    color: var(--text-ghost);
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.admin-gallery-item .item-desc-input {
    font-size: 13px;
    padding: 8px 12px;
    margin-bottom: 10px;
}
.admin-gallery-item .item-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ===== AUDIT TABLE ===== */
.audit-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.audit-table th {
    text-align: left;
    padding: 13px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.audit-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: top;
}
.audit-table tbody tr:hover td { background: var(--surface-2); }
.audit-table tbody tr:last-child td { border-bottom: none; }
.audit-table td:first-child {
    color: var(--text-ghost);
    white-space: nowrap;
    font-size: 13px;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    padding: 14px 22px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    animation: toastIn 0.35s ease, toastOut 0.3s ease 2.5s forwards;
    max-width: 400px;
}
.toast-success {
    background: #0a2f1f;
    color: var(--success);
    border: 1px solid rgba(0,204,136,0.3);
}
.toast-error {
    background: #2f0a0a;
    color: var(--danger);
    border: 1px solid rgba(255,60,60,0.3);
}
.toast-info {
    background: #0a1a2f;
    color: #4da6ff;
    border: 1px solid rgba(77,166,255,0.3);
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: none; }
}
@keyframes toastOut {
    from { opacity: 1; }
    to { opacity: 0; transform: translateY(-10px); }
}

/* ===== TEXT UTILITIES ===== */
.text-dim { color: var(--text-dim); }
.text-ghost { color: var(--text-ghost); font-size: 12px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .mobile-topbar { display: flex; }

    .admin-sidebar {
        transform: translateX(-100%);
        width: 260px;
        top: 52px;
        bottom: 0;
        border-right: 1px solid var(--border);
        box-shadow: 4px 0 20px rgba(0,0,0,0.5);
    }
    .admin-sidebar.open { transform: translateX(0); }

    .sidebar-overlay.open { display: block; }

    .sidebar-brand { display: none; }
    .admin-main {
        margin-left: 0;
        padding: 72px 20px 32px;
    }
    .admin-heading { font-size: 22px; margin-bottom: 20px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .admin-gallery-grid { grid-template-columns: 1fr; }
    .preview-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
    .login-card { margin: 16px; padding: 36px 24px; }
    .upload-actions { flex-direction: column; align-items: stretch; }
    .upload-actions .input-field { max-width: none; }
    .audit-table-wrap { border-radius: var(--radius); }
    .audit-table { font-size: 13px; }
    .audit-table th, .audit-table td { padding: 8px 10px; }

    .toast-container { left: 16px; right: 16px; bottom: 16px; }
    .toast { max-width: none; }
}
