/* =================================== */
/* 1. Page Layout Styles (UPDATED FOR VERTICAL LAYOUT) */
/* =================================== */

.calendar-section {
    padding: 40px 20px; /* Adjusted padding */
    background-color: #fff;
}

/* Admin-specific calendar row: centers the calendar card when it's rendered standalone */
.admin-calendar-row {
    display: flex;
    justify-content: center;
    padding: 20px 0 30px 0;
    width: 100%;
}

.calendar-wrapper {
    display: flex;
    flex-direction: column; /* STACK VERTICALLY: Title Top, Calendar Bottom */
    align-items: center;    /* Center everything horizontally */
    justify-content: center;
    gap: 40px;              /* Gap between text and calendar */
    width: 90%;
    max-width: 1400px;      /* Prevent it from getting too wide on huge screens */
    margin: 0 auto;         /* Centers the wrapper */
}

.calendar-data {
    width: 100%;
    max-width: 800px;       /* Limit text width for readability */
    text-align: center;     /* Center the text block */
}

.calendar-data h2 {
    font-size: 24px;        /* Increased size for a main section header */
    font-weight: bold;
    margin-bottom: 16px;
    font-family: 'Georgia', serif;
    color: #333;
    text-align: center;
}

.calendar-data h2 span{
    color: #F4B400;
}

.calendar-data span {
    font-size: 24px;        /* Increased size for a main section header */
    font-weight: bold;
    margin-bottom: 16px;
    font-family: 'Georgia', serif;
    color: #333;
    text-align: center;
}

.calendar-data p {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 20px;
    color: #444;
    text-align: center;     /* Changed from justify to center for this layout */
}

/* =================================== */
/* 2. Modern Calendar Styles (Your Theme) */
/* =================================== */

/* --- Main Calendar Container --- */
.calendar-table-data {
    width: 100%;            /* Take full width of the wrapper */
    max-width: 800px;      /* Allow it to be wider than the text */
    
    /* Modern card styles */
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 12px;    /* Softer corners */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); /* Subtle shadow */
    overflow: hidden;       /* To clip the header's corners */
    padding: 10px;          /* Add slight internal padding */
}

/* Apply a modern system font to the calendar */
.calendar-table-data #calendar {
    width: 100%;
    margin: 0 auto;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
}

/* --- Header Toolbar (Prev/Next, Title) --- */
.fc .fc-header-toolbar {
    background-color: #ffffff; /* Clean white header */
    color: #333;
    padding: 15px;
    border-bottom: 1px solid #eee; /* Light border */
    margin-bottom: 0 !important;
}

/* Style the calendar title (e.g., "July 2025") */
.fc .fc-toolbar-title {
    color: #333;
    font-size: 1.6rem;
    font-weight: 600; /* Bolder title */
}

/* --- Buttons (Prev/Next, Today, Views) --- */
.fc .fc-button {
    background-color: #f4f4f4; /* Light gray buttons */
    border: 1px solid #ddd;
    color: #555;
    text-transform: capitalize;
    box-shadow: none; /* Remove default shadow */
    transition: all 0.2s ease;
}

.fc .fc-button:hover {
    background-color: #e9e9e9;
    border-color: #ccc;
}

/* Style the "Today" button with your brand color */
.fc .fc-button-primary {
    background-color: #7A0000;
    border-color: #7A0000;
    color: white;
}

/* Style for the *active* view button */
.fc .fc-button-primary:not(:disabled):active,
.fc .fc-button-primary:not(:disabled).fc-button-active {
    background-color: #9a0000; /* Darker red */
    border-color: #9a0000;
}

.fc .fc-button-primary:hover {
    background-color: #9a0000; /* Darker red */
    border-color: #9a0000;
}

/* --- Day Headers (SUN, MON, TUE...) --- */
.fc .fc-daygrid-day-header {
    background-color: #ffffff;
    border-bottom: 1px solid #eee;
    padding: 10px 0;
    font-weight: 500;
    color: #888; /* Softer text color */
    font-size: 0.8rem;
    text-transform: uppercase; /* Common modern style */
    letter-spacing: 0.5px;
}

/* --- Day Cells --- */
.fc .fc-daygrid-day {
    border-color: #f0f0f0; /* Lighter grid lines */
}

/* Style the "today" cell */
.fc .fc-day-today {
    background-color: #fff8f8 !important; /* A very light, subtle red */
}

/* --- Events --- */
.fc .fc-event {
    background-color: #fdf2f2;
    border: 1px solid #fbe0e0;
    border-left: 3px solid #7A0000;
    color: #7A0000;
    font-size: 0.85rem;

    /* THE FIX: Changed padding from 4px to 2px */
    padding: 2px 6px;
    line-height: 1.4; /* Added for stability */

    border-radius: 4px;
    font-weight: 500;
}

.fc .fc-event-main {
    color: #7A0000;
}

.fc .fc-event-time {
    font-weight: 700;
}


/* =================================== */
/* 3. Responsive Adjustments (UPDATED) */
/* =================================== */

