/* css/style.css */

@font-face {
    font-family: 'Berlin Sans FB Demi';
    src: url('../inc/BRLNSDB.TTF') format('truetype');
    font-weight: 600;
    font-style: normal;
}

:root {
    /* Color Palette - Default (Dark) */
    --primary: #4F46E5; /* Indigo */
    --primary-hover: #4338CA;
    --secondary: #10B981; /* Emerald */
    --secondary-hover: #059669;
    --danger: #EF4444; /* Red */
    --danger-hover: #DC2626;
    
    /* Neutral Colors / Dark Mode base */
    --bg-dark: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Layout & Styling */
    --sidebar-width: 270px;
    --radius-lg: 16px;
    --radius-md: 8px;
    --transition: all 0.3s ease;
    
    /* Shadows - Glassmorphism hint */
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-glow: 0 0 15px rgba(79, 70, 229, 0.4);
}

/* Theme: Light */
body.theme-light {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    
    --bg-dark: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --shadow-glow: 0 0 15px rgba(59, 130, 246, 0.2);
}

/* Theme: Sunset */
body.theme-sunset {
    --primary: #ea580c;      /* Orange */
    --primary-hover: #c2410c;
    --secondary: #eab308;    /* Yellow */
    --secondary-hover: #ca8a04;
    --danger: #dc2626;
    --danger-hover: #b91c1c;

    --bg-dark: #1c1917;      /* Warm dark gray */
    --bg-sidebar: #292524;
    --bg-card: #292524;
    --bg-card-hover: #44403c;

    --text-main: #fafaf9;
    --text-muted: #a8a29e;
    --shadow-glow: 0 0 15px rgba(234, 88, 12, 0.4);
}

/* Theme: Ocean */
body.theme-ocean {
    --primary: #0ea5e9;      /* Light Blue */
    --primary-hover: #0284c7;
    --secondary: #14b8a6;    /* Teal */
    --secondary-hover: #0d9488;
    --danger: #f43f5e;
    --danger-hover: #e11d48;

    --bg-dark: #082f49;      /* Deep Ocean Blue */
    --bg-sidebar: #0c4a6e;
    --bg-card: #0c4a6e;
    --bg-card-hover: #075985;

    --text-main: #f0f9ff;
    --text-muted: #bae6fd;
    --shadow-glow: 0 0 15px rgba(14, 165, 233, 0.4);
}

/* Theme: Cyberpunk */
body.theme-cyberpunk {
    --primary: #d946ef;      /* Neon Fuchsia */
    --primary-hover: #c026d3;
    --secondary: #facc15;    /* Neon Yellow */
    --secondary-hover: #eab308;
    --danger: #ef4444;
    --danger-hover: #dc2626;

    --bg-dark: #020617;      /* Extremely dark blue/black */
    --bg-sidebar: #0f172a;
    --bg-card: #0f172a;
    --bg-card-hover: #1e293b;

    --text-main: #fdf4ff;
    --text-muted: #f0abfc;
    --shadow-glow: 0 0 15px rgba(217, 70, 239, 0.6);
}

/* Theme: Fiery Ocean */
body.theme-fiery-ocean {
    --primary: #cb1c22;
    --primary-hover: #7e0000;
    --secondary: #6d9bc1;
    --secondary-hover: #5a8ab0;
    --danger: #cb1c22;
    --danger-hover: #7e0000;

    --bg-dark: #002b49;
    --bg-sidebar: #001f35;
    --bg-card: #001f35;
    --bg-card-hover: #00385e;

    --text-main: #fcf0d6;
    --text-muted: #6d9bc1;
    --shadow-glow: 0 0 15px rgba(203, 28, 34, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Container Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.05);
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    z-index: 100; /* Higher z-index for mobile overlap */
    transition: var(--transition); /* Allow smooth sliding */
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    padding: 0 1rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: white;
    box-shadow: var(--shadow-glow);
}

