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

:root {
    /* Color Palette - Light Mode (Default) */
    --primary: #4f46e5;
    --primary-soft: rgba(79, 70, 229, 0.1);
    --secondary: #0ea5e9;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #0ea5e9;

    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-surface: #f1f5f9;
    --bg-surface-soft: #f8fafc;

    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --border-main: #e2e8f0;
    --border-glass: rgba(255, 255, 255, 0.5);

    --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);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-body: #111111;
    --bg-card: #1a1a1a;
    --bg-sidebar: #1a1a1a;
    --bg-surface: #222222;
    --bg-surface-soft: #1a1a1a;

    --primary-soft: rgba(79, 70, 229, 0.25);

    --text-main: #ffffff;
    --text-muted: #a0a0a0;
    --text-light: #666666;

    --border-main: #2a2a2a;
    --border-glass: rgba(255, 255, 255, 0.05);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        /* Automatic theme detection if no manual toggle exists */
        --bg-body: #111111;
        --bg-card: #1a1a1a;
        --bg-sidebar: #1a1a1a;
        --bg-surface: #222222;
        --bg-surface-soft: #1a1a1a;
        --primary-soft: rgba(79, 70, 229, 0.25);
        --text-main: #ffffff;
        --text-muted: #a0a0a0;
        --text-light: #666666;
        --border-main: #2a2a2a;
    }
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
h4,
.brand-font {
    font-family: 'Outfit', sans-serif;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Typography Enhancements */
.brand-lite {
    font-weight: 800;
    letter-spacing: -0.025em;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    overflow: hidden;
    /* Prevent child overflow */
}

.glass-card:hover {
    box-shadow: var(--shadow-md);
}

/* Base Wrapper for Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

/* Grid System - Mobile First */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-cols-1,
.grid-cols-2,
.grid-cols-3,
.grid-cols-4 {
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
    .grid {
        gap: 1.5rem;
    }

    .grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .md\:col-span-2 {
        grid-column: span 2 / span 2;
    }

    .md\:col-span-3 {
        grid-column: span 3 / span 3;
    }

    /* md:grid-cols matching dashboard usage */
    .md\:grid-cols-1 {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

    .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .md\:grid-cols-3 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .md\:grid-cols-4 {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .grid-sidebar {
        grid-template-columns: 2fr 1fr;
    }
}

/* Responsive Header Layout */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    /* Fix for mobile */
}

.admin-header>div:first-child {
    flex: 1;
    min-width: 280px;
}

.admin-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Responsive Search Bar */
.search-bar {
    display: flex;
    gap: 1rem;
    background: var(--bg-surface);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-main);
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.search-bar .form-group-search {
    flex: 1;
    min-width: 250px;
    position: relative;
}

@media (max-width: 640px) {

    .admin-actions,
    .search-bar button {
        width: 100%;
    }

    .admin-actions .btn,
    .search-bar button {
        flex: 1;
        width: 100%;
        justify-content: center;
    }
}

/* Custom Grid Utility for Sidebar Layouts (Responsive) */
.grid-sidebar {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
    /* Stacked by default */
}

/* Forms & UI */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

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

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Booking Bar Form Responsiveness */
.booking-bar-form {
    gap: 1rem;
    align-items: stretch;
}

@media (min-width: 768px) {
    .booking-bar-form {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1.5rem;
        align-items: end;
    }
}

/* Tables */
.premium-table {
    width: 100%;
    border-collapse: collapse;
}

.premium-table th {
    text-align: left;
    padding: 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    border-bottom: 2px solid var(--border-main);
}

.premium-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-main);
    font-size: 0.9375rem;
}

/* Badges */
.badge {
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-confirmed {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-cancelled {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Admin Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-main);
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
}

.main-content {
    flex: 1;
    padding: 2rem;
    background-color: var(--bg-body);
    min-width: 0;
    overflow-x: hidden;
}

.sidebar-brand {
    padding: 0 1rem;
    margin-bottom: 2.5rem;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.nav-link .lucide {
    width: 1.25rem;
    height: 1.25rem;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary-soft);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary);
    color: white !important;
}

.nav-link.active i,
.nav-link.active span {
    color: white !important;
}

.nav-link-highlight:not(.active) {
    color: var(--primary) !important;
    font-weight: 700;
}

.nav-link-highlight:not(.active) i {
    color: var(--primary) !important;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: 1px solid var(--border-main);
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mobile-First Navigation (Premium) */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: rgba(var(--bg-card-rgb, 255, 255, 255), 0.85);
    /* Requires RGB variables or solid fallback */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-main);
    z-index: 1000;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
}

[data-theme="dark"] .mobile-header,
[data-theme="dark"] .mobile-bottom-nav {
    background: rgba(26, 26, 26, 0.85);
}

.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-main);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-list {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 600;
    gap: 4px;
    transition: var(--transition);
}

.mobile-nav-item .lucide {
    width: 1.5rem;
    height: 1.5rem;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.mobile-nav-item.active .lucide {
    stroke-width: 2.5;
    transform: scale(1.1);
}

@media (max-width: 1024px) {
    .admin-layout {
        flex-direction: column;
    }

    .sidebar {
        display: none;
        /* Hide sidebar entirely on mobile */
    }

    .mobile-header {
        display: flex;
    }

    .mobile-bottom-nav {
        display: block;
    }

    .main-content {
        padding: 80px 1rem 85px 1rem;
        /* Top padding for header, bottom padding for dock */
    }
}

/* Dashboard Stat Cards */
.stat-card {
    padding: 1.5rem;
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* Lucide Icons Visibility Fix */
svg.lucide,
.lucide {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px;
    min-height: 20px;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    display: inline-block;
    vertical-align: middle;
}

/* Ensure all SVG paths inherit the stroke color */
svg.lucide path,
svg.lucide circle,
svg.lucide line,
svg.lucide polyline,
svg.lucide polygon,
svg.lucide rect {
    stroke: currentColor;
}