/**
 * Public Calendar Styles
 *
 * Styling for the public availability calendar and customer interactions
 *
 * @package MuscatHeights_Booking_System
 * @since 1.0.0
 */

/* ==========================================================================
   Base Calendar Container
   ========================================================================== */

.muscatheights-availability-calendar {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 100%;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

/* ==========================================================================
   Calendar Filters
   ========================================================================== */

.calendar-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-bottom: 1px solid #e9ecef;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #ffffff;
    font-size: 0.9rem;
    color: #495057;
    transition: all 0.2s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.filter-group select:hover {
    border-color: #adb5bd;
}

/* ==========================================================================
   Calendar Legend
   ========================================================================== */

.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #495057;
    transition: all 0.2s ease;
}

.legend-item:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.legend-color.available {
    background: #d1fae5;
    border-color: #065f46;
}

.legend-color.partially-booked {
    background: #fed7aa;
    border-color: #92400e;
}

.legend-color.unavailable {
    background: #fee2e2;
    border-color: #991b1b;
}

.legend-label {
    font-weight: 500;
}

/* ==========================================================================
   Calendar Main Container
   ========================================================================== */

#availability-calendar {
    min-height: 500px;
    padding: 20px;
    background: #ffffff;
}

/* Override FullCalendar default styles */
.fc {
    font-family: inherit;
}

.fc-header-toolbar {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.fc-toolbar-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #212529;
}

.fc-button-group .fc-button {
    border: 1px solid #667eea;
    background: #ffffff;
    color: #667eea;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin: 0 2px;
}

.fc-button-group .fc-button:hover {
    background: #667eea;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.fc-button-group .fc-button:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.4);
}

.fc-button-group .fc-button-active {
    background: #667eea;
    color: #ffffff;
    border-color: #667eea;
}

.fc-button-group .fc-button-active:hover {
    background: #5a67d8;
    border-color: #5a67d8;
}

/* ==========================================================================
   Calendar Grid Styling
   ========================================================================== */

.fc-theme-standard .fc-scrollgrid {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
}

.fc-theme-standard th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border-color: #5a67d8;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 8px;
}

.fc-theme-standard td {
    border-color: #f1f3f4;
}

.fc-daygrid-day {
    background: #ffffff;
    transition: all 0.2s ease;
    position: relative;
    min-height: 60px;
}

.fc-daygrid-day:hover {
    background: #f8f9fa;
}

.fc-daygrid-day.fc-day-today {
    background: rgba(102, 126, 234, 0.05);
    border: 2px solid #667eea;
}

.fc-daygrid-day.fc-day-past {
    background: #f8f9fa;
    color: #adb5bd;
}

.fc-daygrid-day.fc-day-past .fc-daygrid-day-number {
    color: #adb5bd;
}

.fc-daygrid-day-number {
    color: #495057;
    font-weight: 600;
    padding: 8px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
    background: #667eea;
    color: #ffffff;
}

.fc-daygrid-day-number:hover {
    background: #e9ecef;
    transform: scale(1.1);
}

/* ==========================================================================
   Availability Indicators
   ========================================================================== */

.availability-indicator {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e9ecef;
}

.fc-daygrid-day[data-availability="available"] .availability-indicator {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.fc-daygrid-day[data-availability="partially-booked"] .availability-indicator {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}

.fc-daygrid-day[data-availability="unavailable"] .availability-indicator {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

/* ==========================================================================
   Availability Events
   ========================================================================== */

.availability-event {
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.1);
    margin: 2px;
    position: relative;
    overflow: hidden;
}

.availability-event.availability-available {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-color: #059669;
}

.availability-event.availability-partial {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    color: #92400e;
    border-color: #d97706;
}

.availability-event.availability-unavailable {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border-color: #dc2626;
}

.availability-status {
    font-weight: 600;
    margin-bottom: 2px;
}

.availability-details {
    font-size: 0.7rem;
    opacity: 0.9;
}

.availability-percentage {
    font-weight: 500;
}

/* ==========================================================================
   Selection Styles
   ========================================================================== */

.fc-highlight {
    background: rgba(102, 126, 234, 0.2) !important;
    border: 2px solid #667eea !important;
}

.fc-daygrid-day.fc-day-selected {
    background: rgba(102, 126, 234, 0.15);
    border: 2px solid #667eea;
}

.fc-daygrid-day.fc-day-selected .fc-daygrid-day-number {
    background: #667eea;
    color: #ffffff;
    transform: scale(1.1);
}

/* ==========================================================================
   Selection Info Panel
   ========================================================================== */

.selection-info-container {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
    animation: slideInUp 0.3s ease-out;
}

.selection-info h4 {
    margin: 0 0 15px 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.selected-dates {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    line-height: 1.6;
}

.selection-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.selection-actions .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.selection-actions .btn-primary {
    background: #ffffff;
    color: #667eea;
}

.selection-actions .btn-primary:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.selection-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.selection-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.calendar-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
    border-radius: 12px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.calendar-loading p {
    margin: 15px 0 0 0;
    color: #495057;
    font-weight: 500;
}

/* ==========================================================================
   Notifications
   ========================================================================== */

.calendar-notification {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: slideInDown 0.3s ease-out;
}

.calendar-notification.notification-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.calendar-notification.notification-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.calendar-notification.notification-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fed7aa;
}

.calendar-notification.notification-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    opacity: 1;
}