.logo-container h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: white;
}

.main-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: block;
    padding: 0.8rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
}

.nav-item:hover, .nav-item.active {
    background-color: rgba(79, 70, 229, 0.15);
    color: var(--primary);
    transform: translateX(4px);
}

/* Multi-level Navigation Extensions */
.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-group-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.nav-group-toggle:hover {
    background-color: rgba(255,255,255,0.05);
    color: var(--text-main);
}

.nav-group-toggle .chevron {
    transition: transform 0.3s ease;
    font-size: 0.8rem;
}

.nav-group-toggle.open .chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

.nav-group-toggle.open {
    color: var(--text-main);
}

.nav-sub-menu {
    list-style: none;
    margin-top: 0.2rem;
    padding-left: 1.5rem;
    border-left: 1px solid rgba(255,255,255,0.05);
    margin-left: 1rem;
}

.nav-sub-menu .nav-item {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}

/* End Multi-level Extensions */

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.top-bar {
    padding: calc(1.5rem - 10px) 2rem;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: sticky;
    top: 0;
    z-index: 5;
}

.menu-toggle {
    display: none; /* Hidden on desktop by default */
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.menu-toggle:hover {
    background: rgba(255,255,255,0.1);
}

.top-bar h2 {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.content {
    padding: 2rem;
    flex: 1;
}

/* Dashboard Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255,255,255,0.02);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    border-radius: 4px 0 0 4px;
}

.stat-card.no-trim::before {
    display: none;
}

.stat-card:nth-child(2)::before { background: var(--secondary); }
.stat-card:nth-child(3)::before { background: #F59E0B; }

.stat-card.no-trim:hover {
    transform: none;
    background: var(--bg-card);
    box-shadow: var(--shadow-soft);
}

.stat-card:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-glow);
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(79, 70, 229, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--primary);
}

.stat-card:nth-child(2) .stat-icon { color: var(--secondary); background: rgba(16, 185, 129, 0.1); }
.stat-card:nth-child(3) .stat-icon { color: #F59E0B; background: rgba(245, 158, 11, 0.1); }

.stat-details h3 {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
}

.stat-details .stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: white;
}

/* Forms & Inputs */
.form-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255,255,255,0.05);
}

.form-card h3 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 0.8rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    background-color: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    color: white;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
    background-color: rgba(0,0,0,0.4);
}

select.form-control option,
select.form-control optgroup {
    background-color: var(--bg-card);
    color: var(--text-main);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(79, 70, 229, 0.6);
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: white;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255,255,255,0.05);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th, .data-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.data-table th {
    background: rgba(0,0,0,0.2);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: rgba(255,255,255,0.02);
}

.data-table td {
    color: var(--text-main);
}

/* Action container in tables */
.actions {
    text-align: right;
    white-space: nowrap;
}
.actions .btn {
    margin-left: 0.5rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-room {
    background: rgba(79, 70, 229, 0.2);
    color: #a5b4fc;
}

.badge-tub {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

/* Flash Messages */
.flash-message {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-weight: 500;
    animation: slideIn 0.3s ease-out forwards;
}

.flash-message.success {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--secondary);
    color: #6ee7b7;
}

.flash-message.error {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--danger);
    color: #fca5a5;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Utilities */
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* Thumbnails */
.thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(255,255,255,0.1);
}

.placeholder-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

input[type="file"] {
    background: rgba(0,0,0,0.1);
    padding: 0.5rem;
    cursor: pointer;
}

/* --- QR Code Labels & Print Optimization --- */

.print-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.qr-label {
    width: 3in;
    height: 2in;
    border: 1px solid #000;
    border-radius: var(--radius-md);
    padding: 0.15in;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
    page-break-inside: avoid; /* Crucial for preventing printing halfway across pages */
}

.qr-label-header {
    text-align: center;
}

