/* ==========================================================================
   1. MAIN LAYOUT & MONTHS (No max-width restriction)
   ========================================================================== */
.calendar-months-nav {
    display: grid;
    grid-template-columns: repeat(12, 1fr); /* Creates exactly 12 equal columns (1/12 each) */
    gap: 6px; /* Small gap between items to ensure they stay on one line */
    width: 100%; /* Spans 100% of the parent container width */
    margin-bottom: 25px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 12px;
}

.month-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 8px 4px; /* Reduced horizontal padding to fit perfectly */
    text-align: center;
    text-decoration: none;
    color: #BC392D;
    border-radius: 6px;
    background: #fdf8f7;
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-size: 0.78em; /* Slightly smaller font to prevent text wrapping on smaller desktops */
}

.month-item span, .month-item strong {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis; /* Protects UI if month names are extremely long */
    white-space: nowrap;
}

.month-item small {
    color: #888;
    font-size: 0.72em;
    margin-top: 2px;
}

.month-item:hover {
    background: #f7e6e4;
    color: #BC392D;
}

.month-item.active {
    background: #BC392D;
    color: #ffffff;
}
.month-item.active small {
    color: #ffcccc;
}

/* Responsive fallback: switches to smooth horizontal scroll when screens get tight */
@media (max-width: 991.98px) {
    .calendar-months-nav {
        display: flex; /* Switches from Grid to Flex */
        grid-template-columns: none;
        gap: 8px;
        overflow-x: auto;
        scrollbar-width: thin;
    }
    
    .calendar-months-nav::-webkit-scrollbar {
        height: 4px;
    }
    
    .calendar-months-nav::-webkit-scrollbar-thumb {
        background: #e0e0e0;
        border-radius: 10px;
    }

    .month-item {
        flex: 0 0 auto; /* Prevents shrinking, allows native mobile swipe */
        padding: 10px 18px;
        font-size: 0.85em;
    }
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 700;
    color: #666;
    margin-bottom: 12px;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   2. CALENDAR GRID
   ========================================================================== */
#calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    padding: 0;
    margin: 0;
    list-style: none;
}

#calendar li {
    min-height: 120px;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    position: relative; /* Required for absolute tooltip positioning */
}

#calendar li strong {
    font-size: 1.4em;
    font-weight: 300;
    color: #1a202c;
    display: block;
    margin-bottom: 4px;
}

#calendar .empty {
    background: #f7fafc;
    border: 1px dashed #e2e8f0;
}

#calendar .no-offers {
    color: #a0aec0;
}

#calendar .results {
    background: #F3F7C9;
    border-color: #dbe39f;
    cursor: pointer;
}

/* ==========================================================================
   3. INLINE OFFERS TEXT LIMITATION (3 lines max with ellipsis)
   ========================================================================== */
.offers-summary-list {
    font-size: 0.8em;
    line-height: 1.3;
    color: #BC392D;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4; /* Limit to 4 lines */
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.summary-item {
    display: block;
    line-height: 1.4;
    color: #BC392D;
    margin-right: 8px; /* Spacing between offers */
}

/* Injecting the Font Awesome 6 icon before each offer */
.summary-item::before {
    content: "\f3c5"; /* Font Awesome 6 Map Marker icon Unicode */
    font-family: "Font Awesome 6 Free";
    font-weight: 900; /* Required for solid icons */
    display: inline-block;
    margin-right: 4px;
    font-size: 0.9em;
    opacity: 0.8;
}

/* Style adjustments when the parent cell is hovered */
#calendar .results:hover .summary-item,
#calendar .results.touch-active .summary-item {
    color: #343A40;
}


/* ==========================================================================
   4. SLIDER TOOLTIP SYSTEM WITH NAVIGATION HINTS
   ========================================================================== */
.calendar-tooltip-dropdown {
    position: absolute;
    bottom: 102%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 280px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #e2e8f0;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    padding: 8px;
}

/* Tooltip arrow indicator */
.calendar-tooltip-dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
}

/* Show tooltip container on cell interaction */
#calendar .results:hover .calendar-tooltip-dropdown,
#calendar .results.touch-active .calendar-tooltip-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