/* ==========================================================================
   Calendar Themes
   ========================================================================== */

/* Modern Theme */
.theme-modern {
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.theme-modern .fc-theme-standard th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.theme-modern .fc-daygrid-day {
    border-radius: 8px;
    margin: 2px;
}

/* Minimal Theme */
.theme-minimal {
    border: 1px solid #e9ecef;
    box-shadow: none;
}

.theme-minimal .calendar-filters {
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
}

.theme-minimal .fc-theme-standard th {
    background: #f8f9fa;
    color: #495057;
}

.theme-minimal .fc-button-group .fc-button {
    border-color: #ced4da;
    color: #495057;
}

/* Dark Theme */
.theme-dark {
    background: #1a202c;
    color: #e2e8f0;
}

.theme-dark .calendar-filters {
    background: #2d3748;
    border-color: #4a5568;
}

.theme-dark .calendar-legend {
    background: #2d3748;
    border-color: #4a5568;
}

.theme-dark .legend-item {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
}

.theme-dark #availability-calendar {
    background: #1a202c;
}

.theme-dark .fc-theme-standard .fc-scrollgrid {
    border-color: #4a5568;
}

.theme-dark .fc-theme-standard th {
    background: #2d3748;
    color: #e2e8f0;
    border-color: #4a5568;
}

.theme-dark .fc-theme-standard td {
    border-color: #4a5568;
}

.theme-dark .fc-daygrid-day {
    background: #1a202c;
    color: #e2e8f0;
}

.theme-dark .fc-daygrid-day:hover {
    background: #2d3748;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .muscatheights-availability-calendar {
        margin: 0 10px;
        border-radius: 8px;
    }
    
    .calendar-filters {
        flex-direction: column;
        gap: 12px;
        padding: 15px;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .calendar-legend {
        padding: 12px 15px;
        gap: 8px;
    }
    
    .legend-item {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
    
    #availability-calendar {
        padding: 15px;
        min-height: 400px;
    }
    
    .fc-toolbar-title {
        font-size: 1.2rem;
    }
    
    .fc-button-group .fc-button {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .fc-daygrid-day {
        min-height: 50px;
    }
    
    .fc-daygrid-day-number {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }
    
    .availability-event {
        font-size: 0.7rem;
        padding: 2px 4px;
    }
    
    .selection-info-container {
        padding: 15px;
        margin-top: 15px;
    }
    
    .selection-actions {
        flex-direction: column;
    }
    
    .selection-actions .btn {
        width: 100%;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .muscatheights-availability-calendar {
        margin: 0 5px;
    }
    
    .calendar-filters {
        padding: 12px;
    }
    
    .calendar-legend {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }
    
    #availability-calendar {
        padding: 12px;
    }
    
    .fc-header-toolbar {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .fc-toolbar-title {
        font-size: 1.1rem;
        order: -1;
    }
    
    .fc-daygrid-day {
        min-height: 45px;
    }
    
    .fc-daygrid-day-number {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }
    
    .availability-indicator {
        width: 6px;
        height: 6px;
        bottom: 2px;
    }
    
    .selection-info h4 {
        font-size: 1rem;
    }
    
    .selected-dates {
        font-size: 0.9rem;
        padding: 12px;
    }
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes slideInUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .calendar-filters,
    .calendar-legend,
    .selection-info-container,
    .calendar-notification,
    .calendar-loading {
        display: none !important;
    }
    
    .muscatheights-availability-calendar {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .fc-button-group {
        display: none;
    }
    
    .fc-theme-standard .fc-scrollgrid {
        border-color: #000;
    }
    
    .fc-theme-standard th,
    .fc-theme-standard td {
        border-color: #000;
        background: #fff !important;
        color: #000 !important;
    }
    
    .availability-event {
        border: 1px solid #000 !important;
        background: #fff !important;
        color: #000 !important;
    }
}

/* ==========================================================================
   Accessibility Enhancements
   ========================================================================== */

.fc-daygrid-day[tabindex] {
    outline: none;
}

.fc-daygrid-day[tabindex]:focus {
    outline: 2px solid #667eea;
    outline-offset: -2px;
}

.fc-button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.selection-actions .btn:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .fc-daygrid-day,
    .availability-event,
    .legend-item {
        border-width: 2px;
    }
    
    .fc-highlight {
        border-width: 3px !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .fc-daygrid-day,
    .fc-button-group .fc-button,
    .legend-item,
    .selection-actions .btn,
    .loading-spinner {
        transition: none !important;
        animation: none !important;
    }
}