/* Global Reset & Typography */
:root {
    --primary-color: #2F4F4F;
    /* Dark Slate Gray (Deep Forest) */
    --accent-color: #D2691E;
    /* Chocolate (Earthy Tone) */
    --bg-color: #F5F5F3;
    /* Warm White/Beige */
    --card-bg: #FFFFFF;
    --text-main: #333333;
    --text-muted: #666666;
    --success-color: #4CAF50;
    --error-color: #E53935;
    --waitlist-color: #FFB300;

    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);

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

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    margin: 0;
    color: var(--primary-color);
    font-weight: 600;
}

button {
    font-family: var(--font-body);
    cursor: pointer;
}

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
    width: 100%;
    box-sizing: border-box;
}

/* Navigation / Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 40px;
}

.brand-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: -0.02em;
}

.admin-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.admin-link:hover {
    color: var(--primary-color);
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 60px;
    padding: 60px 20px;
    background: linear-gradient(135deg, rgba(47, 79, 79, 0.05) 0%, rgba(210, 105, 30, 0.05) 100%);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 16px;
    background: linear-gradient(45deg, var(--primary-color), #4a7070);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Notices */
.notice-section {
    background: #fff;
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 40px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--accent-color);
}

.notice-title {
    font-size: 1.2rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notice-list {
    margin: 0;
    padding-left: 20px;
    color: var(--text-muted);
}

.notice-list li {
    margin-bottom: 8px;
}

/* Status Dashboard (Sticky) */
.status-dashboard {
    position: sticky;
    top: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    padding: 16px 24px;
    box-shadow: var(--shadow-md);
    z-index: 200;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.status-info {
    display: flex;
    gap: 24px;
}

.status-item {
    display: flex;
    flex-direction: column;
}

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

.status-value {
    font-weight: 600;
    color: var(--primary-color);
}

.reset-btn {
    background: none;
    border: 1px solid var(--text-muted);
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.reset-btn:hover {
    border-color: var(--error-color);
    color: var(--error-color);
}

/* Calendar Component */
.calendar-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
    margin-bottom: 40px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.month-nav-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--primary-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.month-nav-btn:hover {
    background: rgba(47, 79, 79, 0.1);
}

.current-month {
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* Calendar Wrapper */
/* .calendar-wrapper { width: 100%; overflow: visible; } - Removed */

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}



.weekday-header {
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 8px;
}

.day-cell {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    border: 1px solid #eee;
    padding: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s;
    cursor: pointer;
    position: relative;
    background: #fff;
    min-height: 80px;
}

.day-cell:hover:not(.empty) {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.day-cell.empty {
    border: none;
    background: transparent;
    cursor: default;
}

.day-number {
    position: absolute;
    top: 4px;
    right: 4px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
    z-index: 10;
}

.day-indicators {
    /* Container for tiny dots or bars */
    display: flex;
    gap: 2px;
    margin-top: auto;
    flex-wrap: wrap;
}

/* Booking Labels Overlay */
.booking-labels {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    overflow: hidden;
    /* Keep labels inside cell */
}

.slot-label {
    position: absolute;
    font-size: 0.6rem;
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.9);
    padding: 1px 4px;
    /* Tighter padding */
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    max-width: 85px;
    /* Hard limit for cell width ~100px-ish */
    transform: translate(-50%, -50%);
    z-index: 5;
    pointer-events: auto;
    /* Allow hover for tooltip */
}

.day-cell.selected {
    border: 2px solid var(--accent-color) !important;
    box-shadow: 0 0 0 2px rgba(210, 105, 30, 0.1);
    position: relative;
    /* Context for pseudo-element */
}

.day-cell.selected::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(210, 105, 30, 0.3);
    /* Light accent wash */
    z-index: 1;
    pointer-events: none;
    border-radius: var(--radius-sm);
}

.day-cell.selected .day-number {
    color: var(--accent-color);
    font-weight: 800;
}

.day-cell.in-range {
    /* Background is handled by ::before to overlay on top of gradients if needed, or blend */
    border: 2px dashed rgba(210, 105, 30, 0.5);
    position: relative;
    /* Ensure it is a positioning context */
}

.day-cell.in-range::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(210, 105, 30, 0.1);
    z-index: 1;
    /* Sit above the background */
    pointer-events: none;
    /* Allow clicks to pass through */
    border-radius: var(--radius-sm);
}

.day-cell.past-date {
    cursor: default;
}

.day-cell.past-date::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.2);
    z-index: 100;
    /* Cover everything including labels */
    border-radius: var(--radius-sm);
    pointer-events: none;
}

