/**
 * Calendar Styles - Modern Light Theme
 * 
 * @package DokanRentalsBookings
 */

/* ==========================================================================
   Design Tokens
   ========================================================================== */
:root {
    --wahrb-primary: #2563eb;
    --wahrb-primary-hover: #1d4ed8;
    --wahrb-primary-light: #eff6ff;
    --wahrb-success: #10b981;
    --wahrb-success-light: #ecfdf5;
    --wahrb-warning: #f59e0b;
    --wahrb-warning-light: #fffbeb;
    --wahrb-danger: #ef4444;
    --wahrb-danger-light: #fef2f2;
    --wahrb-info: #0ea5e9;
    --wahrb-info-light: #f0f9ff;

    --wahrb-white: #ffffff;
    --wahrb-gray-50: #f8fafc;
    --wahrb-gray-100: #f1f5f9;
    --wahrb-gray-200: #e2e8f0;
    --wahrb-gray-300: #cbd5e1;
    --wahrb-gray-400: #94a3b8;
    --wahrb-gray-500: #64748b;
    --wahrb-gray-600: #475569;
    --wahrb-gray-700: #334155;
    --wahrb-gray-800: #1e293b;
    --wahrb-gray-900: #0f172a;

    --wahrb-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --wahrb-radius-sm: 0.375rem;
    --wahrb-radius-md: 0.5rem;
    --wahrb-radius-lg: 0.75rem;
}

/* ==========================================================================
   Calendar Container
   ========================================================================== */
#wahrb-calendar-container {
    background: var(--wahrb-white);
    border: 1px solid var(--wahrb-gray-200);
    border-radius: var(--wahrb-radius-lg);
    padding: 1.5rem;
    font-family: var(--wahrb-font-family);
}

#wahrb-fullcalendar {
    background: var(--wahrb-white);
}

/* ==========================================================================
   FullCalendar Overrides
   ========================================================================== */
.fc {
    font-family: var(--wahrb-font-family);
}

.fc-theme-standard td,
.fc-theme-standard th {
    border-color: var(--wahrb-gray-200);
}

.fc-theme-standard .fc-scrollgrid {
    border-color: var(--wahrb-gray-200);
}

/* Toolbar */
.fc .fc-toolbar {
    margin-bottom: 1.5rem;
}

.fc .fc-toolbar-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--wahrb-gray-800);
}

/* Buttons */
.fc .fc-button {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--wahrb-primary);
    border-color: var(--wahrb-primary);
    border-radius: var(--wahrb-radius-md) !important;
    text-transform: capitalize;
}

.fc .fc-button:hover {
    background: var(--wahrb-primary-hover);
    border-color: var(--wahrb-primary-hover);
}

.fc .fc-button:focus {
    background: var(--wahrb-primary-light);
}

.fc .fc-button:disabled {
    background: var(--wahrb-gray-300);
    border-color: var(--wahrb-gray-300);
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background: var(--wahrb-primary-hover);
    border-color: var(--wahrb-primary-hover);
}

.fc .fc-button-group .fc-button {
    border-radius: 0 !important;
}

.fc .fc-button-group .fc-button:first-child {
    border-radius: var(--wahrb-radius-md) 0 0 var(--wahrb-radius-md) !important;
}

.fc .fc-button-group .fc-button:last-child {
    border-radius: 0 var(--wahrb-radius-md) var(--wahrb-radius-md) 0 !important;
}

/* Day Headers */
.fc .fc-col-header-cell {
    padding: 0.75rem 0;
    background: var(--wahrb-gray-50);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--wahrb-gray-600);
}

/* Day Cells */
.fc .fc-daygrid-day {
    background: var(--wahrb-white);
}

.fc .fc-daygrid-day:hover {
    background: var(--wahrb-gray-50);
}

.fc .fc-daygrid-day.fc-day-today {
    background: var(--wahrb-primary-light);
}

.fc .fc-daygrid-day-number {
    padding: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--wahrb-gray-700);
}

