/* ========================================
   LISTING DETAIL - DATE PICKER
   Airbnb-style dual-month calendar popup

   All classes use 'ldp-' prefix (listing date picker)
   to prevent CSS conflicts with other components
   ======================================== */

/* ========================================
   DATE PICKER POPUP CONTAINER
   ======================================== */

.ldp-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    padding: 24px;
    z-index: 1000;
    min-width: 660px;
    overflow: hidden; /* let inner area scroll so footer stays fixed */
    box-sizing: border-box;
    max-height: 90vh;
    display: none;            /* hidden until opened */
    flex-direction: column;
}

.ldp-popup.open {
    display: flex;
}

/* ========================================
   DATE PICKER HEADER
   ======================================== */

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

.ldp-header-left {
    flex: 1;
}

.ldp-header-title {
    font-size: 22px;
    font-weight: 600;
    color: #222222;
    margin: 0 0 8px 0;
}

.ldp-header-subtitle {
    font-size: 14px;
    font-weight: 400;
    color: #717171;
    margin: 0;
}

.ldp-header-right {
    display: flex;
    gap: 8px;
}

.ldp-input-group {
    display: flex;
    border: 1px solid #b0b0b0;
    border-radius: 8px;
    overflow: hidden;
}

.ldp-input {
    padding: 8px 16px;
    min-width: 120px;
    background: #ffffff;
    border: none;
    cursor: pointer;
}

.ldp-input:first-child {
    border-right: 1px solid #b0b0b0;
}

.ldp-input.active {
    background: #f7f7f7;
}

.ldp-input-label {
    display: block;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #222222;
    margin-bottom: 4px;
}

.ldp-input-value {
    font-size: 14px;
    font-weight: 400;
    color: #717171;
}

.ldp-input-value.has-date {
    color: #222222;
}

/* ========================================
   CALENDARS CONTAINER
   ======================================== */

.ldp-calendars {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin: 0;
    padding: 0;
    position: relative;
    flex: 1 1 auto;          /* take remaining space under header */
    overflow-y: auto;
    min-height: 0;            /* allow scrolling inside flex container */
    padding-right: 4px;       /* avoid scrollbar overlap */
}

.ldp-calendar {
    min-width: 280px;
    margin: 0;
    padding: 0;
}

/* ========================================
   CALENDAR NAVIGATION
   ======================================== */

.ldp-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.ldp-nav-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
    padding: 0;
    box-shadow: none;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.ldp-nav-btn:hover {
    background: #f7f7f7;
}

.ldp-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.ldp-nav-btn svg {
    width: 12px;
    height: 12px;
    fill: #222222;
}

/* Hidden nav button (for single-direction navigation on each calendar) */
.ldp-nav-btn-hidden {
    visibility: hidden;
}

.ldp-month-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: #222222;
    text-align: center;
    white-space: nowrap;
}

/* ========================================
   CALENDAR WEEKDAY HEADERS
   ======================================== */

.ldp-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 8px;
}

.ldp-weekday {
    font-size: 12px;
    font-weight: 600;
    color: #717171;
    text-align: center;
    padding: 8px 0;
}

/* ========================================
   CALENDAR DAYS GRID
   ======================================== */

.ldp-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.ldp-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 400;
    color: #222222;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.15s ease;
    position: relative;
    border: none;
    outline: none;
    background: transparent;
}

.ldp-day:hover:not(.disabled):not(.empty) {
    background: #f7f7f7;
}

/* Empty cells for padding */
.ldp-day.empty {
    cursor: default;
}

/* Disabled (past) dates */
.ldp-day.disabled {
    color: #b0b0b0;
    text-decoration: line-through;
    cursor: not-allowed;
}

/* Blocked dates (reservations, not available) - horizontal strikethrough */
.ldp-day.blocked {
    color: #b0b0b0;
    text-decoration: line-through;
    cursor: not-allowed;
}

/* Today's date */
.ldp-day.today:not(.selected):not(.in-range) {
    font-weight: 600;
}

/* Selected check-in date */
.ldp-day.check-in {
    background: #222222;
    color: #ffffff;
    border-radius: 50%;
}

/* Selected check-out date */
.ldp-day.check-out {
    background: #222222;
    color: #ffffff;
    border-radius: 50%;
}

/* Days in between (range) */
.ldp-day.in-range {
    background: #f7f7f7;
    border-radius: 0;
}

/* Range start styling */
.ldp-day.range-start {
    border-radius: 50% 0 0 50%;
}

/* Range end styling */
.ldp-day.range-end {
    border-radius: 0 50% 50% 0;
}

/* Single day selected (same check-in/check-out - invalid) */
.ldp-day.selected {
    background: #222222;
    color: #ffffff;
}

/* Hover state when selecting checkout */
.ldp-day.hover-in-range {
    background: #f0f0f0;
}

/* ========================================
   CALENDAR FOOTER
   ======================================== */

.ldp-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #ebebeb;
}

.ldp-keyboard-shortcuts {
    font-size: 14px;
    font-weight: 600;
    color: #222222;
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    box-shadow: none;
}

.ldp-actions {
    display: flex;
    gap: 8px;
}

.ldp-clear-btn {
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #222222;
    background: none;
    border: none;
    text-decoration: underline;
    cursor: pointer;
    box-shadow: none;
}

.ldp-close-btn {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background: #222222;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    box-shadow: none;
}

.ldp-close-btn:hover {
    background: #000000;
}

/* ========================================
   DATE PICKER OVERLAY (for closing)
   ======================================== */

.ldp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    display: none;
    background: rgba(0, 0, 0, 0.25);
}

.ldp-overlay.open {
    display: block;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

@media (max-width: 768px) {
    .ldp-popup.open {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        transform: none;
        border-radius: 0;
        margin: 0;
        min-width: auto;
        overflow: hidden;
        padding: 16px;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    .ldp-calendars {
        grid-template-columns: 1fr;
        gap: 24px;
        flex: 1 1 auto;
        overflow-y: auto;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }

    .ldp-calendar {
        min-width: auto;
    }

    .ldp-header {
        flex-direction: column;
        gap: 16px;
    }

    .ldp-header-right {
        width: 100%;
    }

    .ldp-input-group {
        width: 100%;
    }

    .ldp-input {
        flex: 1;
    }

    .ldp-nav {
        padding: 0 8px;
    }

    /* Mobile close button */
    .ldp-mobile-close {
        position: absolute;
        top: 16px;
        right: 16px;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        border: none;
        background: #f7f7f7;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .ldp-mobile-close svg {
        width: 12px;
        height: 12px;
    }
}

/* ========================================
   ANIMATION
   ======================================== */

@keyframes ldpSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.ldp-popup.open {
    animation: ldpSlideIn 0.2s ease-out;
}

@media (max-width: 768px) {
    @keyframes ldpSlideIn {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .ldp-popup.open {
        animation: ldpSlideIn 0.3s ease-out;
    }
}

/* ========================================
   INLINE MODE STYLES
   For embedded calendars (not popup)
   ======================================== */

.ldp-inline {
    background: transparent;
    border-radius: 0;
    padding: 0;
}

.ldp-inline .ldp-calendars {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.ldp-inline .ldp-calendar {
    min-width: auto;
}

.ldp-inline-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #ebebeb;
}

@media (max-width: 768px) {
    .ldp-inline .ldp-calendars {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}
