@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

/* ===== CSS Variables / Design Tokens ===== */
:root {
    --font-primary: 'Outfit', sans-serif;
    --transition-speed: 0.3s;

    /* Premium Indigo-Violet Light Theme Palette */
    --bg-primary: #f8fafc;
    --bg-secondary: rgba(255, 255, 255, 0.9);
    --bg-element: #ffffff;
    --border-color: rgba(226, 232, 240, 0.8);
    --border-color-light: rgba(226, 232, 240, 0.5);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --accent-indigo: #6366f1; /* Primary */
    --accent-violet: #8b5cf6; /* Secondary */
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;
    --accent-blue: #3b82f6;
    
    /* Glows and Shadows */
    --glow-primary: rgba(99, 102, 241, 0.2);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --card-shadow: 0 8px 30px rgba(0,0,0,0.04);
    --card-shadow-hover: 0 15px 35px rgba(99, 102, 241, 0.15);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--accent-indigo) 0%, var(--accent-violet) 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-sidebar: linear-gradient(180deg, #1e1b4b 0%, #0f172a 100%); /* Always dark sidebar */
}

/* Comprehensive Dark Mode Overrides */
[data-theme="dark"] {
    --bg-primary: #020617; /* Slate 950 */
    --bg-secondary: rgba(15, 23, 42, 0.8); /* Slate 900 */
    --bg-element: #0f172a;
    --border-color: rgba(51, 65, 85, 0.8); /* Slate 700 */
    --border-color-light: rgba(51, 65, 85, 0.5);
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --accent-indigo: #818cf8;
    --accent-violet: #a78bfa;
    --glow-primary: rgba(129, 140, 248, 0.25);
    --card-shadow: 0 8px 30px rgba(0,0,0,0.5);
    --card-shadow-hover: 0 15px 35px rgba(129, 140, 248, 0.2);
}

/* Default Bootstrap Overrides for Dark Mode */
[data-theme="dark"] body,
[data-theme="dark"] .bg-white,
[data-theme="dark"] .card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .list-group-item {
    background-color: var(--bg-element) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color);
}

[data-theme="dark"] .text-dark { color: var(--text-primary) !important; }
[data-theme="dark"] .text-muted { color: var(--text-muted) !important; }
[data-theme="dark"] .border { border-color: var(--border-color) !important; }
[data-theme="dark"] .border-bottom { border-color: var(--border-color) !important; }
[data-theme="dark"] .border-top { border-color: var(--border-color) !important; }

/* ===== Keyframe Animations ===== */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInLeft { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-15px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes shimmer { 0% { background-position: -200% center; } 100% { background-position: 200% center; } }
@keyframes ripple { 0% { transform: scale(0); opacity: 0.6; } 100% { transform: scale(4); opacity: 0; } }

/* ===== Base Styles ===== */
body {
    font-family: var(--font-primary);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
    overflow-x: hidden;
}

/* Background gradient blur */
body::before {
    content: '';
    position: fixed;
    top: -150px;
    right: -150px;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--glow-primary) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}

/* ===== Glassmorphism & Cards ===== */
.glass-panel {
    background: var(--bg-secondary);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.5s ease-out both;
}

.glass-panel-hover:hover {
    transform: translateY(-6px);
    box-shadow: var(--card-shadow-hover);
    border-color: rgba(99, 102, 241, 0.3);
}

/* Staggered load */
.glass-panel:nth-child(1) { animation-delay: 0.05s; }
.glass-panel:nth-child(2) { animation-delay: 0.10s; }
.glass-panel:nth-child(3) { animation-delay: 0.15s; }
.glass-panel:nth-child(4) { animation-delay: 0.20s; }
.glass-panel:nth-child(5) { animation-delay: 0.25s; }

/* ===== Sidebar (Premium Dark Always) ===== */
.sidebar {
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    background: var(--gradient-sidebar);
    color: #f8fafc; /* Always white text in sidebar */
    border-right: 1px solid rgba(255,255,255,0.05);
    z-index: 1000;
    padding: 24px;
    transition: all var(--transition-speed) ease;
    animation: fadeInLeft 0.5s ease-out both;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
}

