/**
 * Booking Calendar Styles
 * Custom styling for Flatpickr with three-color coding system
 * Clarification 10: Green/Yellow/Red availability colors
 */

/* Import Flatpickr base styles */
@import url('https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css');

/* Calendar container */
.flatpickr-calendar {
    background: #ffffff;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 0, 0, 0.3);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

/* Calendar header */
.flatpickr-months {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
    border-bottom: 1px solid rgba(255, 0, 0, 0.2);
    border-radius: 10px 10px 0 0;
}

.flatpickr-month {
    color: #ffffff;
}

.flatpickr-current-month {
    color: #ffffff;
}

.flatpickr-prev-month,
.flatpickr-next-month {
    color: #ffffff;
    fill: #ffffff;
}

.flatpickr-prev-month:hover,
.flatpickr-next-month:hover {
    color: #ffcccc;
    fill: #ffcccc;
}

/* Weekday labels */
.flatpickr-weekdays {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.flatpickr-weekday {
    color: #374151;
    font-weight: 600;
}

/* Calendar days - Default state */
.flatpickr-day {
    color: #000000 !important;
    background: #ffffff !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.flatpickr-day:hover:not(.disabled):not(.flatpickr-disabled) {
    background: #f9fafb !important;
    border-color: rgba(255, 0, 0, 0.3) !important;
}

/* Today's date */
.flatpickr-day.today {
    font-weight: 700;
}

/* Disabled dates (past) - Gray text, no colored borders */
.flatpickr-day.disabled,
.flatpickr-day.disabled:hover,
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    color: #666666 !important;
    background: #ffffff !important;
    border: 2px solid #e5e7eb !important;
    cursor: not-allowed !important;
    opacity: 0.5;
}

/* ========== THREE-COLOR AVAILABILITY SYSTEM ========== */

/* Green - Fully Available (UNSELECTED: border only, black text) */
.flatpickr-day.available-day:not(.selected) {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #22c55e !important;
}

.flatpickr-day.available-day:not(.selected):hover {
    background-color: #f0fdf4 !important;
    border-color: #16a34a !important;
}

/* Green - Fully Available (SELECTED: full background, white text) */
.flatpickr-day.available-day.selected {
    background: #22c55e !important;
    color: #ffffff !important;
    border: 2px solid #16a34a !important;
}

/* Yellow - Partially Booked (UNSELECTED: border only, black text) */
.flatpickr-day.partial-day:not(.selected) {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #eab308 !important;
}

.flatpickr-day.partial-day:not(.selected):hover {
    background-color: #fefce8 !important;
    border-color: #ca8a04 !important;
}

/* Yellow - Partially Booked (SELECTED: full background, white text) */
.flatpickr-day.partial-day.selected {
    background: #eab308 !important;
    color: #ffffff !important;
    border: 2px solid #ca8a04 !important;
}

/* Red - Fully Booked (UNSELECTED: border only, black text, DISABLED) */
.flatpickr-day.blocked-day {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #ef4444 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

/* Red - Fully Booked (Cannot be selected) */
.flatpickr-day.blocked-day.flatpickr-disabled {
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #ef4444 !important;
}

/* ========== CALENDAR LEGEND ========== */

.calendar-legend {
    display: flex;
    gap: 16px;
    padding: 12px;
    background: #ffffff;
    backdrop-filter: blur(10px);
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 0, 0, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
    font-weight: 500;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.legend-color.green {
    background-color: rgba(220, 252, 231, 0.3);
    border-color: rgba(22, 163, 74, 0.5);
}

.legend-color.yellow {
    background-color: rgba(254, 243, 199, 0.3);
    border-color: rgba(202, 138, 4, 0.5);
}

.legend-color.red {
    background-color: rgba(254, 226, 226, 0.3);
    border-color: rgba(153, 27, 27, 0.5);
}

/* ========== TIME DROPDOWNS ========== */

.time-selector {
    display: flex;
    gap: 12px;
}

.time-input-group {
    flex: 1;
}

.time-input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 6px;
}

.time-input-group select {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 6px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.time-input-group select:hover {
    border-color: rgba(255, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.7);
}

.time-input-group select:focus {
    outline: none;
    border-color: #ff0000;
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.1);
}

/* ========== SOFT LOCK MESSAGE ========== */

.lock-message {
    margin-top: 16px;
    padding: 12px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    color: #93c5fd;
    font-size: 13px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* ========== PRICE BREAKDOWN ========== */

.price-breakdown {
    margin-top: 20px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 0, 0, 0.2);
    border-radius: 8px;
}

.price-breakdown h3 {
    color: #ffffff;
    margin-bottom: 12px;
}

.price-breakdown .space-y-2 > div {
    padding: 6px 0;
}

.price-breakdown .border-t {
    margin: 8px 0;
}

/* ========== ALTERNATIVES SECTION ========== */

.alternatives-section,
.waitlist-section {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alternative-card {
    transition: all 0.2s ease;
}

.alternative-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ========== RESPONSIVE DESIGN ========== */

@media (max-width: 768px) {
    .flatpickr-calendar {
        width: 100% !important;
        max-width: 100vw;
        left: 0 !important;
        right: 0 !important;
    }
    
    .calendar-legend {
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
    
    .legend-item {
        font-size: 12px;
    }
    
    .time-selector {
        flex-direction: column;
    }
    
    .alternative-card {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .flatpickr-calendar {
        font-size: 14px;
    }
    
    .flatpickr-day {
        height: 32px;
        line-height: 32px;
    }
    
    .calendar-legend {
        padding: 8px;
    }
}

/* ========== LOADING STATE ========== */

.calendar-loading {
    position: relative;
}

.calendar-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

/* ========== ACCESSIBILITY ========== */

.flatpickr-day:focus {
    outline: 2px solid #ff0000;
    outline-offset: 2px;
}

.flatpickr-day[aria-disabled="true"] {
    cursor: not-allowed;
}

/* Tooltips for availability status */
.flatpickr-day[title]::before {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.9);
    color: #ffffff;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.flatpickr-day[title]:hover::before {
    opacity: 1;
}