/* Native slider mechanics using Scroll Snap */
.tooltip-slider {
    display: flex;
    overflow-x: auto;
    gap: 0; /* Changed to 0 for exact width matching per slide card */
    scroll-snap-type: x mandatory;
    scrollbar-width: none; /* Hide standard Firefox scrollbar */
}

.tooltip-slider::-webkit-scrollbar {
    display: none; /* Hide standard Chrome/Safari scrollbars */
}

/* Individual Slide Card setup */
.tooltip-slide-card {
    flex: 0 0 100%;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: #ffffff;
    box-sizing: border-box;
}

.slide-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 6px 6px 0 0;
}

.slide-body {
    padding: 10px 4px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.slide-title {
    font-size: 0.85em;
    font-weight: 600;
    color: #2d3748;
    margin: 0 0 8px 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.slide-btn {
    display: block;
    text-align: center;
    background: #BC392D;
    color: #ffffff;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
}

/* ==========================================================================
   SLIDER NAVIGATION OVERLAYS (Arrows & Dots)
   ========================================================================== */
.slider-nav-hints {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid #f0f0f0;
}

.nav-arrow {
    font-size: 0.8em;
    color: #a0aec0;
    cursor: pointer;
    padding: 2px 6px;
    transition: color 0.2s ease;
}

.nav-arrow:hover {
    color: #BC392D;
}

.nav-dots {
    display: flex;
    gap: 5px;
    justify-content: center;
    align-items: center;
}

.nav-dot {
    width: 6px;
    height: 6px;
    background-color: #cbd5e0;
    border-radius: 50%;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.nav-dot.active {
    background-color: #BC392D;
    transform: scale(1.2);
}    
    
    
/* ==========================================================================
   5. RESPONSIVE ADJUSTMENTS
   ========================================================================== */
@media (max-width: 767.98px) {
    .calendar-weekdays {
        display: none;
    }

    #calendar .empty {
        display: none;
    }

    #calendar {
        grid-template-columns: repeat(4, 1fr);
    }

    #calendar li {
        min-height: 85px;
    }
    
    /* Reposition tooltip to avoid overflow on mobile grids */
    .calendar-tooltip-dropdown {
        width: 240px;
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%) translateY(0);
        box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    }
    .calendar-tooltip-dropdown::after {
        display: none;
    }
    
    #calendar .results:hover .calendar-tooltip-dropdown,
    #calendar .results.touch-active .calendar-tooltip-dropdown {
        transform: translateX(-50%) translateY(0);
    }
}

/* ==========================================================================
   NEW MOBILE BEHAVIOR: Expandable Accordion (Not Tooltip)
   ========================================================================= */
