/**
 * Custom Calendar Styles
 * Modern, responsive calendar component
 */

/* Base Calendar Container */
.custom-calendar {
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    user-select: none;
    z-index: 9999;
}

/* Dropdown mode */
.custom-calendar.dropdown {
    display: none;
    position: fixed;
    z-index: 9999;
}

.custom-calendar.dropdown.open {
    display: block;
}

/* Inline mode */
.custom-calendar.inline {
    display: block;
    position: relative;
    width: 100%;
    max-width: 100%;
}

.custom-calendar.inline .calendar-container {
    max-width: 100%;
}

/* Animation variants */
.custom-calendar.animation-scale-fade.dropdown.open {
    animation: calendarScaleIn 0.2s ease-out forwards;
}

.custom-calendar.animation-fade.dropdown.open {
    animation: calendarFadeIn 0.2s ease-out forwards;
}

.custom-calendar.animation-slide.dropdown.open {
    animation: calendarSlideDown 0.2s ease-out forwards;
}

/* Calendar Container */
.calendar-container {
    padding: 16px;
    display: flex;
    gap: 20px;
    width: 100%;
}

@media (max-width: 768px) {
    .calendar-container {
        gap: 0;
        flex-direction: column;
    }
}

/* Month Container */
.calendar-month {
    flex: 1;
    min-width: 0;
}

@media (max-width: 768px) {
    .calendar-month {
        width: 100%;
    }
}

/* Header with navigation */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 4px;
}

.calendar-header .calendar-month-label {
    font-size: 15px;
    font-weight: 600;
    color: #0b224b;
    text-align: center;
    flex: 1;
}

.calendar-header .calendar-nav {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: #374151;
    transition: all 0.2s ease;
}

.calendar-header .calendar-nav:hover {
    background: #f3f4f6;
    color: #c65825;
}

.calendar-header .calendar-nav:active {
    transform: scale(0.95);
}

.calendar-header .calendar-nav svg {
    width: 12px;
    height: 12px;
}

.calendar-header .calendar-nav-spacer {
    width: 32px;
    height: 32px;
}

/* Weekday headers */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.calendar-weekdays .calendar-weekday {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    padding: 8px 0;
}

/* Days grid */
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

/* Individual day cell */
.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.calendar-day:not(.disabled):not(.empty):hover {
    background: #f3f4f6;
    color: #c65825;
    transform: scale(1.05);
}

.calendar-day:not(.disabled):not(.empty):active {
    transform: scale(0.95);
}

/* Empty cells (before month starts) */
.calendar-day.empty {
    cursor: default;
    visibility: hidden;
}

/* Disabled dates */
.calendar-day.disabled {
    color: #d1d5db;
    cursor: not-allowed;
    background: transparent;
}

.calendar-day.disabled:hover {
    background: transparent;
    transform: none;
}

/* Override disabled styles for availability calendar */
.calendar-day.disabled.available-date {
    color: #374151;
    cursor: default;
}

.calendar-day.disabled.unavailable-date {
    color: #9ca3af;
    cursor: not-allowed;
}

/* Today */
.calendar-day.today {
    font-weight: 700;
}

.calendar-day.today:not(.selected) {
    border: 2px solid #c65825;
}

/* Selected date - higher specificity to override available-date */
.calendar-day.selected,
.calendar-day.available-date.selected,
.calendar-day.unavailable-date.selected {
    background: #c65825 !important;
    color: #ffffff !important;
    font-weight: 600;
    border: none !important;
}

.calendar-day.selected::after,
.calendar-day.available-date.selected::after,
.calendar-day.unavailable-date.selected::after {
    display: none !important;
}

.calendar-day.selected:hover,
.calendar-day.available-date.selected:hover,
.calendar-day.unavailable-date.selected:hover {
    background: #b34d1f !important;
    color: #ffffff !important;
    transform: scale(1.05) !important;
}

/* Range start */
.calendar-day.start-range,
.calendar-day.available-date.start-range,
.calendar-day.unavailable-date.start-range {
    background: #c65825 !important;
    color: #ffffff !important;
    border-radius: 8px 0 0 8px;
    border: none !important;
}

