:root {
    --primary: #E50914;
    --primary-hover: #F40612;
    --primary-dim: rgba(229, 9, 20, 0.08);
    --dark: #0F0F0F;
    --darker: #060606;
    --surface: #111111;
    --surface-hover: #181818;
    --light: #F0F0F0;
    --gray: #888888;
    --gray-light: #555555;
    --glass-bg: rgba(17, 17, 17, 0.85);
    --glass-border: rgba(255, 255, 255, 0.04);
    --radius: 16px;
    --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: background var(--transition);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--darker);
    color: var(--light);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Lightweight gradient background */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background:
        radial-gradient(ellipse 60% 50% at 5% 10%, rgba(229, 9, 20, 0.07) 0%, transparent 50%),
        radial-gradient(ellipse 50% 40% at 95% 90%, rgba(80, 0, 8, 0.06) 0%, transparent 50%);
}

/* Glass Panel */
.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
}

/* Typography */
.logo h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 2px;
    margin-bottom: 2rem;
    user-select: none;
}

.logo span {
    color: var(--primary);
}

.logo.small h1 {
    font-size: 1.4rem;
    margin-bottom: 0;
}

/* Utility */
.hidden { display: none !important; }
.mt-auto { margin-top: auto; }
.flex-row { display: flex; gap: 1rem; }

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.slide-up {
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Staggered row animation */
@keyframes rowAppear {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.row-animate {
    animation: rowAppear 0.35s ease forwards;
    opacity: 0;
}

/* Login View */
#login-view {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 380px;
    padding: 3rem 2.2rem;
    text-align: center;
    transition: opacity 0.5s ease;
}

#login-view h2 {
    font-weight: 300;
    font-size: 1.1rem;
    color: var(--gray);
    margin-bottom: 2.5rem;
    letter-spacing: 0.5px;
}

/* Inputs */
.input-group {
    margin-bottom: 1.2rem;
    text-align: left;
    width: 100%;
}

.input-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--gray);
    font-size: 0.85rem;
    letter-spacing: 0.3px;
}

input, textarea {
    width: 100%;
    padding: 0.9rem 1.1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--light);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    font-family: inherit;
}

textarea {
    resize: vertical;
    min-height: 90px;
}

input:focus, textarea:focus {
    border-color: rgba(229, 9, 20, 0.4);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.06);
}

input::placeholder, textarea::placeholder {
    color: var(--gray-light);
}

select {
    width: 100%;
    padding: 0.9rem 1.1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--light);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='%23888'%3E%3Cpath d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    transition: border-color var(--transition), box-shadow var(--transition);
}

select:focus {
    border-color: rgba(229, 9, 20, 0.4);
    box-shadow: 0 0 0 3px rgba(229, 9, 20, 0.06);
}

select option {
    background: #1a1a1a;
    color: var(--light);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 0.9rem;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, background-color var(--transition), opacity var(--transition);
    letter-spacing: 0.3px;
}

.btn:active {
    transform: scale(0.97);
}

.btn.primary {
    background-color: var(--primary);
    color: var(--light);
}

.btn.primary:hover {
    background-color: var(--primary-hover);
}

.btn.secondary.outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--gray);
}

.btn.secondary.outline:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--light);
}

.error-msg {
    color: var(--primary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    min-height: 1.2rem;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    height: 100vh;
    padding: 1.2rem;
    gap: 1.2rem;
}

.sidebar {
    width: 220px;
    padding: 1.8rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
    flex-shrink: 0;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    text-decoration: none;
    color: var(--gray);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    transition: all var(--transition);
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--light);
}

.nav-item.active {
    background: var(--primary-dim);
    color: var(--primary);
}

.content {
    flex: 1;
    overflow-y: auto;
    padding: 0.8rem 0.5rem;
}

/* Header */
.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.8rem;
}

.header-flex h2 {
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-flex .btn {
    width: auto;
    padding: 0.65rem 1.4rem;
    font-size: 0.85rem;
}

/* Tables */
.table-container {
    padding: 0.5rem;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

th {
    color: var(--gray-light);
    font-weight: 400;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

td {
    font-size: 0.9rem;
}

tr:last-child td {
    border-bottom: none;
}

tr {
    transition: background var(--transition);
}

tr:hover td {
    background: rgba(255, 255, 255, 0.015);
}

.status-badge {
    display: inline-block;
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.photo-btn {
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    background: var(--primary-dim);
    color: var(--primary);
    border: none;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
}

.photo-btn:hover {
    background: rgba(229, 9, 20, 0.15);
}

.edit-btn {
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.04);
    color: var(--gray);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.edit-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--light);
}

.archive-btn {
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(255, 180, 0, 0.08);
    color: #ffb400;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.archive-btn:hover {
    background: rgba(255, 180, 0, 0.15);
}

.delete-btn {
    padding: 0.35rem 0.7rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(229, 9, 20, 0.08);
    color: var(--primary);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.delete-btn:hover {
    background: rgba(229, 9, 20, 0.18);
}

.btn.danger {
    background-color: #c0392b;
    color: var(--light);
}

.btn.danger:hover {
    background-color: #e74c3c;
}

.actions-cell {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.empty-msg {
    text-align: center;
    padding: 2rem;
    color: var(--gray);
    font-size: 0.9rem;
}

.archived-badge {
    opacity: 0.6;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    width: 100%;
    max-width: 480px;
    padding: 2.2rem;
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal.hidden {
    animation: none;
}

.modal h3 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.modal-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.8rem;
}

/* Photo Viewer */
#photo-viewer-modal {
    max-width: 720px;
    padding: 1.2rem;
    text-align: center;
}

#photo-viewer-image {
    max-width: 100%;
    max-height: 65vh;
    border-radius: 10px;
    object-fit: contain;
    margin-bottom: 0.8rem;
}

#photo-loading {
    padding: 2rem;
    color: var(--gray);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-layout {
        flex-direction: column;
        padding: 0.6rem;
        gap: 0.8rem;
    }
    
    .sidebar {
        width: 100%;
        padding: 1rem;
        flex-direction: column; /* Stack logo, nav, button */
        align-items: stretch;
        gap: 1rem;
    }
    
    .logo h1 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
    }
    
    .sidebar .logo.small h1 {
        font-size: 1.4rem;
        text-align: center;
    }
    
    .sidebar nav {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .nav-item {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
        flex: 1;
        text-align: center;
        white-space: nowrap;
    }
    
    .sidebar .btn {
        width: 100%;
        padding: 0.7rem;
        margin-top: 0.5rem;
    }
    
    .header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.2rem;
    }
    
    .header-flex .btn {
        width: 100%;
    }

    .flex-row {
        flex-direction: column;
        gap: 1.2rem;
    }

    th, td {
        padding: 0.8rem 0.6rem;
        font-size: 0.85rem;
    }

    .actions-cell {
        flex-wrap: wrap;
        gap: 0.3rem;
    }
    
    .modal {
        padding: 1.5rem;
    }
}