.sidebar .text-muted { color: #94a3b8 !important; }
.sidebar .border-color { border-color: rgba(255,255,255,0.1) !important; }

.main-content {
    margin-left: 280px;
    padding: 32px;
    min-height: 100vh;
    transition: all var(--transition-speed) ease;
    animation: fadeIn 0.4s ease-out both;
}

/* ===== Navigation Links ===== */
.nav-link-custom {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 6px;
    border-radius: 12px;
    color: #cbd5e1; /* Light slate */
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-link-custom::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 0;
    background: var(--gradient-primary);
    border-radius: 0 4px 4px 0;
    transition: height 0.3s ease;
}

.nav-link-custom:hover::before,
.nav-link-custom.active::before {
    height: 60%;
}

.nav-link-custom:hover, .nav-link-custom.active {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    transform: translateX(4px);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

.nav-link-custom i {
    margin-right: 14px;
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    transition: all 0.3s ease;
    color: #94a3b8;
}

.nav-link-custom:hover i, .nav-link-custom.active i {
    color: var(--accent-indigo);
    transform: scale(1.1) rotate(-5deg);
    filter: drop-shadow(0 0 8px rgba(99,102,241,0.5));
}

/* ===== Form Styling ===== */
.form-control, .form-select {
    border-radius: 10px;
    border: 1.5px solid var(--border-color);
    background-color: var(--bg-element);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-indigo);
    box-shadow: 0 0 0 4px var(--glow-primary);
    outline: none;
}

[data-theme="dark"] .form-control::placeholder { color: var(--text-muted); }

/* ===== Buttons ===== */
.btn {
    border-radius: 10px;
    padding: 0.5rem 1.25rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--gradient-primary);
    border: none;
    color: white;
}

.btn-primary:hover {
    background: var(--gradient-primary);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
    color: white;
}

.btn-outline-primary {
    color: var(--accent-indigo);
    border-color: var(--accent-indigo);
}

.btn-outline-primary:hover {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.3);
}

/* ===== Badges ===== */
.badge-custom {
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: var(--shadow-sm);
}

.badge-available { background: rgba(16, 185, 129, 0.1); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-reserved { background: rgba(245, 158, 11, 0.1); color: var(--accent-amber); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-sold { background: rgba(244, 63, 94, 0.1); color: var(--accent-rose); border: 1px solid rgba(244, 63, 94, 0.2); }
.badge-pending { background: rgba(59, 130, 246, 0.1); color: var(--accent-blue); border: 1px solid rgba(59, 130, 246, 0.2); }

/* ===== Dashboard Cards ===== */
.dashboard-card {
    padding: 24px;
    position: relative;
    overflow: hidden;
    animation: scaleIn 0.5s ease-out both;
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, var(--accent-indigo) 0%, transparent 70%);
    opacity: 0.1;
    z-index: 0;
    border-radius: 50%;
    transition: all 0.5s ease;
}

.dashboard-card:hover::before {
    opacity: 0.2;
    transform: scale(1.5);
}

.dashboard-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease;
}

.dashboard-card:hover .dashboard-icon {
    transform: scale(1.1) rotate(-5deg);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    position: relative;
    z-index: 1;
}

/* ===== Tables ===== */
.table {
    color: var(--text-primary);
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 12px 16px;
    background-color: transparent !important;
}

.table tbody td {
    padding: 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
    background-color: transparent !important;
}

.table tbody tr {
    transition: all 0.2s ease;
    position: relative;
}

.table tbody tr:hover {
    background: var(--glow-primary) !important;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .table { color: var(--text-primary); }
[data-theme="dark"] .table-hover > tbody > tr:hover > * { color: var(--text-primary); }

/* ===== Avatar & Dropdown ===== */
.avatar {
    box-shadow: var(--shadow-md);
    border: 2px solid rgba(255,255,255,0.2);
}

.dropdown-menu {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 8px;
    animation: scaleIn 0.2s ease-out;
    transform-origin: top right;
}

.dropdown-item {
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s;
}

.dropdown-item:hover {
    background-color: var(--glow-primary);
    color: var(--accent-indigo);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--accent-indigo);
}

/* ===== Theme Toggle ===== */
.theme-toggle-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-element);
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.theme-toggle-btn:hover {
    color: var(--accent-indigo);
    border-color: var(--accent-indigo);
    transform: rotate(15deg);
    box-shadow: var(--shadow-md);
}

/* ===== Settings Toggle ===== */
.settings-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-element);
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}
.settings-btn:hover {
    color: var(--accent-indigo);
    border-color: var(--accent-indigo);
    transform: rotate(45deg);
    box-shadow: var(--shadow-md);
}

/* Typography Utility */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== Responsive ===== */
@media (max-width: 992px) {
    .sidebar { width: 80px; padding: 24px 12px; }
    .sidebar .fs-4, .sidebar .text-muted, .sidebar .text-truncate, .sidebar .btn { display: none; }
    .nav-link-custom i { margin-right: 0; font-size: 1.3rem; }
    .nav-link-custom { justify-content: center; }
    .main-content { margin-left: 80px; }
}

@media (max-width: 768px) {
    .sidebar { width: 100%; height: auto; position: relative; padding: 16px; flex-direction: row; align-items: center; justify-content: space-between; }
    .sidebar .mb-4 { margin-bottom: 0 !important; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: 8px; }
    .nav-link-custom { margin-bottom: 0; }
    .main-content { margin-left: 0; padding: 16px; }
}