.calendar-day.start-range::after,
.calendar-day.available-date.start-range::after,
.calendar-day.unavailable-date.start-range::after {
    display: none !important;
}

.calendar-day.start-range:hover,
.calendar-day.available-date.start-range:hover,
.calendar-day.unavailable-date.start-range:hover {
    background: #b34d1f !important;
    transform: scale(1.05) !important;
}

/* Range end */
.calendar-day.end-range,
.calendar-day.available-date.end-range,
.calendar-day.unavailable-date.end-range {
    background: #c65825 !important;
    color: #ffffff !important;
    border-radius: 0 8px 8px 0;
    border: none !important;
}

.calendar-day.end-range::after,
.calendar-day.available-date.end-range::after,
.calendar-day.unavailable-date.end-range::after {
    display: none !important;
}

.calendar-day.end-range:hover,
.calendar-day.available-date.end-range:hover,
.calendar-day.unavailable-date.end-range:hover {
    background: #b34d1f !important;
    transform: scale(1.05) !important;
}

/* Single day range (start and end are same) */
.calendar-day.start-range.end-range,
.calendar-day.available-date.start-range.end-range,
.calendar-day.unavailable-date.start-range.end-range {
    border-radius: 8px;
}

/* Dates in range */
.calendar-day.in-range,
.calendar-day.available-date.in-range,
.calendar-day.unavailable-date.in-range {
    background: rgba(198, 88, 37, 0.1) !important;
    color: #374151 !important;
    border-radius: 0;
    border: none !important;
}

.calendar-day.in-range::after,
.calendar-day.available-date.in-range::after,
.calendar-day.unavailable-date.in-range::after {
    display: none !important;
}

.calendar-day.in-range:hover,
.calendar-day.available-date.in-range:hover,
.calendar-day.unavailable-date.in-range:hover {
    background: rgba(198, 88, 37, 0.15) !important;
    transform: scale(1.05) !important;
}

/* Layout variants */
.custom-calendar.one-month .calendar-container {
    max-width: none;
}

.custom-calendar.two-months .calendar-container {
    max-width: none;
}

@media (max-width: 768px) {
    .custom-calendar.two-months .calendar-container {
        max-width: 320px;
    }
}

.custom-calendar.dropdown.two-months {
    width: 660px;
}

@media (max-width: 768px) {
    .custom-calendar.dropdown.two-months {
        width: calc(100vw - 32px);
        max-width: 320px;
    }
}

.custom-calendar.dropdown.one-month {
    width: 320px;
}

@media (max-width: 768px) {
    .custom-calendar.dropdown.one-month {
        width: calc(100vw - 32px);
        max-width: 320px;
    }
}

/* Animations */
@keyframes calendarScaleIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes calendarFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes calendarSlideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom classes for availability calendar */
.calendar-day.available-date {
    position: relative;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    cursor: default;
}

.calendar-day.available-date:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.5);
    transform: none;
}

.calendar-day.available-date::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #10b981;
}

.calendar-day.unavailable-date {
    position: relative;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #9ca3af;
    cursor: not-allowed;
}

.calendar-day.unavailable-date:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    transform: none;
}

.calendar-day.unavailable-date::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #ef4444;
}

.calendar-day.unavailable {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #9ca3af;
    cursor: not-allowed;
}

.calendar-day.unavailable:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    transform: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .custom-calendar {
        border-radius: 8px;
    }

    .custom-calendar.dropdown {
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
        max-width: none !important;
        transform: none !important;
    }

    .calendar-container {
        padding: 12px;
    }

    .calendar-header {
        margin-bottom: 12px;
    }

    .calendar-header .calendar-month-label {
        font-size: 14px;
    }

    .calendar-header .calendar-nav {
        width: 28px;
        height: 28px;
    }

    .calendar-weekdays .calendar-weekday {
        font-size: 11px;
        padding: 6px 0;
    }

    .calendar-day {
        font-size: 13px;
        border-radius: 6px;
    }
}

/* Accessibility improvements */
.calendar-day:focus-visible {
    outline: 2px solid #c65825;
    outline-offset: 2px;
    z-index: 1;
}

.calendar-nav:focus-visible {
    outline: 2px solid #c65825;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .custom-calendar.dropdown {
        display: none;
    }
}