@media screen and (max-width: 768px) {
    
    .calendar-wrapper {
        width: 100%;
        padding: 0 10px;
    }

    /* 1. Main Toolbar Layout: Stack the 3 main sections (Nav / Title / Views) */
    .fc .fc-header-toolbar {
        display: flex;
        flex-direction: column; 
        gap: 15px; /* Spacing between the rows */
        align-items: center;
    }

    /* 2. THE FIX: Force the Button Containers (Chunks) to be horizontal rows */
    /* This stops "Today" from dropping below "Prev/Next" */
    .fc .fc-toolbar-chunk {
        display: flex !important;   
        flex-direction: row !important; 
        align-items: center;
        justify-content: center;
        width: 100%; /* Ensure it uses available width to center items */
        gap: 8px; /* Space between the button group and the Today button */
    }

    /* 3. Button Groups (The Prev/Next arrows) */
    .fc .fc-button-group {
        display: flex;
        margin: 0 !important; /* Remove default margins */
    }

    /* 4. Make buttons touch-friendly but compact */
    .fc .fc-button {
        font-size: 0.85rem; 
        padding: 8px 16px; /* Slightly wider for easier tapping */
    }

    /* 5. Title Styling */
    .fc .fc-toolbar-title {
        font-size: 1.4rem;
        margin: 0;
        text-align: center;
        order: -1; /* OPTIONAL: Moves title to the very top if you prefer */
    }
    
    /* 6. Mobile Calendar Height */
    .fc .fc-view-harness {
        min-height: 400px; 
    }
}

/* Very Small Screens (Mobile Portrait) */
@media screen and (max-width: 480px) {
    .calendar-data h2 {
        font-size: 20px;
    }
    
    /* Hide the "Today" button on very small screens to save space if needed */
    /* .fc .fc-today-button { display: none; } */
}

/* =================================== */
/* 4. DASHBOARD COMPACT LAYOUT         */
/* =================================== */

/* --- The "+2 more" Link --- */
/* --- The "+2 Bookings" Link --- */
.fc-daygrid-more-link {
    font-size: 0.7em !important; /* Slightly smaller font to fit the long text */
    font-weight: 700 !important;
    color: #fff !important;
    background-color: #f1a900;
    padding: 2px 6px; /* Adjust padding */
    border-radius: 4px; /* Less rounded to look more like a tag */
    text-decoration: none !important;
    display: block; /* Stack it nicely */
    margin-top: 2px;
    white-space: nowrap; /* Prevent text wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Add "..." if it's still too long */
}

/* Hover Effect */
.fc-daygrid-more-link:hover {
    background-color: #7A0000 !important;      /* Maroon Background */
    color: #ffffff !important;      /* White Text */
    cursor: pointer;
}

.dashboard-row-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 95%; 
    
    /* 1. CONTROL TOTAL WIDTH HERE */
    /* Reduced from 1600px to 1000px to make both cards narrower */
    max-width: 1000px; 
    
    margin: 20px auto; /* Centers the whole block */
    align-items: stretch; /* 2. FORCE EQUAL HEIGHT */
}

/* --- Left Side: Analytics (30%) --- */
.analytics-card {
    flex: 3; 
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
    min-width: 300px;
    
    /* Optional: Ensure analytics doesn't force the row too high */
    max-height: 450px; 
}

/* --- Right Side: Calendar (70%) --- */
.calendar-card {
    flex: 7; 
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 10px; /* Reduced padding from 15px */
    min-width: 250px;
    
    /* 1. FORCE MAX HEIGHT HERE */
    height: 450px; /* Fixed height for the card */
    max-height: 450px; 
    
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevents spillover */
}
/* --- Guest Calendar Card (centered, compact) --- */
.calendar-card-guest {
    margin: 0 auto; /* center on page */
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 10px;
    width: 100%;
    max-width: 800px; /* reduced ratio */
    height: auto;
    display: flex;
    flex-direction: column;
}

/* Force the calendar internal div to take up available height */
.calendar-mini-wrapper {
    flex-grow: 1;
    display: flex;
    align-items: flex-start; /* Changed from center to start */
    height: 100%;
    overflow: hidden;
}

.calendar-mini-wrapper #calendar {
    width: 100%;
    height: 100%; /* Make calendar fill the wrapper */
    font-size: 0.75rem; /* Slightly smaller font to fit better */
}

/* --- Compact Toolbar Styles --- */
.calendar-card .fc-header-toolbar {
    margin-bottom: 5px !important; /* Reduced margin */
    padding: 0 5px; /* Reduced padding */
}

.calendar-card .fc-toolbar-title {
    font-size: 0.95rem; /* Smaller Title */
}

.calendar-card .fc-button {
    padding: 2px 6px; /* Even Smaller Buttons */
    font-size: 0.65rem;
}

/* --- 2. FORCE INTERNAL CALENDAR HEIGHT --- */
/* This forces the grid area to respect the container height */
.calendar-card .fc-view-harness {
    height: 100% !important;
    min-height: unset !important; /* Override the default min-height */
}

/* Optional: Reduce the height of individual day cells */
.calendar-card .fc-daygrid-day-frame {
    min-height: 40px !important; /* Standard is often much taller */
}

/* =================================== */
/* 5. RESPONSIVE                       */
/* =================================== */

@media screen and (max-width: 900px) {
    .dashboard-row-layout {
        flex-direction: column;
        max-width: 100%; /* Go full width on mobile */
    }
}

.section-subtitle {
    margin-bottom: 20px;
}