/* Time Slots */
.slots-section {
    display: none;
    /* Hidden initially */
    margin-top: 40px;
    animation: slideUp 0.4s ease-out;
}

.slots-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.time-slot {
    background: #fff;
    border: 2px solid #eee;
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

.time-slot:hover {
    border-color: var(--primary-color);
}



.time-slot.unavailable {
    background: var(--bg-color);
    border-color: transparent;
    color: #ccc;
    cursor: not-allowed;
}

.time-slot.waitlist {
    background: #fff8e1;
    border-color: var(--waitlist-color);
    color: #b7791f;
}

.time-slot.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Booking Form */
.booking-form-card {
    display: none;
    /* Hidden initially */
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    max-width: 600px;
    margin: 40px auto 0;
    animation: scaleIn 0.3s ease-out;
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-main);
}

.form-input {
    width: 100%;
    padding: 14px;
    border: 2px solid #eee;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: var(--font-body);
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.submit-btn {
    width: 100%;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 16px;
    box-shadow: 0 4px 12px rgba(210, 105, 30, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(210, 105, 30, 0.4);
}

/* Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        padding: 0 10px 20px;
    }

    .calendar-card {
        padding: 16px;
    }

    .calendar-grid {
        gap: 1px;
        /* Tighter gap */
        min-width: auto;
        /* Allow shrink */
    }

    /* Remove scroll wrapper effects if inline styles persist or if using wrapper div in HTML (which we will remove/negate) */
    .calendar-wrapper {
        width: 100%;
        overflow: visible;
    }

    /* Force hide labels even more aggressively/ensure no overflow */
    .slot-label {
        display: none !important;
    }

    .booking-labels {
        display: none;
        /* Hide container entirely on mobile to prevent layout shift/overflow */
    }

    .slot-label {
        display: none;
        /* Hide text labels on small screens to prevent overflow */
    }

    /* Optional: Show simple dots instead of labels on mobile if needed */
    .day-cell.has-bookings::after {
        content: '';
        display: block;
        width: 6px;
        height: 6px;
        background-color: var(--primary-color);
        border-radius: 50%;
        position: absolute;
        bottom: 4px;
        left: 50%;
        transform: translateX(-50%);
    }

    .day-cell {
        min-height: 40px;
        /* Reduced further */
        padding: 2px;
        /* Critical: overflow hidden on the cell to stop content expansion */
        overflow: hidden;
        min-width: 0;
        /* Allow Grid items to shrink past min-content size */
    }

    .day-number {
        font-size: 0.8rem;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .status-dashboard {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .status-info {
        justify-content: space-between;
    }
}

/* ADMIN STYLES (Restored) */
.admin-login-card {
    max-width: 400px;
    margin: 80px auto;
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.admin-nav {
    background: #2c3e50;
    padding: 1rem 0;
}

.admin-nav .nav-link {
    color: rgba(255, 255, 255, 0.8);
}

.admin-nav .nav-link:hover,
.admin-nav .nav-link.active {
    color: white;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.data-table th,
.data-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--text-muted);
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-pending {
    background: #FFF3CD;
    color: #856404;
}

.badge-approved,
.badge-confirmed,
.badge-booked {
    background: #D4EDDA;
    color: #155724;
}

.badge-cancelled,
.badge-rejected {
    background: #F8D7DA;
    color: #721C24;
}

/* Booking Modal (Admin) */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 0;
    border: none;
    width: 500px;
    max-width: 90%;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.close-modal {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: #333;
}

.modal-body {
    padding: 24px;
}

/* Modal Inputs */
.detail-row {
    margin-bottom: 16px;
}

.detail-label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 6px;
}

.detail-value {
    font-size: 1rem;
    color: #333;
    font-weight: 500;
}

.detail-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
}

.detail-input:focus {
    border-color: #2F4F4F;
    outline: none;
    box-shadow: 0 0 0 3px rgba(47, 79, 79, 0.1);
}

.modal-actions {
    padding: 20px 24px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: #fafafa;
    border-radius: 0 0 12px 12px;
}

.btn-approve,
.btn-save {
    background: #2F4F4F;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.btn-reject,
.btn-delete {
    background: white;
    color: #dc3545;
    border: 1px solid #dc3545;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}


/* ========================================================================= */
/* CONTINUOUS BAR CALENDAR STYLES (Admin & Public) - APPENDED FOR NEW LAYOUT */
/* ========================================================================= */

.calendar-week-row {
    display: flex;
    position: relative;
    border-bottom: 1px solid #eee;
}

.week-events-layer {
    position: absolute;
    top: 32px;
    /* Below date numbers */
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: 24px;
    /* Booking height + gap */
    pointer-events: none;
    /* Let clicks pass to cells */
    z-index: 5;
}

/* Ensure flex layout for continuous bars overrides grid layout if present */
.calendar-container .calendar-week-row {
    display: flex;
}

.calendar-week-row .day-cell {
    /* Updated for week-row layout compatibility */
    aspect-ratio: auto;
    /* Override grid aspect ratio */
    flex: 1;
    min-height: 100px;
    /* Ensure enough height */
    border-right: 1px solid #eee;
    position: relative;
    background: #fff;
    /* Default */
    transition: background-color 0.2s;
}

.calendar-week-row .day-cell.empty {
    background: #fafafa;
}

.calendar-week-row .day-cell:last-child {
    border-right: none;
}

/* Background Priorities (Public) */
/* Past dates keep original light tint */
.day-cell.bg-booked {
    background-color: rgba(76, 175, 80, 0.1);
}

.day-cell.bg-pending {
    background-color: rgba(255, 193, 7, 0.1);
}

/* Future/Present dates get stronger tint (2x) */
.day-cell:not(.past-date).bg-booked {
    background-color: rgba(76, 175, 80, 0.25);
}

.day-cell:not(.past-date).bg-pending {
    background-color: rgba(255, 193, 7, 0.25);
}

/* Booking Bars (Shared) */
.booking-bar {
    background: #2F4F4F;
    /* Dark Slate Gray (Default) */
    color: white;
    font-size: 0.75rem;
    padding: 2px 4px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 1px 2px;
    pointer-events: auto;
    /* Enable hover/click if needed */
    z-index: 10;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.booking-bar.status-confirmed,
.booking-bar.status-approved {
    background-color: #007529;
}

.booking-bar.status-pending {
    background-color: #FFC107;
    color: #333;
}

.booking-bar.status-waitlist {
    background-color: #FF5722;
    color: white;
}

/* Overlap Highlighting (Admin) */
.booking-bar.overlapping {
    background-color: #dc3545 !important;
    /* RED */
    color: white !important;
    box-shadow: 0 0 5px rgba(220, 53, 69, 0.8);
    z-index: 20;
    position: relative;
    transition: all 0.2s ease;
}

.booking-bar.hovered {
    transform: scale(1.02);
    z-index: 30;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Mobile Adjustments for Week Row */
@media (max-width: 768px) {
    .calendar-week-row .day-cell {
        min-height: 60px;
    }

    /* Stack content vertically on mobile */
    .booking-bar {
        font-size: 0.65rem;
        padding: 2px 2px;
        line-height: 1.1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        white-space: normal;
        /* Allow wrapping */
        text-overflow: clip;
        /* Remove ellipsis if we want to show meaningful text, or keep it */
    }

    /* Increase row height on mobile to accommodate 2 lines */
    .week-events-layer {
        grid-auto-rows: 40px !important;
        /* Override inline style or default */
        gap: 2px 0;
    }
}