.fc .fc-daygrid-day.fc-day-other .fc-daygrid-day-number {
    color: var(--wahrb-gray-400);
}

/* ==========================================================================
   Event Styles
   ========================================================================== */
/* Reset FullCalendar 6 default event colors so our status classes take effect */
.fc .fc-h-event,
.fc .fc-v-event {
    --fc-event-bg-color: transparent;
    --fc-event-border-color: transparent;
    --fc-event-text-color: inherit;
    background-color: transparent;
    border-color: transparent;
}

.fc-event {
    cursor: pointer;
    border-radius: var(--wahrb-radius-sm);
    padding: 0.125rem 0.5rem;
    margin: 1px 2px;
    font-size: 0.75rem;
    font-weight: 500;
    border-width: 0;
    border-left-width: 3px;
}

.fc-event .fc-event-title,
.fc-event .fc-event-main {
    font-weight: 500;
    color: inherit;
}

.fc .fc-event.fc-event-pending,
.fc .fc-h-event.fc-event-pending,
.fc .fc-v-event.fc-event-pending {
    background-color: var(--wahrb-warning-light) !important;
    border-left-color: var(--wahrb-warning) !important;
    color: #b45309 !important;
}

.fc .fc-event.fc-event-confirmed,
.fc .fc-h-event.fc-event-confirmed,
.fc .fc-v-event.fc-event-confirmed {
    background-color: var(--wahrb-success-light) !important;
    border-left-color: var(--wahrb-success) !important;
    color: #047857 !important;
}

.fc .fc-event.fc-event-checked_in,
.fc .fc-event.fc-event-active,
.fc .fc-h-event.fc-event-checked_in,
.fc .fc-h-event.fc-event-active,
.fc .fc-v-event.fc-event-checked_in,
.fc .fc-v-event.fc-event-active {
    background-color: var(--wahrb-info-light) !important;
    border-left-color: var(--wahrb-info) !important;
    color: #0369a1 !important;
}

.fc .fc-event.fc-event-checked_out,
.fc .fc-event.fc-event-checkout,
.fc .fc-h-event.fc-event-checked_out,
.fc .fc-h-event.fc-event-checkout,
.fc .fc-v-event.fc-event-checked_out,
.fc .fc-v-event.fc-event-checkout {
    background-color: #fef3c7 !important;
    border-left-color: #d97706 !important;
    color: #92400e !important;
}

.fc .fc-event.fc-event-completed,
.fc .fc-h-event.fc-event-completed,
.fc .fc-v-event.fc-event-completed {
    background-color: var(--wahrb-gray-100) !important;
    border-left-color: var(--wahrb-gray-500) !important;
    color: var(--wahrb-gray-700) !important;
}

.fc .fc-event.fc-event-cancelled,
.fc .fc-h-event.fc-event-cancelled,
.fc .fc-v-event.fc-event-cancelled {
    background-color: var(--wahrb-danger-light) !important;
    border-left-color: var(--wahrb-danger) !important;
    color: #b91c1c !important;
    text-decoration: line-through;
}

/* ==========================================================================
   Blackout Dates
   ========================================================================== */
.fc-daygrid-day.wahrb-blackout {
    background: var(--wahrb-gray-100);
}

.fc-daygrid-day.wahrb-blackout .fc-daygrid-day-number {
    color: var(--wahrb-gray-400);
}

.fc-daygrid-day.wahrb-unavailable {
    background: var(--wahrb-danger-light);
}

.fc-daygrid-day.wahrb-unavailable .fc-daygrid-day-number {
    color: #b91c1c;
}

/* ==========================================================================
   Legend
   ========================================================================== */
.wahrb-calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background: var(--wahrb-gray-50);
    border: 1px solid var(--wahrb-gray-200);
    border-radius: var(--wahrb-radius-md);
}

.wahrb-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--wahrb-gray-600);
}

