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

:root {
    /* Light Theme */
    --bg-body: #f1f5f9;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --sidebar-text: #334155;
    --border-color: #e2e8f0;
    --primary: #22c55e; /* Vibrant Green */
    --primary-hover: #16a34a;
    --accent: #3b82f6; /* Blue for active tabs */
    --calendar-today: #eff6ff;
    --calendar-text-dim: #cbd5e1;
    --sidebar-width: 280px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-body: #020617;
    --bg-sidebar: #0f172a;
    --bg-card: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --sidebar-text: #cbd5e1;
    --border-color: #1e293b;
    --calendar-today: #1e293b;
    --calendar-text-dim: #334155;
}

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

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    transition: var(--transition);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: fixed;
    height: 100vh;
    transition: var(--transition);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background-color: var(--text-main);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg-sidebar);
}

.btn-new-booking {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    padding: 0.875rem;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.4);
}

.btn-new-booking:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    cursor: pointer;
}

.filter-item input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
}

.content-container {
    background-color: var(--bg-card);
    border-radius: 24px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    min-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

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

.nav-controls {
    display: flex;
    align-items: center;
    background-color: var(--bg-body);
    padding: 4px;
    border-radius: 12px;
    gap: 4px;
}

.btn-icon, .btn-today {
    background-color: transparent;
    border: none;
    padding: 0.5rem 0.875rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-main);
    transition: var(--transition);
}

.btn-icon:hover, .btn-today:hover {
    background-color: var(--bg-card);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.current-month {
    font-size: clamp(1.1rem, 4vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.view-tabs {
    display: flex;
    background-color: var(--bg-body);
    padding: 4px;
    border-radius: 12px;
}

.tab {
    padding: 0.5rem 1.25rem;
    border-radius: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    transition: var(--transition);
}

.tab.active {
    background-color: var(--accent);
    color: white;
}

/* Settings Toggle */
.toggle-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.625rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    transition: var(--transition);
}

.toggle-btn:hover {
    background-color: var(--bg-body);
    border-color: var(--accent);
    color: var(--accent);
}

/* Premium Icon Styles */
.lucide {
    stroke-width: 1.5px;
    transition: transform 0.2s ease, stroke 0.2s ease;
}

.btn-new-booking:hover .lucide,
.toggle-btn:hover .lucide {
    transform: scale(1.1);
}

.logo-icon {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15), inset 0 1px 1px rgba(255,255,255,0.1);
}

[data-theme="dark"] .logo-icon {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
}

/* Grid Views Base */
.calendar-grid.view-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: max-content minmax(300px, 1fr);
}

.calendar-grid.view-day {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: max-content minmax(300px, 1fr);
}

/* Booking Interactions */
.booking-item {
    cursor: pointer;
    transition: var(--transition);
}

.booking-item:hover {
    filter: brightness(0.9);
    transform: translateY(-1px);
}

/* Detail Modal Specifics */
.detail-content {
    max-width: 500px;
}

.detail-body {
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 600;
    color: var(--text-muted);
}

.detail-value {
    font-weight: 500;
    color: var(--text-main);
}

.detail-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-status.approved {
    background-color: #dcfce7;
    color: #166534;
}

.detail-status.pending {
    background-color: #fef3c7;
    color: #92400e;
}

/* Sidebar Active Filter */
.filter-item input:checked + span {
    color: var(--accent);
    font-weight: 700;
}

.filter-item:hover {
    background-color: var(--bg-body);
    border-radius: 8px;
}

/* Base Grid Styles Wrapper Update */
.calendar-grid {
    display: flex;
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    background-color: var(--bg-card);
}

.calendar-grid.view-month {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    grid-template-rows: max-content repeat(6, minmax(120px, 1fr));
}



.grid-header {
    background-color: var(--bg-body);
    padding: 1rem;
    text-align: center;
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 40;
}

.grid-cell {
    border: 0.5px solid var(--border-color);
    padding: 1rem;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: var(--transition);
    position: relative;
    overflow-y: visible;
}

.grid-cell.today {
    background-color: var(--calendar-today);
}

.grid-cell.other-month {
    color: var(--calendar-text-dim);
}

.cell-number {
    font-weight: 600;
    font-size: 1rem;
}

.grid-cell.today .cell-number {
    color: var(--accent);
}

/* Booking Items */
.booking-item {
    background-color: var(--accent);
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

/* Status colors removed to allow room-specific colors from JS */
.booking-item.pending, .booking-item.approved, .booking-item.confirmed { background-color: transparent; }


/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background-color: var(--bg-card);
    padding: 2.5rem;
    border-radius: 24px;
    width: 90%;
    max-width: 550px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.3);
    position: relative;
    border: 1px solid var(--border-color);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
}