@media (max-width: 480px) {
    #calendar {
        grid-template-columns: 1fr;
        gap: 0; /* Remove gap to make it look like a clean list */
    }

    #calendar li {
        min-height: auto;
        padding: 12px 40px 12px 12px; /* Extra right padding for chevron space */
        flex-direction: row; /* Force alignment on the same row */
        flex-wrap: wrap; /* Allows accordion panel to wrap neatly underneath */
        align-items: center; 
        gap: 12px;
        margin-bottom: 0;
        border-bottom: 1px solid #eee; /* Add standard list borders */
        border-radius: 0; /* Clear previous radius */
        transition: background-color 0.3s ease;
    }
    
    /* Specific styles for rows with active accordions */
    #calendar li.touch-active {
        background-color: #f7fafc;
        border-bottom-color: #e2e8f0;
    }

    #calendar li strong {
        font-size: 1.3em;
        margin-bottom: 0;
        display: inline-block;
        min-width: 25px; /* Ensures text titles align neatly vertically */
    }

    /* FIXED: Keep the summaries visible, inline, and scaling beside the date number */
    .offers-summary-list {
        display: inline-block; 
        flex: 1; /* Occupy remaining row space next to the day number */
        vertical-align: middle;
        -webkit-line-clamp: 2; /* Keep it compact to max 2 lines per row item */
        transition: opacity 0.2s ease;
    }

    /* Hide text summaries smoothly ONLY when the graphic accordion is actively open */
    #calendar li.touch-active .offers-summary-list {
        opacity: 0;
        height: 0;
        overflow: hidden;
        pointer-events: none;
    }

    /* Transition effect when opening/closing */
    #calendar .results::after {
        content: "\f078"; /* fa-chevron-down */
        font-family: "Font Awesome 6 Free";
        font-weight: 900;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        right: 15px;
        color: #BC392D;
        font-size: 0.9em;
        transition: transform 0.3s ease;
    }
    #calendar li.touch-active::after {
        transform: translateY(-50%) rotate(180deg); /* fa-chevron-up */
    }

    /* ==========================================================================
       CONVERTING ABSOLUTE TOOLTIP TO ACCORDION PANEL (480px)
       ========================================================================== */
    .calendar-tooltip-dropdown {
        display: block; /* Force block flow instead of flex/grid */
        position: relative; /* Break away from absolute positioning */
        bottom: 0;
        left: 0;
        transform: none !important; /* Ignore previous centering transforms */
        width: 100% !important; /* Take up entire width of list row */
        max-width: 320px; /* Limit width to keep cards looking like cards */
        margin: 0 auto; /* Center panel horizontally with auto margin */
        padding: 0;
        opacity: 0;
        pointer-events: none;
        background: none; /* Inherit parent background */
        border: none;
        box-shadow: none;
        z-index: 5;
        
        /* Accordion transition effect */
        max-height: 0; /* Completely hidden */
        overflow: hidden; /* Important for accordion collapse */
        transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    }

    /* Active Accordion Panel State */
    #calendar li.touch-active .calendar-tooltip-dropdown {
        opacity: 1;
        pointer-events: auto;
        transform: none !important;
        margin-top: 10px;
        
        /* Force explicit height for smooth opening (matches card size + padding) */
        max-height: 250px; 
        padding: 8px; /* Apply padding only when open */
    }

    /* Adjust cards slightly for mobile flow */
    .tooltip-slide-card {
        border: 1px solid #e2e8f0;
        background: #ffffff;
    }
    
    .slider-nav-hints {
        border-top: 1px solid #edf2f7;
    }

    /* Important: Dot indicators are absolutely positioned hints overlaying the card */
    .nav-dots {
        position: absolute;
        bottom: 60px; /* Standard card height fallback */
        left: 50%;
        transform: translateX(-50%);
        gap: 8px; /* Increase gap for easier touch */
        background: rgba(255, 255, 255, 0.7); /* Subtle backdrop */
        padding: 4px 8px;
        border-radius: 12px;
    }
    
    .nav-dot {
        width: 8px; /* Larger dots for touch targets */
        height: 8px;
        border: 1px solid #BC392D; /* Add border for visibility over white cards */
    }
}


.card-img-wrapper {
    position: relative;
    width: 100%;
    height: 130px;
    overflow: hidden;
}

.card-img-wrapper .slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px 6px 0 0;
}

.card-img-wrapper .status {
    position: absolute;
    top: 12px;
    left: 0;
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.5px;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.15);
    border-radius: 0 4px 4px 0;
    z-index: 2;
}


.price-row-inline {
    display: flex;
    align-items: baseline;
    flex-wrap: nowrap; 
    white-space: nowrap; 
    margin: 8px 0 0 0;
    padding: 0;
    font-size: 0.82em;
    color: #718096;
}

.price-row-inline .price-highlight {
    font-size: 1.35em;
    font-weight: 800;
    margin: 0 5px;
    display: inline-block;
}


.price-row-inline .orange {
  color: #da7e00 !important
}

.price-row-inline .green {
  color: #919000 !important
}

.price-row-inline .blue {
  color: #62badc !important
}
.price-row-inline .yellow {
  color: #cedb00 !important
}
.price-row-inline .purple {
  color: #9f26b4 !important
}

.price-row-inline .red {
  color: #f42434 !important
}

.price-row-inline .pink {
  color: #ff00a6 !important
}


@media (max-width: 480px) {
    #calendar li.touch-active .calendar-tooltip-dropdown {
        max-height: 240px; 
    }
}