.wahrb-legend-color {
    width: 14px;
    height: 14px;
    border-radius: var(--wahrb-radius-sm);
    border-left: 3px solid;
}

.wahrb-legend-pending .wahrb-legend-color {
    background: var(--wahrb-warning-light);
    border-left-color: var(--wahrb-warning);
}

.wahrb-legend-confirmed .wahrb-legend-color {
    background: var(--wahrb-success-light);
    border-left-color: var(--wahrb-success);
}

.wahrb-legend-active .wahrb-legend-color {
    background: var(--wahrb-info-light);
    border-left-color: var(--wahrb-info);
}

.wahrb-legend-completed .wahrb-legend-color {
    background: var(--wahrb-gray-100);
    border-left-color: var(--wahrb-gray-500);
}

.wahrb-legend-cancelled .wahrb-legend-color {
    background: var(--wahrb-danger-light);
    border-left-color: var(--wahrb-danger);
}

/* ==========================================================================
   Product Page Calendar
   ========================================================================== */
.wahrb-product-calendar {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--wahrb-white);
    border: 1px solid var(--wahrb-gray-200);
    border-radius: var(--wahrb-radius-lg);
}

.wahrb-product-calendar h3 {
    margin: 0 0 1rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--wahrb-gray-800);
}

/* ==========================================================================
   Date Picker Fields
   ========================================================================== */
.wahrb-date-picker-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.wahrb-date-field {
    display: flex;
    flex-direction: column;
}

.wahrb-date-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--wahrb-gray-700);
}

.wahrb-date-field input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: var(--wahrb-gray-800);
    background: var(--wahrb-white);
    border: 1px solid var(--wahrb-gray-300);
    border-radius: var(--wahrb-radius-md);
    outline: none;
}

.wahrb-date-field input:focus {
    border-color: var(--wahrb-primary);
    background: var(--wahrb-primary-light);
}

/* ==========================================================================
   Price Preview
   ========================================================================== */
.wahrb-price-preview {
    padding: 1rem 1.25rem;
    background: var(--wahrb-gray-50);
    border: 1px solid var(--wahrb-gray-200);
    border-radius: var(--wahrb-radius-md);
    margin-bottom: 1rem;
}

.wahrb-price-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--wahrb-gray-600);
}

.wahrb-price-line:not(:last-child) {
    border-bottom: 1px dashed var(--wahrb-gray-200);
}

.wahrb-price-line.wahrb-price-total {
    padding-top: 0.75rem;
    margin-top: 0.5rem;
    border-top: 1px solid var(--wahrb-gray-300);
    font-weight: 600;
    font-size: 1rem;
    color: var(--wahrb-gray-800);
}

.wahrb-price-line.wahrb-price-total .wahrb-price-value {
    color: var(--wahrb-primary);
    font-size: 1.125rem;
}

/* ==========================================================================
   Add to Cart Button
   ========================================================================== */
.wahrb-add-to-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-family: var(--wahrb-font-family);
    font-size: 1rem;
    font-weight: 600;
    color: var(--wahrb-white);
    background: var(--wahrb-primary);
    border: none;
    border-radius: var(--wahrb-radius-md);
    cursor: pointer;
    outline: none;
}

.wahrb-add-to-cart-btn:hover {
    background: var(--wahrb-primary-hover);
}

.wahrb-add-to-cart-btn:disabled {
    background: var(--wahrb-gray-300);
    color: var(--wahrb-gray-500);
    cursor: not-allowed;
}

/* ==========================================================================
   Popover / Tooltip
   ========================================================================== */
.wahrb-calendar-popover {
    position: absolute;
    z-index: 1000;
    padding: 1rem;
    background: var(--wahrb-white);
    border: 1px solid var(--wahrb-gray-200);
    border-radius: var(--wahrb-radius-md);
    min-width: 200px;
    font-size: 0.875rem;
}

.wahrb-calendar-popover h4 {
    margin: 0 0 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--wahrb-gray-800);
}

