/* Weather Models Page Styles */
/* Optimized for performance and mobile responsiveness */

.weather-models-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

/* Page Header */
.page-header {
    margin-bottom: 1rem;
}

.page-header h1 {
    color: #1e3a5f;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

.page-header .subtitle {
    color: #64748b;
    font-size: 0.95rem;
    margin: 0;
}

/* Controls Bar */
.controls-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.controls-bar label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-right: 0.5rem;
}

.controls-bar select {
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    color: #1e293b;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23475569' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.controls-bar select:hover {
    border-color: #94a3b8;
}

.controls-bar select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.model-selector,
.layer-selector {
    display: flex;
    align-items: center;
}

/* View Toggle Buttons */
.view-toggle {
    display: flex;
    gap: 0.25rem;
    background: white;
    padding: 0.25rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.view-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.view-btn:hover {
    background: #f1f5f9;
    color: #334155;
}

.view-btn.active {
    background: #3b82f6;
    color: white;
}

.view-btn svg {
    flex-shrink: 0;
}

/* Fullscreen Button */
.fullscreen-btn {
    margin-left: auto;
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-btn:hover {
    background: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}

/* Map Container */
.map-wrapper {
    position: relative;
    width: 100%;
    height: 65vh;
    min-height: 400px;
    max-height: 800px;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    touch-action: auto;
}

.map-wrapper.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-height: none;
    z-index: 9999;
    border-radius: 0;
}

/* Windy Embed */
.windy-embed {
    width: 100%;
    height: 100%;
    border: none;
    touch-action: auto;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s;
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    color: #94a3b8;
    margin-top: 1rem;
    font-size: 0.95rem;
}

/* Mobile Touch Hint */
.mobile-hint {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    z-index: 20;
    animation: fadeInUp 0.3s ease;
}

.mobile-hint.hidden {
    display: none;
}

.dismiss-hint {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    cursor: pointer;
    font-weight: 500;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Info Panel */
.info-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.info-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
}

.info-card h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1e3a5f;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
}

.info-card h3 svg {
    color: #3b82f6;
}

.info-card p {
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0 0 0.75rem 0;
}

.model-list,
.tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.model-list li,
.tips-list li {
    position: relative;
    padding: 0.5rem 0 0.5rem 1.25rem;
    color: #475569;
    font-size: 0.875rem;
    line-height: 1.5;
    border-bottom: 1px solid #f1f5f9;
}

.model-list li:last-child,
.tips-list li:last-child {
    border-bottom: none;
}

.model-list li::before,
.tips-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.85rem;
    width: 6px;
    height: 6px;
    background: #3b82f6;
    border-radius: 50%;
}

.model-list li strong,
.tips-list li strong {
    color: #1e293b;
}

/* Alerts Card */
.alerts-card h3 .alert-icon {
    color: #ef4444;
}

.alerts-card .alert-item {
    padding: 0.75rem;
    background: #fef2f2;
    border-left: 3px solid #ef4444;
    border-radius: 0 8px 8px 0;
    margin-bottom: 0.5rem;
}

.alerts-card .alert-item:last-child {
    margin-bottom: 0;
}

.alerts-card .alert-item.warning {
    background: #fffbeb;
    border-left-color: #f59e0b;
}

.alerts-card .alert-item.watch {
    background: #fefce8;
    border-left-color: #eab308;
}

.alerts-card .alert-type {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1e293b;
}

.alerts-card .alert-area {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 0.25rem;
}

/* Attribution */
.attribution {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    text-align: center;
}

.attribution p {
    color: #64748b;
    font-size: 0.8rem;
    margin: 0;
}

.attribution a {
    color: #3b82f6;
    text-decoration: none;
}

.attribution a:hover {
    text-decoration: underline;
}

/* ==================== */
/* Mobile Optimizations */
/* ==================== */

@media (max-width: 768px) {
    .weather-models-container {
        padding: 0.75rem;
    }

    .page-header h1 {
        font-size: 1.4rem;
    }

    .page-header .subtitle {
        font-size: 0.85rem;
    }

    /* Controls become more compact */
    .controls-bar {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .controls-bar label {
        display: none; /* Hide labels on mobile */
    }

    .controls-bar select {
        padding: 0.5rem 1.75rem 0.5rem 0.5rem;
        font-size: 0.85rem;
        min-width: 100px;
    }

    .model-selector,
    .layer-selector {
        flex: 1;
    }

    .model-selector select,
    .layer-selector select {
        width: 100%;
    }

    /* Hide text labels on view buttons */
    .view-btn .btn-text {
        display: none;
    }

    .view-btn {
        padding: 0.5rem;
    }

    /* Map takes more vertical space on mobile */
    .map-wrapper {
        height: 55vh;
        min-height: 350px;
        border-radius: 8px;
    }

    /* Info panel stacks vertically */
    .info-panel {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-top: 1rem;
    }

    .info-card {
        padding: 1rem;
    }

    .info-card h3 {
        font-size: 0.95rem;
    }

    .model-list li,
    .tips-list li {
        font-size: 0.8rem;
        padding: 0.4rem 0 0.4rem 1rem;
    }

    .attribution {
        padding: 0.75rem;
        margin-top: 1rem;
    }

    .attribution p {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .page-header h1 {
        font-size: 1.25rem;
    }

    .controls-bar {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .model-selector,
    .layer-selector {
        flex: 1 1 45%;
    }

    .view-toggle {
        order: 3;
        flex: 0;
    }

    .fullscreen-btn {
        order: 4;
        margin-left: 0;
    }

    .map-wrapper {
        height: 50vh;
        min-height: 300px;
    }

    /* Simplify tips on very small screens */
    .info-card p {
        font-size: 0.85rem;
    }
}

/* Landscape phone optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .map-wrapper {
        height: 70vh;
        min-height: 250px;
    }

    .info-panel {
        display: none; /* Hide info on landscape phone to maximize map */
    }

    .page-header {
        display: none;
    }

    .controls-bar {
        margin-bottom: 0.5rem;
    }
}

/* Tablet optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .map-wrapper {
        height: 60vh;
    }

    .info-panel {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large screens */
@media (min-width: 1400px) {
    .weather-models-container {
        max-width: 1600px;
    }

    .map-wrapper {
        height: 70vh;
        max-height: 900px;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner {
        animation: none;
    }

    .loading-overlay,
    .mobile-hint {
        animation: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .controls-bar {
        border: 2px solid #000;
    }

    .info-card {
        border: 2px solid #000;
    }

    .view-btn.active {
        background: #000;
    }
}

/* Print styles */
@media print {
    .controls-bar,
    .map-wrapper,
    .fullscreen-btn {
        display: none;
    }

    .info-panel {
        display: block;
    }

    .info-card {
        break-inside: avoid;
        margin-bottom: 1rem;
    }
}
