:root {
    --southwest-blue: #304CB2;
    --southwest-blue-dark: #1a2d6b;
    --southwest-orange: #FFBF27;
    --southwest-red: #C8102E;
}

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #f5f7fa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
}

.text-southwest-blue {
    color: var(--southwest-blue) !important;
}

.text-southwest-orange {
    color: var(--southwest-orange) !important;
}

.bg-southwest-blue {
    background-color: var(--southwest-blue) !important;
}

.page {
    display: none !important;
    min-height: 100vh;
    padding-top: 20px;
    padding-bottom: 40px;
}

.page.active {
    display: block !important;
}

/* Special flex layout for login page */
.page.active.login-page {
    display: flex !important;
}

/* Page 1: Start Screen */
.start-screen {
    max-width: 500px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.logo-container {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.start-form {
    text-align: left;
}

.start-form .form-control {
    font-size: 1.2rem;
    padding: 15px 20px;
    border-radius: 12px;
    border: 2px solid #dee2e6;
}

.start-form .form-control:focus {
    border-color: var(--southwest-blue);
    box-shadow: 0 0 0 0.2rem rgba(48, 76, 178, 0.25);
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
    font-size: 1.3rem;
    border-radius: 12px;
    font-weight: 600;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

/* Page 2: Area Selection */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.area-card {
    border-radius: 16px;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.area-card.disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
    opacity: 0.7;
}

.area-card.active {
    background: linear-gradient(135deg, var(--southwest-blue), var(--southwest-blue-dark));
    color: white;
}

.area-card.active:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(48, 76, 178, 0.3);
}

/* Page 3: Main Inspector */
.inspector-header {
    background: white;
    padding: 10px 15px;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.counter-display {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--southwest-blue);
}

.dropdown-container {
    padding: 0 8px;
    margin-bottom: 15px;
}

.dropdown-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #6c757d;
    text-transform: uppercase;
    margin-bottom: 5px;
    text-align: center;
}

.big-select {
    font-size: 1.1rem;
    font-weight: 500;
    border: 2px solid #dee2e6;
    border-radius: 12px;
    background-color: white;
    height: auto !important;
    min-height: 280px;
}

.big-select option {
    padding: 12px 10px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.big-select option:checked {
    background: linear-gradient(135deg, var(--southwest-blue), var(--southwest-blue-dark));
    color: white;
}

.big-select optgroup {
    font-weight: 700;
    font-size: 0.9rem;
    color: #495057;
    padding: 8px 10px;
    background-color: #f8f9fa;
}

.condition-good {
    color: #28a745;
}

.condition-bad {
    color: #dc3545;
}

.log-button {
    font-size: 1.4rem;
    font-weight: 700;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    transition: transform 0.1s, box-shadow 0.1s;
}

.log-button:active {
    transform: scale(0.98);
}

.quick-fill-section {
    background: white;
    padding: 15px;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.quick-btn {
    font-size: 1rem;
    padding: 15px;
    border-radius: 12px;
    text-align: left;
}

.quick-btn i {
    margin-right: 10px;
}

/* Live Heatmap on Page 3 */
.live-heatmap-section {
    background: white;
    padding: 15px;
    border-radius: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.live-heatmap-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#liveHeatmapTable {
    font-size: 1rem;
    min-width: 100%;
}

#liveHeatmapTable th {
    padding: 8px 4px;
    font-size: 0.85rem;
}

#liveHeatmapTable th:first-child {
    position: sticky;
    left: 0;
    background: #343a40;
    z-index: 2;
}

#liveHeatmapTable td {
    cursor: pointer;
    width: 45px;
    height: 45px;
    font-weight: bold;
    padding: 0;
    vertical-align: middle;
    transition: transform 0.1s, opacity 0.1s;
}

#liveHeatmapTable td:first-child {
    position: sticky;
    left: 0;
    background: #343a40;
    color: white;
    z-index: 1;
    cursor: default;
}

#liveHeatmapTable td:hover:not(:first-child):not(.aisle-cell) {
    transform: scale(1.1);
    opacity: 0.9;
}

#liveHeatmapTable td:active:not(:first-child):not(.aisle-cell) {
    transform: scale(0.95);
}

.aisle-header {
    width: 15px !important;
    min-width: 15px;
    background: #f8f9fa !important;
}

.aisle-cell {
    background: #f8f9fa !important;
    cursor: default !important;
    width: 15px !important;
}

.seat-gray {
    background-color: #6c757d !important;
    color: white;
}

.seat-green {
    background-color: #28a745 !important;
    color: white;
}

.seat-yellow {
    background-color: #ffc107 !important;
    color: #212529;
}

.seat-red {
    background-color: #dc3545 !important;
    color: white;
}

.legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}

/* Page 4: Summary */
.score-card {
    border-radius: 20px;
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

.score-card .display-1 {
    font-size: 4rem;
}

.score-card.score-good {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.score-card.score-warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: #212529;
}

.score-card.score-bad {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

/* Heatmap */
.heatmap-container {
    overflow-x: auto;
    font-size: 0.75rem;
}

.heatmap-header {
    display: grid;
    grid-template-columns: 30px repeat(3, 1fr) 15px repeat(3, 1fr);
    text-align: center;
    font-weight: 700;
    color: #6c757d;
    padding: 5px 0;
    border-bottom: 2px solid #dee2e6;
}

.heatmap-header .aisle {
    color: #adb5bd;
}

.heatmap-row {
    display: grid;
    grid-template-columns: 30px repeat(3, 1fr) 15px repeat(3, 1fr);
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
}

.heatmap-row .row-num {
    font-weight: 600;
    color: #495057;
    padding: 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.heatmap-row .aisle {
    background-color: #f8f9fa;
}

.seat-cell {
    padding: 4px 2px;
    border-radius: 4px;
    margin: 2px;
    min-height: 24px;
}

.seat-cell.good { background-color: #28a745; }
.seat-cell.minor { background-color: #ffc107; }
.seat-cell.bad { background-color: #dc3545; }
.seat-cell.unchecked { background-color: #dee2e6; }

.heatmap-legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 0.8rem;
    color: #6c757d;
}

.legend-box {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    margin-right: 4px;
    vertical-align: middle;
}

/* PDF Button */
.btn-primary {
    background-color: var(--southwest-blue);
    border-color: var(--southwest-blue);
    font-size: 1.2rem;
    border-radius: 12px;
    font-weight: 600;
}

.btn-primary:hover {
    background-color: var(--southwest-blue-dark);
    border-color: var(--southwest-blue-dark);
}

/* Toast Styling */
.toast {
    font-size: 1rem;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .big-select {
        min-height: 220px;
        font-size: 1rem;
    }
    
    .big-select option {
        padding: 10px 8px;
    }
    
    .log-button {
        font-size: 1.2rem;
    }
    
    .quick-btn {
        font-size: 0.9rem;
        padding: 12px;
    }
    
    .score-card .display-1 {
        font-size: 3rem;
    }
}

/* iPad Specific */
@media (min-width: 768px) and (max-width: 1024px) {
    .big-select {
        min-height: 350px;
        font-size: 1.2rem;
    }
    
    .big-select option {
        padding: 14px 12px;
    }
    
    .log-button {
        font-size: 1.5rem;
        padding: 25px !important;
    }
    
    .quick-btn {
        font-size: 1.1rem;
        padding: 18px;
    }
}

/* Animations */
@keyframes logPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); background-color: #1e7e34; }
    100% { transform: scale(1); }
}

.log-animation {
    animation: logPulse 0.3s ease-out;
}
