/**
 * Charleston Airport Parking Styles
 * WCAG 2.1 AA compliant
 * Version 1.4.0 - Production Ready with Enhanced Error Handling
 */

/* Main container */
.chs-parking-container {
    font-family: "Brandon Grotesque", "Segoe UI", Roboto, -apple-system, sans-serif;
    color: #0F0F10;
    padding: 0;
    box-sizing: border-box;
    width: 100%;
}

/* Common styles for all items */
.chs-parking-item, .chs-parking-valet-item {
    margin-bottom: 16px;
    width: 100%;
}

/* Layout container - changes based on available width */
.chs-parking-normal-items {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}

/* Two-column layout (default for desktop) */
@media (min-width: 580px) {
    .chs-parking-container:not(.single-column):not(.single-column-fixed) .chs-parking-item {
        width: calc(50% - 10px);
    }
    
    .chs-parking-container:not(.single-column):not(.single-column-fixed) .chs-parking-item:nth-child(odd) {
        margin-right: 20px;
    }
    
    /* Valet stays in left column */
    .chs-parking-container:not(.single-column):not(.single-column-fixed) .chs-parking-valet-item {
        width: calc(50% - 10px);
    }
}

/* Single column layout - for explicitly marked containers, or containers narrower than 580px */
.chs-parking-container.single-column .chs-parking-normal-items,
.chs-parking-container.single-column-fixed .chs-parking-normal-items {
    flex-direction: column;
}

.chs-parking-container.single-column .chs-parking-item,
.chs-parking-container.single-column .chs-parking-valet-item,
.chs-parking-container.single-column-fixed .chs-parking-item,
.chs-parking-container.single-column-fixed .chs-parking-valet-item {
    width: 100%;
}

/* Force valet to end when stacked */
.chs-parking-container.single-column .chs-parking-valet-item,
.chs-parking-container.single-column-fixed .chs-parking-valet-item {
    order: 5;
}

/* Single column layout (for containers narrower than 580px) */
@media (max-width: 579px) {
    .chs-parking-normal-items {
        flex-direction: column;
    }
    
    .chs-parking-item, .chs-parking-valet-item {
        width: 100%;
    }
    
    /* Force valet to end when stacked */
    .chs-parking-valet-item {
        order: 5;
    }
}

/* Double column forced layout */
.chs-parking-container.double-column .chs-parking-item {
    width: calc(50% - 10px);
}

.chs-parking-container.double-column .chs-parking-item:nth-child(odd) {
    margin-right: 20px;
}

.chs-parking-container.double-column .chs-parking-valet-item {
    width: calc(50% - 10px);
}

/* Header row containing label and status */
.chs-parking-row-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    width: 100%;
}

/* Parking label */
.chs-parking-label {
    font-size: 16px;
    font-weight: 500;
    line-height: 14px;
    color: #0F0F10;
    margin: 0;
    padding-bottom: 4px;
}

/* Bar container */
.chs-parking-bar-container {
    height: 10px;
    background-color: #EAECF0;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 0;
    margin-bottom: 16px;
    width: 100%;
}

/* Actual bar */
.chs-parking-bar {
    height: 100%;
    width: 0;
    transition: width 0.5s ease;
    border-radius: 5px;
}

/* Status text */
.chs-parking-status {
    font-size: 16px;
    font-weight: 500;
    line-height: 14px;
    text-align: right;
    margin: 0;
    padding-bottom: 4px;
}

/* Status colors */
.status-green {
    background-color: #008a60;
}

.status-orange {
    background-color: #ff9955;
}

.status-red {
    background-color: #DF4661;
}

.status-grey {
    background-color: #75787B;
}

/* Valet status styling */
.valet-available {
    color: #008a60 !important;
    text-align: right;
    font-weight: 500;
}

.valet-closed {
    color: #DF4661 !important;
    text-align: right;
    font-weight: 500;
}

/* Focus styles for accessibility */
.chs-parking-item:focus-within,
.chs-parking-valet-item:focus-within {
    outline: 2px solid #0F0F10;
    outline-offset: 2px;
}

/* Screen reader only text */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
}

/* Warning and error message styles */
.chs-parking-warning {
    background: #fff3cd !important;
    border: 1px solid #ffeaa7 !important;
    color: #856404 !important;
    padding: 8px !important;
    margin-bottom: 10px !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
}

.chs-parking-error {
    background: #f8d7da !important;
    border: 1px solid #f5c6cb !important;
    color: #721c24 !important;
    padding: 10px !important;
    margin-bottom: 10px !important;
    border-radius: 4px !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
}

.chs-parking-warning strong,
.chs-parking-error strong {
    font-weight: 600;
}

/* Ensure messages are readable on all backgrounds */
.chs-parking-warning,
.chs-parking-error {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 10;
    position: relative;
}

/* Smaller font on mobile */
@media screen and (max-width: 480px) {
    .chs-parking-label,
    .chs-parking-status {
        font-size: 15px;
    }
    
    .chs-parking-warning,
    .chs-parking-error {
        font-size: 13px !important;
        padding: 6px !important;
    }
}