.close-btn {
    background: var(--bg-body);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.close-btn:hover {
    background-color: #fee2e2; /* Light red/pink tint */
    color: #ef4444; /* Red */
    transform: rotate(90deg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: inherit;
}

.btn-submit {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: var(--transition);
}

.btn-submit:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.3);
}

/* Form Helper Classes */
.form-row {
    display: flex;
    gap: 1rem;
}

.form-row > .form-group {
    flex: 1;
}

.equipment-box {
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 0.5rem;
    display: none;
}

.equipment-box h4 {
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.equipment-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    list-style: none;
    font-size: 0.85rem;
    color: var(--text-main);
}

.equipment-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.equipment-list li::before {
    content: "✓";
    color: var(--primary);
    font-weight: bold;
}

@media (max-width: 480px) {
    .equipment-list {
        grid-template-columns: 1fr;
    }
}


/* Dot Indicators for Mobile Month View (hidden on desktop) */
.dot-container {
    display: none;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: 4px;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}


/* Mobile Header & Hamburger */
.mobile-header {
    display: none;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
    display: none;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.5);
    z-index: 900;
    display: none;
    backdrop-filter: blur(2px);
}

/* Media Queries for Responsiveness */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 240px;
    }
}

@media (max-width: 768px) {
    :root {
        --sidebar-width: 280px;
    }

    body {
        padding: 0;
    }

    .sidebar {
        left: -100%;
        z-index: 1000;
        box-shadow: 20px 0 50px rgba(0,0,0,0.1);
        width: min(85vw, 320px);
    }

    .sidebar.active {
        left: 0;
    }

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

    .main-content {
        margin-left: 0;
        padding: 0.75rem;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .content-container {
        padding: 0.75rem;
        border-radius: 16px;
        min-height: calc(100vh - 1.5rem);
        width: 100%;
    }

    .mobile-header {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
    }

    .menu-toggle {
        display: block;
    }

    .logo-text-mobile {
        font-weight: 800;
        font-size: 1.5rem;
        letter-spacing: -0.04em;
    }

    /* Adjust Navigation Header */
    .calendar-header {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
        text-align: center;
        margin-bottom: 1.5rem;
    }

    .nav-controls {
        width: 100%;
        justify-content: center;
        order: 2;
    }

    .current-month {
        order: 1;
        width: 100%;
    }

    .view-tabs {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        order: 3;
    }

    .tab {
        text-align: center;
        padding: 0.625rem;
        font-size: 0.875rem;
    }

    /* Mobile Adjustments: Always allow users to see chips even if small, or show dots. The user requested to see ALL bookings on a day if tapped. */
    .calendar-grid.view-month .grid-cell,
    .calendar-grid.view-week .grid-cell {
        min-height: 70px;
        padding: 0.4rem;
        align-items: stretch;
        justify-content: flex-start;
    }

    .grid-header {
        font-size: 0.65rem;
        padding: 0.25rem 0.1rem;
        word-break: break-word;
    }

    .cell-number {
        font-size: 0.75rem;
    }

    /* Remove the 'display: none' for booking items in mobile so they can see all bookings if they want */
    .calendar-grid.view-month .booking-item,
    .calendar-grid.view-week .booking-item {
        font-size: 0.65rem;
        padding: 2px 4px;
        margin-bottom: 2px;
    }

    .calendar-grid.view-month .dot-container,
    .calendar-grid.view-week .dot-container {
        display: none; /* Hide dots and just rely on the real list! */
    }
    
    /* Day View Mobile: Show full items since there's plenty of space */
    .calendar-grid.view-day .booking-item {
        display: flex;
    }
    .calendar-grid.view-day .dot-container {
        display: none;
    }

    /* Modal -> Bottom Sheet */
    .modal-overlay {
        align-items: flex-end;
    }

    .modal-content {
        width: 100%;
        max-width: none;
        margin: 0;
        border-radius: 28px 28px 0 0;
        padding: 2rem 1.5rem;
        transform: translateY(100%);
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-overlay[style*="flex"] .modal-content {
        transform: translateY(0);
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* Very Small Screens */
@media (max-width: 480px) {
    .calendar-header .nav-controls {
        width: 100%;
        display: flex;
    }

    .btn-today {
        flex: 1;
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background-color: var(--bg-card);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 450px;
    pointer-events: auto;
    animation: toast-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    transition: var(--transition);
}

.toast.hiding {
    animation: toast-out 0.3s ease forwards;
}

@keyframes toast-in {
    from { transform: translateX(100%) scale(0.9); opacity: 0; }
    to { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateX(0) scale(1); opacity: 1; }
    to { transform: translateX(100%) scale(0.9); opacity: 0; }
}

.toast-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.toast.success { border-left: 4px solid #22c55e; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.info { border-left: 4px solid #3b82f6; }

.toast-message {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
}

