/* ==========================================
   VILLA.PHP - CALENDRIER MOBILE
   Version 2.0 - Fichier unique optimisé
   ========================================== */

@media (max-width: 767px) {

    /* ===== CALENDRIER POPOVER MOBILE ===== */

    .calendar-popover {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: calc(100vw - 32px);
        max-width: 340px;
        max-height: 420px;
        background: var(--color-white);
        border-radius: 16px;
        box-shadow: 0 10px 50px rgba(0,0,0,0.25);
        z-index: 9999;
        overflow: hidden;
        display: none;
        flex-direction: column;
    }

    .calendar-popover.open {
        display: flex;
    }

    /* Overlay background */
    .calendar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 9998;
    }

    /* Close button */
    .cal-close-btn {
        position: absolute;
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
        background: var(--color-cream);
        border: none;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 10;
    }

    .cal-close-btn svg {
        width: 16px;
        height: 16px;
        stroke: var(--color-primary);
    }

    /* Header navigation */
    .calendar-popover-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 20px 12px;
        background: var(--color-cream);
    }

    .cal-nav-btn {
        width: 36px;
        height: 36px;
        border: 1px solid var(--color-border);
        background: var(--color-white);
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .cal-nav-btn svg {
        width: 16px;
        height: 16px;
        stroke: var(--color-primary);
    }

    .cal-month-title {
        font-family: var(--font-heading);
        font-size: 16px;
        font-weight: 600;
        color: var(--color-primary);
    }

    /* Weekdays */
    .cal-weekdays {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        text-align: center;
        padding: 8px 16px;
        background: var(--color-cream);
        border-bottom: 1px solid var(--color-border-light);
    }

    .cal-weekdays span {
        font-size: 10px;
        font-weight: 700;
        color: var(--color-text-muted);
        padding: 6px 0;
        text-transform: uppercase;
    }

    /* Days grid */
    .cal-days {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 4px;
        padding: 12px 16px;
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .cal-days .day {
        aspect-ratio: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        font-weight: 500;
        border-radius: 8px;
        cursor: pointer;
        transition: all 0.15s ease;
        min-height: 36px;
    }

    .cal-days .day:hover {
        background: var(--color-cream);
    }

    .cal-days .day.today {
        font-weight: 700;
        color: var(--color-gold);
        border: 2px solid var(--color-gold);
    }

    .cal-days .day.selected {
        background: var(--color-gold);
        color: var(--color-primary);
        font-weight: 700;
    }

    .cal-days .day.in-range {
        background: rgba(198,180,145,0.15);
    }

    .cal-days .day.start-date {
        border-radius: 8px 0 0 8px;
    }

    .cal-days .day.end-date {
        border-radius: 0 8px 8px 0;
    }

    .cal-days .day.blocked {
        color: #ccc;
        text-decoration: line-through;
        cursor: not-allowed;
        pointer-events: none;
    }

    .cal-days .day.past {
        color: #ddd;
        cursor: not-allowed;
        pointer-events: none;
    }

    .cal-days .day.empty {
        visibility: hidden;
    }

    /* Legend */
    .cal-legend {
        display: flex;
        justify-content: center;
        gap: 20px;
        padding: 12px 16px;
        background: var(--color-cream);
        border-top: 1px solid var(--color-border-light);
    }

    .cal-legend span {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 11px;
        color: var(--color-text-muted);
    }

    .cal-legend .dot {
        width: 10px;
        height: 10px;
        border-radius: 4px;
    }

    .cal-legend .dot.available {
        background: var(--color-white);
        border: 2px solid var(--color-gold);
    }

    .cal-legend .dot.blocked {
        background: #f5f5f5;
        border: 2px solid #ddd;
    }

}

/* ===== SMALL MOBILE (≤375px) ===== */

@media (max-width: 375px) {

    .calendar-popover {
        max-width: 300px;
        max-height: 380px;
    }

    .calendar-popover-header {
        padding: 12px 16px 10px;
    }

    .cal-nav-btn {
        width: 32px;
        height: 32px;
    }

    .cal-month-title {
        font-size: 14px;
    }

    .cal-close-btn {
        width: 32px;
        height: 32px;
    }

    .cal-weekdays span {
        font-size: 9px;
    }

    .cal-days {
        gap: 3px;
        padding: 10px 12px;
    }

    .cal-days .day {
        font-size: 13px;
        min-height: 32px;
    }

    .cal-legend {
        gap: 14px;
        padding: 10px 12px;
    }

    .cal-legend span {
        font-size: 10px;
    }

}

/* ===== VERY SMALL MOBILE (≤320px) ===== */

@media (max-width: 320px) {

    .calendar-popover {
        max-width: 280px;
        max-height: 350px;
    }

    .cal-weekdays span {
        font-size: 8px;
    }

    .cal-days .day {
        font-size: 12px;
        min-height: 28px;
    }

    .cal-legend {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }

}