.qr-label-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qr-room {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qr-code-render {
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    padding: 5px;
    border-radius: 4px;
    align-self: center;
}

.qr-label-footer {
    font-size: 0.6rem;
    text-align: center;
    color: var(--text-muted);
}

@media print {
    /* Strip away application chrome */
    body {
        background: white !important;
        color: black !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .sidebar, .top-bar, .print-hide {
        display: none !important;
    }
    
    .app-container, .main-content, .content {
        display: block !important;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    /* Optimize Grid for standard paper */
    .print-grid {
        display: grid;
        grid-template-columns: repeat(2, 3in);
        gap: 0.1in 0.2in;
        justify-content: center;
        margin: 0;
    }
    
    .qr-label {
        border: 1pt solid #000 !important;
        background: white !important;
        color: black !important;
    }
    
    .qr-label-header h4 {
        color: black !important;
    }
    
    .qr-room {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .qr-label-footer {
        color: #555 !important;
    }
    
    @page {
        margin: 0.5in;
    }
}

/* --- Responsive & Mobile Optimizations --- */

/* Hamburger Menu Toggle (Hidden on Desktop) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Sidebar Dark Overlay Background (Hidden by Default) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Reveal Overlay when sidebar is open */
.sidebar-overlay.open {
    opacity: 1;
}

/* Media Queries for Screens < 768px (Tablets + Phones) */
@media (max-width: 768px) {
    
    /* Show the hamburger menu in the top bar */
    .menu-toggle {
        display: block;
    }

    /* Transform Sidebar into an Off-Canvas Slide Menu */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%; /* Hide completely off-screen by default */
        height: 100vh;
        overflow-y: auto;
    }

    /* Open the Sidebar */
    .sidebar.open {
        left: 0; /* Slide in */
    }

    /* Activate the overlay block on DOM so it can fade in */
    .sidebar-overlay {
        display: block;
        pointer-events: none; /* Ignore clicks until open */
    }
    
    .sidebar-overlay.open {
        pointer-events: auto; /* Allow clicking to dismiss */
    }

    /* Header & Logo Resizing */
    .top-bar {
        padding: 1rem;
        flex-direction: column; /* Stack top bar elements */
        align-items: flex-start;
        gap: 1rem;
    }
    
    /* Make the logo shrink slightly */
    .top-bar img {
        max-height: 48px !important; 
    }
    
    /* Align the user profile nicely under the logo */
    .user-profile {
        width: 100%;
        justify-content: space-between;
        background: rgba(0,0,0,0.2);
        padding: 0.5rem;
        border-radius: var(--radius-md);
    }
    
    /* Content Padding adjustments */
    .content {
        padding: 1rem;
    }

    /* Force tables to horizontally scroll instead of breaking layout */
    .table-container {
        overflow-x: auto;
    }
    
    .data-table {
        min-width: 600px; /* Ensure table keeps its structure initially */
    }

    /* Stack Stats Cards strictly vertically */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    /* Squeeze forms tightly to maximize space */
    .form-card {
        padding: 1.5rem 1rem;
    }
}

/* --- Themes --- */
body.theme-light,
body.theme-light-lavender,
body.theme-summer-dream,
body.theme-light-mint,
body.theme-light-peach,
body.theme-light-rose {
    --bg-dark: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #475569;
}

body.theme-light {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
}

body.theme-light-lavender {
    --bg-dark: #f9f8ff;
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
}

body.theme-light-mint {
    --bg-dark: #f7fffb;
    --primary: #10b981;
    --primary-hover: #059669;
}

body.theme-light-peach {
    --bg-dark: #fffaf5;
    --primary: #f97316;
    --primary-hover: #ea580c;
}

body.theme-light-rose {
    --bg-dark: #fff5f7;
    --primary: #f43f5e;
    --primary-hover: #e11d48;
}

body.theme-light .top-bar h2,
body.theme-light-lavender .top-bar h2,
body.theme-summer-dream .top-bar h2,
body.theme-light-mint .top-bar h2,
body.theme-light-peach .top-bar h2,
body.theme-light-rose .top-bar h2 {
    background: linear-gradient(to right, #0f172a, #475569);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.theme-light .sidebar,
body.theme-light-lavender .sidebar,
body.theme-summer-dream .sidebar,
body.theme-light-mint .sidebar,
body.theme-light-peach .sidebar,
body.theme-light-rose .sidebar {
    border-right: 1px solid rgba(0,0,0,0.05);
}

body.theme-light .top-bar,
body.theme-light-lavender .top-bar,
body.theme-summer-dream .top-bar,
body.theme-light-mint .top-bar,
body.theme-light-peach .top-bar,
body.theme-light-rose .top-bar {
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

body.theme-light .form-control,
body.theme-light-lavender .form-control,
body.theme-summer-dream .form-control,
body.theme-light-mint .form-control,
body.theme-light-peach .form-control,
body.theme-light-rose .form-control {
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

body.theme-light .form-control:focus,
body.theme-light-lavender .form-control:focus,
body.theme-summer-dream .form-control:focus,
body.theme-light-mint .form-control:focus,
body.theme-light-peach .form-control:focus,
body.theme-light-rose .form-control:focus {
    background-color: #f8fafc;
}

body.theme-light select.form-control option,
body.theme-light select.form-control optgroup,
body.theme-light-lavender select.form-control option,
body.theme-summer-dream select.form-control option,
body.theme-light-mint select.form-control option,
body.theme-light-peach select.form-control option,
body.theme-light-rose select.form-control option {
    background-color: #ffffff;
    color: #0f172a;
}

body.theme-light .nav-item,
body.theme-light-lavender .nav-item,
body.theme-summer-dream .nav-item,
body.theme-light-mint .nav-item,
body.theme-light-peach .nav-item,
body.theme-light-rose .nav-item {
    color: #475569;
}

body.theme-light .data-table th,
body.theme-light-lavender .data-table th,
body.theme-summer-dream .data-table th,
body.theme-light-mint .data-table th,
body.theme-light-peach .data-table th,
body.theme-light-rose .data-table th {
    background: rgba(0,0,0,0.03);
    color: #475569;
}

body.theme-light .data-table td, 
body.theme-light .data-table th,
body.theme-light .table-header,
body.theme-light .form-card h3,
body.theme-light-lavender .data-table td,
body.theme-summer-dream .data-table td,
body.theme-light-mint .data-table td,
body.theme-light-peach .data-table td,
body.theme-light-rose .data-table td {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

body.theme-light .stat-card,
body.theme-light .table-container,
body.theme-light .form-card,
body.theme-light-lavender .stat-card,
body.theme-summer-dream .stat-card,
body.theme-light-mint .stat-card,
body.theme-light-peach .stat-card,
body.theme-light-rose .stat-card {
    border: 1px solid rgba(0,0,0,0.05);
}

body.theme-light .btn-secondary,
body.theme-light-lavender .btn-secondary,
body.theme-summer-dream .btn-secondary,
body.theme-light-mint .btn-secondary,
body.theme-light-peach .btn-secondary,
body.theme-light-rose .btn-secondary {
    background: rgba(0,0,0,0.05);
    color: #0f172a;
}

body.theme-light .btn-secondary:hover,
body.theme-light-lavender .btn-secondary:hover,
body.theme-summer-dream .btn-secondary:hover,
body.theme-light-mint .btn-secondary:hover,
body.theme-light-peach .btn-secondary:hover,
body.theme-light-rose .btn-secondary:hover {
    background: rgba(0,0,0,0.1);
}

body.theme-light .logo-container h1,
body.theme-light-lavender .logo-container h1,
body.theme-summer-dream .logo-container h1,
body.theme-light-mint .logo-container h1,
body.theme-light-peach .logo-container h1,
body.theme-light-rose .logo-container h1 {
    color: #0f172a;
}

body.theme-light input[type="text"][name="q"],
body.theme-light-lavender input[type="text"][name="q"],
body.theme-summer-dream input[type="text"][name="q"],
body.theme-light-mint input[type="text"][name="q"],
body.theme-light-peach input[type="text"][name="q"],
body.theme-light-rose input[type="text"][name="q"] {
    background: rgba(0,0,0,0.05) !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
    color: #0f172a !important;
}

body.theme-light input[type="text"][name="q"]::placeholder,
body.theme-light-lavender input[type="text"][name="q"]::placeholder {
    color: #64748b;
}

body.theme-light .fa-search,
body.theme-light-lavender .fa-search {
    color: #64748b !important;
}

body.theme-midnight {
    --bg-dark: #020617;
    --bg-sidebar: #0f172a;
    --bg-card: #0f172a;
    --bg-card-hover: #1e293b;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #0ea5e9;
    --secondary-hover: #0284c7;
}

body.theme-forest {
    --bg-dark: #0f1712;
    --bg-sidebar: #132219;
    --bg-card: #132219;
    --bg-card-hover: #1b3023;
    --primary: #10b981;
    --primary-hover: #059669;
    --secondary: #059669;
    --secondary-hover: #047857;
}

body.theme-light-grey {
    --bg-dark: #f3f4f6;
    --bg-sidebar: #e5e7eb;
    --bg-card: #ffffff;
    --bg-card-hover: #f9fafb;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --primary: #4b5563;
    --primary-hover: #374151;
    --secondary: #9ca3af;
    --secondary-hover: #6b7280;
}

body.theme-light-grey .top-bar h2 {
    background: linear-gradient(to right, #1f2937, #4b5563);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.theme-light-grey .sidebar {
    border-right: 1px solid rgba(0,0,0,0.1);
}

body.theme-light-grey .top-bar {
    background: rgba(229, 231, 235, 0.9);
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

body.theme-light-grey .form-control {
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    color: #1f2937;
}

body.theme-light-grey .form-control:focus {
    background-color: #f3f4f6;
}

body.theme-light-grey select.form-control option,
body.theme-light-grey select.form-control optgroup {
    background-color: #ffffff;
    color: #1f2937;
}

body.theme-light-grey .nav-item {
    color: #4b5563;
}

body.theme-light-grey .nav-item:hover,
body.theme-light-grey .nav-item.active {
    background-color: rgba(0, 0, 0, 0.05);
    color: #1f2937;
}

body.theme-light-grey .data-table th {
    background: rgba(0,0,0,0.05);
    color: #4b5563;
}

body.theme-light-grey .data-table td, 
body.theme-light-grey .data-table th,
body.theme-light-grey .table-header,
body.theme-light-grey .form-card h3 {
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

body.theme-light-grey .stat-card,
body.theme-light-grey .table-container,
body.theme-light-grey .form-card {
    border: 1px solid rgba(0,0,0,0.1);
}

body.theme-light-grey .btn-secondary {
    background: rgba(0,0,0,0.1);
    color: #1f2937;
}

body.theme-light-grey .btn-secondary:hover {
    background: rgba(0,0,0,0.15);
}

body.theme-light-grey .logo-container h1 {
    color: #1f2937;
}

body.theme-light-grey input[type="text"][name="q"] {
    background: rgba(0,0,0,0.05) !important;
    border: 1px solid rgba(0,0,0,0.1) !important;
    color: #1f2937 !important;
}

body.theme-light-grey input[type="text"][name="q"]::placeholder {
    color: #9ca3af;
}

body.theme-light-grey .fa-search {
    color: #9ca3af !important;
}

body.theme-dark-grey {
    --bg-dark: #1f2937;
    --bg-sidebar: #111827;
    --bg-card: #374151;
    --bg-card-hover: #4b5563;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --primary: #6b7280;
    --primary-hover: #4b5563;
    --secondary: #d1d5db;
    --secondary-hover: #9ca3af;
}


/* --- Mobile Responsive Rules --- */
@media (max-width: 768px) {
    /* Hide the sidebar completely off-screen *by default* on mobile */
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        height: 100vh;
        z-index: 1050;
        transition: left 0.3s ease;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .sidebar-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    /* Show the hamburger menu on mobile */
    .menu-toggle {
        display: block;
    }

    /* Adjust main content padding */
    .main-content {
        width: 100%;
        margin-left: 0;
    }
    
    .top-bar {
        padding: 1rem;
    }
    
    .content {
        padding: 1rem;
    }

    /* Make top bar search more compact or flexible */
    .top-bar form {
        margin: 0 1rem;
    }
    
    .top-bar .user-profile span {
        display: none !important; /* hide 'logged in as' */
    }

    /* Stack stats on mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    @media (max-width: 480px) {
        .stats-grid {
            grid-template-columns: 1fr;
        }
    }

    /* Make Tables Scrollable Horizontally */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--radius-md);
    }
    
    .data-table {
        min-width: 600px; /* Force table wide so it scrolls instead of squishing */
    }

    /* Stack form groups on mobile */
    .form-group.row {
        flex-direction: column;
    }

    /* Ensure modals fit perfectly */
    .modal-content {
        width: 95%;
        margin: 2rem auto;
        padding: 1.5rem;
    }
    
    /* Make buttons larger touch targets */
    .btn {
        padding: 0.8rem 1.2rem;
    }
}

/* --- Theme Selector Grid --- */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.theme-preview-card {
    background: var(--bg-card);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.theme-preview-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-soft);
}

.theme-preview-card.selected {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

.theme-preview-card.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    top: 5px;
    right: 5px;
    color: var(--primary);
    font-size: 0.8rem;
}

.theme-swatch {
    height: 60px;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    display: flex;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.05);
}

.swatch-primary {
    flex: 1;
}

.swatch-bg {
    flex: 1;
}

.theme-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Specific Swatch Colors */
.theme-preview-default .swatch-primary { background-color: #4F46E5; }
.theme-preview-default .swatch-bg { background-color: #0f172a; }

.theme-preview-light .swatch-primary { background-color: #3b82f6; }
.theme-preview-light .swatch-bg { background-color: #f8fafc; }

.theme-preview-midnight .swatch-primary { background-color: #6366f1; }
.theme-preview-midnight .swatch-bg { background-color: #020617; }

.theme-preview-forest .swatch-primary { background-color: #10b981; }
.theme-preview-forest .swatch-bg { background-color: #0f1712; }

.theme-preview-light-grey .swatch-primary { background-color: #4b5563; }
.theme-preview-light-grey .swatch-bg { background-color: #f3f4f6; }

.theme-preview-dark-grey .swatch-primary { background-color: #6b7280; }
.theme-preview-dark-grey .swatch-bg { background-color: #1f2937; }

.theme-preview-sunset .swatch-primary { background-color: #ea580c; }
.theme-preview-sunset .swatch-bg { background-color: #1c1917; }

.theme-preview-ocean .swatch-primary { background-color: #0ea5e9; }
.theme-preview-ocean .swatch-bg { background-color: #082f49; }

.theme-preview-fiery-ocean .swatch-primary { background-color: #cb1c22; }
.theme-preview-fiery-ocean .swatch-bg { background-color: #002b49; }

.theme-preview-coastal-vibes .swatch-primary { background-color: #395a76; }
.theme-preview-coastal-vibes .swatch-bg { background-color: #2c3b47; }

.theme-preview-summer-dream .swatch-primary { background-color: #0384a5; }
.theme-preview-summer-dream .swatch-bg { background-color: #fafcde; }

.theme-preview-cyberpunk .swatch-primary { background-color: #d946ef; }
.theme-preview-cyberpunk .swatch-bg { background-color: #020617; }

.theme-preview-light-lavender .swatch-primary { background-color: #8b5cf6; }
.theme-preview-light-lavender .swatch-bg { background-color: #f9f8ff; }

.theme-preview-custom .swatch-primary { background-color: var(--custom-primary, #4F46E5); }
.theme-preview-custom .swatch-bg { background-color: var(--custom-bg, #0f172a); }

/* ---------------------------------------------------
   LIVE SEARCH DROPDOWN STYLES
   --------------------------------------------------- */
.search-dropdown-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

body.theme-light .search-dropdown-container,
body.theme-light-lavender .search-dropdown-container,
body.theme-summer-dream .search-dropdown-container,
body.theme-light-mint .search-dropdown-container,
body.theme-light-peach .search-dropdown-container,
body.theme-light-rose .search-dropdown-container,
body.theme-light-grey .search-dropdown-container {
    border-color: rgba(0,0,0,0.1);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.search-dropdown-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    text-decoration: none;
    color: var(--text-main);
    transition: background-color 0.2s ease;
}

body.theme-light .search-dropdown-item,
body.theme-light-lavender .search-dropdown-item,
body.theme-summer-dream .search-dropdown-item,
body.theme-light-mint .search-dropdown-item,
body.theme-light-peach .search-dropdown-item,
body.theme-light-rose .search-dropdown-item,
body.theme-light-grey .search-dropdown-item {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.search-dropdown-item:last-child {
    border-bottom: none;
}

.search-dropdown-item:hover {
    background: var(--bg-hover);
}

.search-dropdown-img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--text-muted);
}

body.theme-light .search-dropdown-img,
body.theme-light-lavender .search-dropdown-img,
body.theme-summer-dream .search-dropdown-img,
body.theme-light-mint .search-dropdown-img,
body.theme-light-peach .search-dropdown-img,
body.theme-light-rose .search-dropdown-img,
body.theme-light-grey .search-dropdown-img {
    background: rgba(0,0,0,0.05);
}

.search-dropdown-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.search-dropdown-title {
    font-weight: 500;
    font-size: 0.95rem;
}

.search-dropdown-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-dropdown-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}





/* Custom utility to disable hover effects on stat-cards */
.stat-card.no-hover:hover {
    transform: none !important;
    background: var(--bg-card) !important;
    box-shadow: var(--shadow-soft) !important;
    cursor: default;
}

/* Floating Notification System */
.notification-container { position: fixed; top: 2rem; right: 2rem; z-index: 1000; display: flex; flex-direction: column; gap: 0.75rem; pointer-events: none; }
.flash-message { padding: 1rem 1.5rem; border-radius: var(--radius-md); font-weight: 500; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4); min-width: 300px; max-width: 450px; pointer-events: auto; animation: toastIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards; border-left: 4px solid transparent; margin-bottom: 0 !important; }
.flash-message.success { background: #064e3b !important; border-left-color: var(--secondary) !important; color: #d1fae5 !important; }
.flash-message.error { background: #7f1d1d !important; border-left-color: var(--danger) !important; color: #fee2e2 !important; }
@keyframes toastIn { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }

/* UI Refactoring Utilities */
.mobile-only { display: none; }
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .mobile-only { display: block !important; }
}
.nav-account-section {
    margin-top: auto;
    background: rgba(0,0,0,0.1);
    border-radius: var(--radius-md);
    margin: 0.5rem;
}

/* Mobile List and Card Styles */
.mobile-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 0.5rem 0;
}

.mobile-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    border: 1px solid rgba(255,255,255,0.05);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-soft);
}

.mobile-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.1);
}

.mobile-card-img {
    width: 65px;
    height: 65px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: rgba(0,0,0,0.1);
}

.mobile-card-content {
    flex: 1;
    min-width: 0;
}

.mobile-card-title {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-main);
    display: block;
    margin-bottom: 0.2rem;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-card-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}
