/* ── Availability Calendar Widget ── */

/* Trigger button */
.gcal-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #C9A962;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-family: "Poppins", sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.gcal-trigger:hover {
    opacity: 0.9;
}

/* ── Modal ── */
.gcal-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
}

.gcal-modal.open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gcal-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.gcal-modal-content {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

/* Header */
.gcal-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.gcal-modal-title {
    font-family: "Poppins", sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
}

.gcal-modal-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #666;
    line-height: 0;
    border-radius: 50%;
    transition: background 0.2s;
}

.gcal-modal-close:hover {
    background: #f0f0f0;
}

/* ── Property selector (multi mode) ── */
.gcal-properties {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.gcal-properties-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.gcal-properties-scroll::-webkit-scrollbar {
    height: 4px;
}

.gcal-properties-scroll::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 2px;
}

.gcal-property-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border: 2px solid transparent;
    border-radius: 10px;
    background: none;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    flex-shrink: 0;
    width: 90px;
}

.gcal-property-card:hover {
    background: #f8f8f8;
}

.gcal-property-card.active {
    border-color: #C9A962;
    background: #faf6ee;
}

.gcal-property-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.gcal-property-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gcal-property-name {
    font-family: "Poppins", sans-serif;
    font-size: 0.65rem;
    font-weight: 600;
    color: #333;
    text-align: center;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    max-width: 80px;
}

/* ── Calendar area ── */
.gcal-calendar-area {
    padding: 16px 24px;
    flex: 1;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Loading */
.gcal-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 40px 0;
    color: #888;
    font-family: "Poppins", sans-serif;
    font-size: 0.85rem;
}

.gcal-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(201, 169, 98, 0.3);
    border-top-color: #C9A962;
    border-radius: 50%;
    animation: gcal-spin 0.8s linear infinite;
}

@keyframes gcal-spin {
    to { transform: rotate(360deg); }
}

/* Flatpickr inline overrides */
.gcal-calendar-container .flatpickr-calendar {
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    max-width: 100% !important;
}

.gcal-calendar-container .flatpickr-months {
    margin-bottom: 8px;
}

.gcal-calendar-container .flatpickr-month {
    font-family: "Poppins", sans-serif;
}

/* Booked/unavailable dates */
.gcal-calendar-container .flatpickr-day.flatpickr-disabled {
    color: #ccc !important;
    text-decoration: line-through;
    background: #f8f8f8 !important;
}

/* Selected range */
.gcal-calendar-container .flatpickr-day.selected,
.gcal-calendar-container .flatpickr-day.startRange,
.gcal-calendar-container .flatpickr-day.endRange {
    background: #C9A962 !important;
    border-color: #C9A962 !important;
    color: #fff !important;
}

.gcal-calendar-container .flatpickr-day.inRange {
    background: rgba(201, 169, 98, 0.15) !important;
    border-color: rgba(201, 169, 98, 0.15) !important;
    box-shadow: -5px 0 0 rgba(201, 169, 98, 0.15), 5px 0 0 rgba(201, 169, 98, 0.15) !important;
}

/* Legend */
.gcal-legend {
    display: flex;
    gap: 20px;
    margin-top: 12px;
    font-family: "Poppins", sans-serif;
    font-size: 0.72rem;
    color: #888;
}

.gcal-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gcal-legend-item::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.gcal-legend-available::before {
    background: #fff;
    border: 1px solid #ddd;
}

.gcal-legend-booked::before {
    background: #f0f0f0;
    border: 1px solid #ddd;
    text-decoration: line-through;
}

/* ── Action button ── */
.gcal-action {
    padding: 12px 24px 20px;
    text-align: center;
    flex-shrink: 0;
}

.gcal-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: #C9A962;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: "Poppins", sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

.gcal-action-btn:hover {
    background: #b3943e;
    color: #fff;
}

/* ── Mobile: full screen modal ── */
@media (max-width: 540px) {
    .gcal-modal-content {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .gcal-calendar-area {
        padding: 12px 16px;
    }

    .gcal-properties {
        padding: 12px 16px;
    }
}

/* ── Single property page trigger ── */
.gcal-sp-wrapper {
    margin-top: 16px;
}

.gcal-sp-trigger {
    width: 100%;
    justify-content: center;
    background: transparent;
    color: #C9A962;
    border: 2px solid #C9A962;
}

.gcal-sp-trigger:hover {
    background: #C9A962;
    color: #fff;
    opacity: 1;
}

/* Body scroll lock */
body.gcal-modal-open {
    overflow: hidden;
}
