/**
 * Calendar & Time Picker Popup Modal Styles
 * Blue Motors Southampton - Visible overlay popups for date/time selection
 *
 * @package BlueMotosSouthampton
 * @since 1.4.0
 */

/* ========================================
   POPUP MODAL OVERLAY
   ======================================== */

.bms-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.bms-modal-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease-out;
}

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

/* ========================================
   MODAL CONTENT BOX
   ======================================== */

.bms-modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    max-width: 400px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    position: relative;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   MODAL HEADER
   ======================================== */

.bms-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    color: white;
}

.bms-modal-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.bms-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.bms-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* ========================================
   MODAL BODY
   ======================================== */

.bms-modal-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

/* ========================================
   CALENDAR STYLES
   ======================================== */

.bms-calendar {
    width: 100%;
}

.bms-calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.bms-calendar-nav button {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.bms-calendar-nav button:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.bms-calendar-month {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
}

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

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

.bms-calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 2px solid transparent;
}

.bms-calendar-day:not(.disabled):not(.empty):hover {
    background: #dbeafe;
    border-color: #3b82f6;
}

.bms-calendar-day.today {
    background: #fef3c7;
    border-color: #f59e0b;
    font-weight: 600;
}

.bms-calendar-day.selected {
    background: #1d4ed8;
    color: white;
    border-color: #1d4ed8;
    font-weight: 600;
}

.bms-calendar-day.disabled {
    color: #d1d5db;
    cursor: not-allowed;
    background: #f9fafb;
}

.bms-calendar-day.other-month {
    color: #d1d5db;
}

.bms-calendar-day.empty {
    cursor: default;
}

/* ========================================
   TIME PICKER STYLES
   ======================================== */

.bms-time-picker {
    width: 100%;
}

.bms-time-picker-header {
    text-align: center;
    margin-bottom: 20px;
}

.bms-time-picker-header p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

.bms-time-picker-header .selected-date {
    font-size: 16px;
    font-weight: 600;
    color: #1d4ed8;
    margin-top: 4px;
}

.bms-time-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.bms-time-slot {
    padding: 14px 10px;
    text-align: center;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 15px;
    font-weight: 500;
}

.bms-time-slot:hover {
    background: #dbeafe;
    border-color: #3b82f6;
}

.bms-time-slot.selected {
    background: #1d4ed8;
    color: white;
    border-color: #1d4ed8;
}

.bms-time-slot.unavailable {
    color: #d1d5db;
    cursor: not-allowed;
    text-decoration: line-through;
    background: #f3f4f6;
}

.bms-time-loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

.bms-time-loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top-color: #1d4ed8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

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

/* ========================================
   MODAL FOOTER / CONFIRM BUTTON
   ======================================== */

.bms-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.bms-modal-footer button {
    width: 100%;
    padding: 14px 24px;
    background: #1d4ed8;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bms-modal-footer button:hover {
    background: #1e40af;
}

.bms-modal-footer button:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* ========================================
   TRIGGER BUTTONS STYLING
   ======================================== */

.bms-date-trigger,
.bms-time-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.bms-date-trigger:hover,
.bms-time-trigger:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.bms-date-trigger.has-value,
.bms-time-trigger.has-value {
    border-color: #10b981;
    background: #f0fdf4;
}

.bms-date-trigger .trigger-icon,
.bms-time-trigger .trigger-icon {
    font-size: 20px;
}

.bms-date-trigger .trigger-text,
.bms-time-trigger .trigger-text {
    flex: 1;
    margin-left: 12px;
}

.bms-date-trigger .trigger-arrow,
.bms-time-trigger .trigger-arrow {
    color: #6b7280;
    font-size: 18px;
}

/* ========================================
   SELECTION DISPLAY
   ======================================== */

.bms-selection-display {
    background: #f0fdf4;
    border: 2px solid #10b981;
    border-radius: 12px;
    padding: 16px 20px;
    margin-top: 16px;
    display: none;
}

.bms-selection-display.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.bms-selection-display .selection-label {
    font-size: 12px;
    color: #059669;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bms-selection-display .selection-value {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-top: 4px;
}

.bms-selection-display .selection-change {
    color: #1d4ed8;
    font-size: 14px;
    cursor: pointer;
    margin-top: 8px;
    display: inline-block;
}

.bms-selection-display .selection-change:hover {
    text-decoration: underline;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 480px) {
    .bms-modal-content {
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        margin-top: auto;
    }

    .bms-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .bms-modal-body {
        max-height: calc(95vh - 140px);
    }

    .bms-time-slots {
        grid-template-columns: repeat(2, 1fr);
    }

    .bms-calendar-day {
        font-size: 13px;
    }
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */

@media (prefers-color-scheme: dark) {
    .bms-modal-content {
        background: #1f2937;
    }

    .bms-modal-header {
        background: linear-gradient(135deg, #1e40af, #2563eb);
    }

    .bms-modal-body {
        color: #f9fafb;
    }

    .bms-calendar-month {
        color: #f9fafb;
    }

    .bms-calendar-weekday {
        color: #9ca3af;
    }

    .bms-calendar-day {
        color: #f9fafb;
    }

    .bms-calendar-day.disabled {
        color: #4b5563;
        background: #374151;
    }

    .bms-time-slot {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .bms-modal-footer {
        background: #374151;
        border-color: #4b5563;
    }
}