.wahrb-calendar-popover p {
    margin: 0.25rem 0;
    color: var(--wahrb-gray-600);
}

.wahrb-calendar-popover-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--wahrb-gray-400);
    cursor: pointer;
    font-size: 1rem;
}

.wahrb-calendar-popover-close:hover {
    color: var(--wahrb-gray-600);
}

/* ==========================================================================
   Time Grid View
   ========================================================================== */
.fc .fc-timegrid-slot {
    height: 2.5rem;
}

.fc .fc-timegrid-slot-label {
    font-size: 0.75rem;
    color: var(--wahrb-gray-500);
}

.fc .fc-timegrid-now-indicator-line {
    border-color: var(--wahrb-danger);
}

.fc .fc-timegrid-now-indicator-arrow {
    border-color: var(--wahrb-danger);
    border-top-color: transparent;
    border-bottom-color: transparent;
}

/* ==========================================================================
   List View
   ========================================================================== */
.fc .fc-list {
    border-color: var(--wahrb-gray-200);
}

.fc .fc-list-sticky .fc-list-day>* {
    background: var(--wahrb-gray-50);
}

.fc .fc-list-event:hover td {
    background: var(--wahrb-gray-50);
}

.fc .fc-list-day-cushion {
    background: var(--wahrb-gray-50);
    font-weight: 600;
    color: var(--wahrb-gray-700);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    #wahrb-calendar-container {
        padding: 1rem;
    }

    .fc .fc-toolbar {
        flex-direction: column;
        gap: 0.75rem;
    }

    .fc .fc-toolbar-title {
        font-size: 1.125rem;
    }

    .fc .fc-button {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }

    .wahrb-calendar-legend {
        gap: 0.75rem;
    }

    .wahrb-legend-item {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .wahrb-date-picker-row {
        grid-template-columns: 1fr;
    }

    .fc .fc-daygrid-day-number {
        font-size: 0.75rem;
    }
}

/* ==========================================================================
   Phone Input with Country Selector (intl-tel-input)
   ========================================================================== */
.wahrb-phone-container {
    position: relative;
    width: 100%;
}

.wahrb-phone-container .iti {
    width: 100%;
}

.wahrb-phone-container .iti__flag-container {
    z-index: 10;
}

.wahrb-phone-container .iti__selected-flag {
    background: var(--wahrb-gray-50);
    border-right: 1px solid var(--wahrb-gray-200);
    padding: 0 8px 0 10px;
    border-radius: var(--wahrb-radius-md) 0 0 var(--wahrb-radius-md);
}

.wahrb-phone-container .iti__selected-flag:hover {
    background: var(--wahrb-gray-100);
}

.wahrb-phone-container input[type="tel"] {
    width: 100%;
    padding: 0.625rem 0.875rem 0.625rem 90px;
    /* Space for flag + dial code */
    font-size: 0.875rem;
    color: var(--wahrb-gray-800);
    background: var(--wahrb-white);
    border: 1px solid var(--wahrb-gray-300);
    border-radius: var(--wahrb-radius-md);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.wahrb-phone-container input[type="tel"]:focus {
    outline: none;
    border-color: var(--wahrb-primary);
    background: var(--wahrb-primary-light);
}

.wahrb-phone-hint {
    display: block;
    color: var(--wahrb-gray-500);
    font-size: 0.75rem;
    margin-top: 0.375rem;
}

/* Dropdown country list - ensure high z-index */
.iti__country-list {
    z-index: 10000 !important;
    background: var(--wahrb-white);
    border: 1px solid var(--wahrb-gray-200);
    border-radius: var(--wahrb-radius-md);
    max-height: 200px;
}

.iti__country {
    padding: 8px 10px;
}

.iti__country:hover,
.iti__country.iti__highlight {
    background: var(--wahrb-gray-50);
}

/* Dial code after flag */
.iti__selected-dial-code {
    color: var(--wahrb-gray-600);
    font-size: 0.875rem;
    margin-left: 4px;
}