/**
 * Schoolreisje Available Dates & Capacity Indicator Styling
 * 
 * Bestand: assets/css/available-dates.css
 * Versie: 1.2.0 FIXED
 */

/* ==========================================================================
   Capacity Indicator
   ========================================================================== */

.capacity-indicator {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: all 0.3s ease;
}

.capacity-indicator.warning {
    background: #fff3cd;
    border-color: #ffc107;
}

.capacity-indicator.danger {
    background: #f8d7da;
    border-color: #dc3545;
}

/* Status section */
.capacity-status {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 150px;
}

.status-icon {
    font-size: 18px;
    font-weight: bold;
    width: 24px;
    text-align: center;
}

.status-text {
    font-size: 14px;
    line-height: 1.3;
    font-weight: 500;
}

.capacity-indicator.warning .status-text {
    color: #856404;
}

.capacity-indicator.danger .status-text {
    color: #721c24;
}

/* Capacity bar section */
.capacity-bar-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.capacity-bar {
    flex: 1;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.capacity-fill {
    height: 100%;
    background: #28a745;
    transition: width 0.3s ease, background-color 0.3s ease;
    border-radius: 10px;
}

.capacity-fill.warning {
    background: #ffc107;
}

.capacity-fill.danger {
    background: #dc3545;
}

.capacity-numbers {
    font-size: 13px;
    font-weight: bold;
    color: #495057;
    min-width: 60px;
    text-align: right;
}

/* Loading state */
.capacity-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6c757d;
    font-size: 14px;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Form Integration
   ========================================================================== */

/* Ensure proper spacing with Gravity Forms */
.gform_wrapper .capacity-indicator {
    margin-top: 10px;
    margin-bottom: 10px;
}

/* Override any theme conflicts */
.capacity-indicator * {
    box-sizing: border-box;
}

/* Date field styling when showing capacity */
.available-dates-field .ginput_container_date {
    position: relative;
}

.available-dates-field.gfield_error .capacity-indicator {
    border-color: #dc3545;
    background: #f8d7da;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .capacity-indicator {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .capacity-status {
        justify-content: center;
        min-width: auto;
    }
    
    .capacity-bar-container {
        min-width: auto;
    }
    
    .status-text {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .capacity-indicator {
        padding: 12px;
        margin: 10px 0;
    }
    
    .status-icon {
        font-size: 16px;
    }
    
    .status-text {
        font-size: 13px;
    }
    
    .capacity-numbers {
        font-size: 12px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.capacity-indicator[aria-live="polite"] {
    /* Ensure screen readers announce changes */
}

.capacity-indicator:focus-within {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .capacity-indicator {
        border-width: 2px;
    }
    
    .capacity-indicator.warning {
        border-color: #000;
        background: #ffff00;
    }
    
    .capacity-indicator.danger {
        border-color: #000;
        background: #ff0000;
        color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .capacity-fill,
    .capacity-indicator {
        transition: none;
    }
    
    .loading-spinner {
        animation: none;
        border: 2px solid #007cba;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .capacity-indicator {
        border: 1px solid #000;
        background: #fff;
        color: #000;
    }
    
    .loading-spinner {
        display: none;
    }
}

/* ==========================================================================
   Debug Styles (only when ?debug=1 is in URL)
   ========================================================================== */

.schoolreisje-debug .capacity-indicator {
    border: 2px dashed #007cba;
    position: relative;
}

.schoolreisje-debug .capacity-indicator::before {
    content: "DEBUG MODE";
    position: absolute;
    top: -8px;
    right: 8px;
    background: #007cba;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .capacity-indicator {
        background: #343a40;
        border-color: #495057;
        color: #fff;
    }
    
    .capacity-indicator.warning {
        background: #664d03;
        border-color: #ffc107;
    }
    
    .capacity-indicator.danger {
        background: #721c24;
        border-color: #dc3545;
    }
    
    .capacity-bar {
        background: #495057;
    }
    
    .capacity-numbers {
        color: #ced4da;
    }
}