@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    user-select: none;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #f5f5f7;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* --- Header --- */
.header {
    background: linear-gradient(135deg, #5856d6 0%, #e7eef6 100%);
    color: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.header-logo {
    height: 50px;
    width: auto;
}

.header-content {
    flex: 1;
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 2px;
    line-height: 1.2;
}

.header p {
    opacity: 0.9;
    font-size: 11px;
    line-height: 1.2;
}

.beta-tag {
    font-size: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 8px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    font-weight: 700;
    letter-spacing: 0.5px;
}

.beta-ribbon {
    position: absolute;
    top: 22px;
    right: -35px;
    width: 130px;
    background: #5856d6;
    color: white;
    padding: 3px 0;
    font-size: 9px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transform: rotate(45deg);
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 100;
    pointer-events: none;
}

/* --- Controles Estilizados --- */
.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    padding: 28px;
    background: #fafafa;
    border-bottom: 1px solid #e5e5e7;
}

.control-group {
    display: flex;
    flex-direction: column;
}

.control-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #48484a;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Regla Maestra: Altura 42px y Sombra Suave */
.control-group select,
.control-group input,
.search-button,
.model-comparison-toggle {
    height: 42px;
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 10px;
    border: 1px solid #d2d2d7;
    background: white;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

select option {
    color: #1d1d1f;
}

/* Efecto al hacer foco o pasar el ratón */
.control-group select:hover,
.control-group input:hover {
    border-color: #86868b;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

/* Ajustes del Buscador */
.search-wrapper {
    display: flex;
}

.search-wrapper input {
    flex: 1;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
}

.search-button {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background: #007aff;
    color: white;
    border-color: #007aff;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-shadow: 0 4px 8px rgba(0, 122, 255, 0.2);
}

.search-button:hover {
    background: #0051d5;
    transform: translateY(-1px);
}

#forecast-time-group {
    grid-column: 1 / -1;
}

#forecast-time-select {
    width: 100%;
    min-width: 0;
}

/* --- Main Content --- SIDEBAR A LA IZQUIERDA */
.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    min-height: 600px;
}

.map-section {
    position: relative;
    height: 700px;
    padding: 2px;
    box-sizing: border-box;
}

#map {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    overflow: hidden;
}

.sidebar {
    background: white;
    border-right: 1px solid #e5e5e7;
    overflow-y: auto;
    max-height: 700px;
    order: -1;
}

/* --- Sidebar Tabs --- */
.tabs {
    display: flex;
    border-bottom: 1px solid #e5e5e7;
    background: #fafafa;
}

.tab {
    flex: 1;
    padding: 14px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    color: #86868b;
    border-bottom: 2px solid transparent;
}

.tab.active {
    color: #007aff;
    border-bottom-color: #007aff;
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

/* --- Botón Comparar Modelos --- */
.model-comparison-toggle {
    width: 100%;
    justify-content: center;
    margin-bottom: 16px;
    background: #007aff;
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.25);
}

.model-comparison-toggle:hover {
    background: #0051d5;
    transform: translateY(-1px);
}

.model-comparison-container {
    display: none;
    background: white;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid #e5e5e7;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.model-comparison-container.active {
    display: block;
}

/* --- Weather Cards --- */
.weather-card {
    background: #f5f5f7ca;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.weather-card h4 {
    font-size: 11px;
    color: #86868b;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.weather-value {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.weather-label {
    color: #1d1d1f;
    font-size: 14px;
}

.weather-data {
    color: #007aff;
    font-weight: 600;
    font-size: 14px;
}

/* --- Timeline --- */
.timeline-container {
    padding: 16px 20px;
    background: white;
    border-bottom: 1px solid #e5e5e7;
}

.timeline-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.timeline-nav-btn {
    background: #f5f5f7;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeline-nav-btn:hover {
    background: #e5e5e7;
}

.timeline-current-time {
    font-size: 13px;
    font-weight: 600;
    color: #1d1d1f;
}

.timeline-model-info {
    font-size: 10px;
    color: #007aff;
}

.timeline-wrapper {
    overflow-x: auto;
    padding: 10px 0 20px 0;
    scrollbar-width: thin;
}

.timeline-track {
    display: flex;
    gap: 6px;
    padding: 0 10px;
    min-width: max-content;
}

.timeline-point {
    width: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.timeline-point:hover {
    transform: translateY(-2px);
}

.timeline-point-bar {
    width: 100%;
    height: 70px;
    border-radius: 6px;
    background: #f5f5f7;
    position: relative;
    border: 2px solid transparent;
}

.timeline-point.active .timeline-point-bar {
    border-color: #007aff;
    box-shadow: 0 0 8px rgba(0, 122, 255, 0.2);
}

/* --- Timeline Bars --- */
.timeline-bar-layer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 4px;
}

.timeline-bar-temp {
    height: 100%;
    opacity: 0.3;
}

.timeline-bar-temp.cold {
    background: #5ac8fa;
}

.timeline-bar-temp.moderate {
    background: #34c759;
}

.timeline-bar-temp.hot {
    background: #ff3b30;
}

.timeline-bar-rain {
    background: linear-gradient(to top, #007aff, rgba(0, 122, 255, 0.5));
    opacity: 0.7;
}

.timeline-bar-snow {
    background: linear-gradient(to top, #5ac8fa, rgba(90, 200, 250, 0.5));
    opacity: 0.7;
}

.timeline-bar-wind {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 2px;
}

.timeline-bar-wind.strong {
    background: #ff9500;
}

.timeline-bar-wind.very-strong {
    background: #ff3b30;
}

.timeline-point-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: #1d1d1f;
    z-index: 10;
}

.timeline-point-time {
    font-size: 11px;
    font-weight: 600;
    color: #1d1d1f;
    margin-top: 6px;
}

.timeline-point-temp {
    font-size: 13px;
    font-weight: 700;
    color: #007aff;
    margin-top: 2px;
}

.timeline-point-label {
    font-size: 9px;
    color: #86868b;
    text-transform: uppercase;
    margin-top: 2px;
}

.timeline-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
    font-size: 12px;
    margin-bottom: 8px;
    z-index: 1000;
}

.timeline-point:hover .timeline-tooltip {
    display: block;
}

.timeline-info {
    flex: 1;
}

.timeline-action-btn {
    background: #f5f5f7;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.timeline-action-btn:hover {
    background: #e5e5e7;
}

.timeline-action-btn[aria-pressed="true"] {
    background: #007aff;
    border-color: #007aff;
}

.timeline-action-btn[aria-pressed="true"] .material-symbols-outlined {
    color: white;
}

/* --- Forecast Days --- */

/* --- Forecast Days --- */
.forecast-days {
    background: #f5f5f7ca;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(0,0,0,0.03);
}

.forecast-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.forecast-day-name {
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
    text-transform: capitalize;
}

.forecast-day-date {
    font-size: 12px;
    color: #86868b;
    text-transform: capitalize;
}

.forecast-day-temps {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.forecast-temp {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.forecast-temp-label {
    font-size: 10px;
    color: #86868b;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.forecast-temp-value {
    font-size: 20px;
    font-weight: 700;
}

.forecast-temp-value.max { color: #ff3b30; }
.forecast-temp-value.min { color: #007aff; }

.forecast-day-details {
    display: flex;
    gap: 12px;
}

.forecast-detail {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background: white;
    border-radius: 6px;
}

.forecast-detail-value {
    font-size: 13px;
    font-weight: 600;
    color: #1d1d1f;
}
/* --- Favorites --- */
.add-favorite {
    width: 100%;
    padding: 14px;
    background: #007aff;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.add-favorite:hover {
    background: #0051d5;
    transform: translateY(-1px);
}

.favorite-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f5f5f7;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.favorite-item:hover {
    background: #e5e5e7;
}

.favorite-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.favorite-name {
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
}

.favorite-coords {
    font-size: 11px;
    color: #86868b;
}

.favorite-delete {
    background: none;
    border: none;
    color: #ff3b30;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.favorite-delete:hover {
    background: rgba(255, 59, 48, 0.1);
}

/* --- Model Comparison --- */
.comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.comparison-title {
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comparison-confidence {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
}

.comparison-confidence-badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.comparison-confidence-badge.high {
    background: #34c759;
}

.comparison-confidence-badge.medium {
    background: #ff9500;
}

.comparison-confidence-badge.low {
    background: #ff3b30;
}

.comparison-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.comparison-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 6px;
    align-items: center;
}

.comparison-row.comparison-header {
    font-weight: 600;
    color: #86868b;
    font-size: 11px;
    margin-bottom: 4px;
}

.comparison-row.comparison-header .comparison-cell {
    background: transparent;
    text-align: center;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-cell {
    padding: 10px 8px;
    background: #f5f5f7;
    border-radius: 6px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
}

.comparison-model-name {
    text-align: left;
    font-weight: 700;
    color: #1d1d1f;
}

.comparison-loading {
    text-align: center;
    padding: 40px 20px;
}

.comparison-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #007aff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

/* --- Loading Overlay --- */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.98);
    padding: 36px 56px;
    border-radius: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    text-align: center;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f0f0f0;
    border-top: 3px solid #007aff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

/* --- Badge global del modelo --- */
.global-model-badge {
    background: transparent;
    color: #1d1d1f;
    padding: 8px 0;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    border: none;
    box-shadow: none;
}

.global-model-badge .material-symbols-outlined {
    font-size: 16px;
    color: #007aff;
}

/* --- Custom Marker --- */
.custom-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Leaflet Popup Customization --- */
.leaflet-popup-content-wrapper {
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
    margin: 0;
    font-family: 'Inter', sans-serif;
    max-width: 280px;
}

.leaflet-popup-tip {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* --- MODAL DE DETALLES DEL TIEMPO --- */
.popup-details-btn {
    background: #007aff;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.popup-details-btn:hover {
    background: #0051d5;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.weather-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh; /* Dynamic viewport height para móviles */
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.weather-modal.active {
    display: flex;
}

.weather-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.weather-modal-content {
    position: relative;
    background: white;
    border-radius: 20px;
    max-width: 650px;
    width: calc(100% - 40px);
    max-height: calc(85vh - 40px);
    max-height: calc(85dvh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease;
    z-index: 10001;
    margin: 0 auto;
    -webkit-overflow-scrolling: touch; /* Suavizado en iOS */
}

.weather-modal-close {
    position: sticky;
    top: 16px;
    right: 16px;
    float: right;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.weather-modal-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.weather-modal-close .material-symbols-outlined {
    font-size: 20px;
    color: #1d1d1f;
}

#weather-modal-body {
    padding: 40px 32px 32px;
}

/* Selector de fecha/hora en el modal */
.modal-time-selector {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #f5f5f7 0%, #e5e5e7 100%);
    border-radius: 16px;
    margin-bottom: 24px;
    width: 100%;
}

.modal-time-display {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.modal-time-date {
    font-size: 15px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 4px;
    text-transform: capitalize;
    text-align: center;
}

.modal-time-indicator {
    font-size: 12px;
    color: #86868b;
    font-weight: 500;
    text-align: center;
}

/* Slider container */
.modal-time-slider {
    width: 100%;
    max-width: 620px;
    position: relative;
}

.modal-time-slider input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 18px;
    background: transparent;
    cursor: pointer;
}

.modal-time-slider input[type="range"]:focus {
    outline: none;
}

.modal-time-slider input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: linear-gradient(90deg, rgba(0, 122, 255, 0.14) 0%, rgba(90, 200, 250, 0.14) 100%);
    border-radius: 999px;
}

.modal-time-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border: 3px solid #007aff;
    border-radius: 50%;
    box-shadow: 0 6px 14px rgba(0, 122, 255, 0.16);
    margin-top: -6px;
}

.modal-time-slider input[type="range"]::-moz-range-track {
    height: 6px;
    background: linear-gradient(90deg, rgba(0, 122, 255, 0.14) 0%, rgba(90, 200, 250, 0.14) 100%);
    border-radius: 999px;
}

.modal-time-slider input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #ffffff;
    border: 3px solid #007aff;
    border-radius: 50%;
    box-shadow: 0 6px 14px rgba(0, 122, 255, 0.16);
}

.modal-time-display #modal-time-current.preview {
    color: #007aff;
    transform: translateY(-2px);
}

.modal-time-btn {
    background: white;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.modal-time-btn:hover:not(.disabled) {
    background: #007aff;
    border-color: #007aff;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.modal-time-btn:hover:not(.disabled) .material-symbols-outlined {
    color: white;
}

.modal-time-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: #f5f5f7;
}

.modal-time-btn .material-symbols-outlined {
    font-size: 24px;
    color: #1d1d1f;
    transition: color 0.2s ease;
}

/* Resumen del clima en el modal */
.modal-weather-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 2px solid #f5f5f7;
}

.modal-weather-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 140px;
    background: linear-gradient(135deg, #f5f5f7 0%, #e5e5e7 100%);
    border-radius: 20px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    order: 2;
}

.modal-weather-icon .material-symbols-outlined {
    font-size: 80px !important;
}

.modal-weather-main {
    flex: 1;
    order: 1;
}

.modal-location {
    font-size: 28px;
    font-weight: 700;
    color: #1d1d1f;
    margin: 0 0 12px 0;
}

.modal-date {
    font-size: 14px;
    color: #86868b;
    margin-bottom: 8px;
    text-transform: capitalize;
}

.modal-model-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 600;
}

.modal-model-badge .material-symbols-outlined {
    font-size: 16px;
    color: #007aff;
}

.modal-weather-desc {
    font-size: 16px;
    color: #1d1d1f;
    font-weight: 500;
    margin-bottom: 16px;
}

.modal-temp-main {
    font-size: 56px;
    font-weight: 700;
    color: #007aff;
    line-height: 1;
    margin-bottom: 8px;
}

.modal-temp-feels {
    font-size: 16px;
    color: #86868b;
}

/* Grid de detalles del modal */
.modal-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.modal-detail-card {
    background: #f5f5f7;
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-detail-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 16px;
}

.modal-detail-header .material-symbols-outlined {
    font-size: 20px;
    color: #007aff;
}

.modal-detail-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.modal-detail-item:last-child {
    border-bottom: none;
}

.modal-detail-item .label {
    font-size: 14px;
    color: #86868b;
}

.modal-detail-item .value {
    font-size: 16px;
    font-weight: 600;
    color: #007aff;
}

/* Scrollbar para el contenido del modal */
.weather-modal-content::-webkit-scrollbar {
    width: 8px;
}

.weather-modal-content::-webkit-scrollbar-track {
    background: #f5f5f7;
    border-radius: 10px;
}

.weather-modal-content::-webkit-scrollbar-thumb {
    background: #d2d2d7;
    border-radius: 10px;
}

.weather-modal-content::-webkit-scrollbar-thumb:hover {
    background: #86868b;
}

/* --- Modal de Bienvenida --- */
#welcome-modal {
    z-index: 10002;
}

#welcome-modal .weather-modal-content {
    position: relative;
    padding: 0;
}

#welcome-modal .weather-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10003;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

#welcome-modal .weather-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

#welcome-modal .weather-modal-close .material-symbols-outlined {
    color: white;
}

#welcome-modal-body {
    padding: 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.welcome-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 32px 32px;
    background: linear-gradient(135deg, #5856d6 0%, #007aff 50%, #5ac8fa 100%);
    position: relative;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.welcome-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

.welcome-header .material-symbols-outlined {
    font-size: 64px;
    color: white;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }
}

.welcome-title {
    font-size: 28px;
    font-weight: 700;
    color: white;
    margin: 0;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    letter-spacing: -0.5px;
}

.welcome-content {
    text-align: left;
    padding: 32px;
    background: white;
}

.welcome-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #f5f5f7 0%, #ffffff 100%);
    border-radius: 16px;
    border: 1px solid #e5e5e7;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.welcome-step::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, #5856d6 0%, #007aff 100%);
    border-radius: 0 4px 4px 0;
}

.welcome-step:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.1);
    border-color: #007aff;
}

.welcome-step-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #5856d6 0%, #007aff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(88, 86, 214, 0.3);
}

.welcome-step-icon .material-symbols-outlined {
    font-size: 24px;
    color: white;
}

.welcome-step-content {
    flex: 1;
}

.welcome-step-content p {
    font-size: 15px;
    line-height: 1.7;
    color: #1d1d1f;
    margin: 0;
    font-weight: 400;
}

.welcome-step-content strong {
    color: #007aff;
    font-weight: 600;
}

.welcome-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 24px 32px 32px;
    background: white;
    border-top: 1px solid #e5e5e7;
}

.welcome-button {
    background: linear-gradient(135deg, #007aff 0%, #0051d5 100%);
    color: white;
    border: none;
    border-radius: 14px;
    padding: 16px 36px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.welcome-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.welcome-button:hover::before {
    width: 300px;
    height: 300px;
}

.welcome-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 122, 255, 0.4);
}

.welcome-button:active {
    transform: translateY(0);
}

.welcome-button .material-symbols-outlined {
    font-size: 22px;
    position: relative;
    z-index: 1;
}

/* --- Footer --- */
.footer .material-profile {
    display: inline-flex !important;
    align-items: center !important;
    text-decoration: none;
    gap: 8px;
    font-family: 'Inter', sans-serif;
    color: #1d1d1f;
    vertical-align: middle;
}

.footer .material-profile .bi-twitter-x {
    display: block;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.footer .material-profile .username {
    line-height: 1;
    font-size: 10px;
    font-weight: 500;
    color: #86868b;
}

.footer a.material-profile:hover .username {
    color: #0051d5;
}

.footer {
    background: #fafafa;
    border-top: 1px solid #e5e5e7;
    padding: 20px;
    min-height: 50px;
}

.footer-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.footer-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer h3 {
    font-size: 11px;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0 0 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer p {
    font-size: 10px;
    margin: 0;
    color: #86868b;
    line-height: 1.5;
}

.footer a {
    color: #007aff;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: #0051d5;
    text-decoration: underline;
}

.footer-copyright {
    text-align: right;
}

/* Ping-pong indicator styling */
.pingpong-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    font-size: 16px;
    color: #007aff;
    opacity: 0.6;
    transition: transform 180ms ease, opacity 180ms ease;
}

.pingpong-indicator.reverse {
    transform: scaleX(-1);
}

.pingpong-indicator.hidden {
    display: none;
}

/* Segmented control styles */
.segmented-control {
    display: inline-flex;
    align-items: center;
    background: #f5f5f7;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #d2d2d7;
}

.segmented-control input[type="radio"] {
    display: none;
}

.segmented-control label {
    padding: 6px 10px;
    margin: 0;
    cursor: pointer;
    font-size: 13px;
    color: #1d1d1f;
    user-select: none;
    transition: background 120ms ease, color 120ms ease;
}

.segmented-control input[type="radio"]:checked+label {
    background: #007aff;
    color: #fff;
}

.segmented-control label:not(:last-of-type) {
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.segmented-control label:focus {
    outline: 2px solid rgba(0, 122, 255, 0.18);
    outline-offset: 2px;
}

/* Timeline highlight animation when modal opens */
.timeline-point.highlight {
    animation: highlightPulse 900ms ease-in-out;
}

@keyframes highlightPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0.35);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(0, 122, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 122, 255, 0);
    }
}

/* Slider tooltip */
.slider-tooltip {
    position: absolute;
    transform: translate(-50%, -8px);
    background: #007aff;
    color: #fff;
    font-size: 12px;
    padding: 6px 8px;
    border-radius: 6px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 6px 14px rgba(0, 122, 255, 0.16);
    z-index: 30;
}

/* Legend and opacity controls */
.map-legend {
    position: absolute;
    right: 12px;
    top: 12px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    font-size: 13px;
    z-index: 1000;
}

.map-legend h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
}

.map-legend .legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.map-legend input[type="range"] {
    width: 120px;
}

/* Accessibility helper: screen-reader only */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Toast notification (bottom center) */
.toast {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 28px;
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 12000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(-6px);
    pointer-events: auto;
}

/* --- RESPONSIVE --- */
/* Tablets y pantallas medianas */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .map-section {
        height: 500px;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid #e5e5e7;
        max-height: none;
    }
}

/* Tablets pequeños y móviles grandes */
@media (min-width: 769px) {
    .controls {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Móviles y pantallas pequeñas */
@media (max-width: 768px) {

    /* General móvil */
    body {
        padding: 0;
    }

    .container {
        border-radius: 0;
    }

    .controls {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .map-section {
        height: 400px;
    }

    /* Timeline header reorganizado para móviles */
    .timeline-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .timeline-info {
        order: 3;
        width: 100%;
        text-align: center;
        margin-top: 8px;
    }

    .timeline-current-time {
        font-size: 12px;
    }

    .timeline-model-info {
        font-size: 9px;
    }

    /* Footer móvil */
    .footer {
        padding: 16px;
    }

    .footer-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .footer-section {
        width: 100%;
    }

    .footer-copyright {
        text-align: left;
    }

    /* Modal móvil */
    .weather-modal {
        padding: 10px;
    }

    .weather-modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        border-radius: 16px;
    }

    #weather-modal-body {
        padding: 32px 16px 16px;
    }

    .modal-weather-summary {
        flex-direction: column;
        gap: 16px;
        margin-bottom: 24px;
        padding-bottom: 24px;
    }

    .modal-weather-icon {
        order: 1;
        width: 100px;
        height: 100px;
    }

    .modal-weather-icon .material-symbols-outlined {
        font-size: 64px !important;
    }

    .modal-weather-main {
        order: 2;
        text-align: center;
        width: 100%;
    }

    .modal-temp-main {
        font-size: 44px;
    }

    .modal-location {
        font-size: 22px;
        word-break: break-word;
    }

    .modal-weather-desc {
        font-size: 15px;
    }

    .modal-temp-feels {
        font-size: 14px;
    }

    .modal-details-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .modal-detail-card {
        padding: 16px;
    }

    .modal-time-btn {
        width: 40px;
        height: 40px;
    }

    .modal-time-btn .material-symbols-outlined {
        font-size: 20px;
    }

    .modal-model-selector-container .control-group {
        margin-bottom: 16px;
    }

    .modal-model-selector-container select {
        font-size: 13px;
        padding: 8px 12px;
    }

    .welcome-header {
        padding: 36px 20px 24px;
    }

    .welcome-header .material-symbols-outlined {
        font-size: 56px;
        margin-bottom: 16px;
    }

    .welcome-title {
        font-size: 22px;
    }

    .welcome-content {
        padding: 24px 16px;
    }

    .welcome-step {
        padding: 16px;
        gap: 12px;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .welcome-step::before {
        width: 100%;
        height: 4px;
        top: 0;
        left: 0;
        border-radius: 4px 4px 0 0;
    }

    .welcome-step:hover {
        transform: translateY(-2px);
    }

    .welcome-step-icon {
        width: 56px;
        height: 56px;
    }

    .welcome-step-icon .material-symbols-outlined {
        font-size: 28px;
    }

    .welcome-step-content p {
        font-size: 14px;
    }

    .welcome-actions {
        padding: 20px 16px 24px;
    }

    .welcome-button {
        width: 100%;
        justify-content: center;
        padding: 16px 28px;
        font-size: 15px;
    }
}

/* Móviles muy pequeños */
@media (max-width: 480px) {
    .header {
        padding: 10px 16px;
    }

    .header-logo {
        height: 40px;
    }

    .header h1 {
        font-size: 16px;
    }

    .header p {
        font-size: 10px;
    }

    .footer {
        padding: 12px;
    }

    .footer h3 {
        font-size: 10px;
    }

    .footer p {
        font-size: 9px;
    }

    .map-section {
        height: 300px;
    }

    /* Modal muy pequeño */
    .weather-modal {
        padding: 5px;
    }

    .weather-modal-content {
        border-radius: 12px;
        max-height: 95vh;
    }

    #weather-modal-body {
        padding: 28px 12px 12px;
    }

    .modal-weather-icon {
        width: 90px;
        height: 90px;
    }

    .modal-weather-icon .material-symbols-outlined {
        font-size: 56px !important;
    }

    .modal-temp-main {
        font-size: 40px;
    }

    .modal-location {
        font-size: 20px;
    }

    .modal-weather-desc {
        font-size: 14px;
    }

    .modal-detail-card {
        padding: 14px;
    }

    .modal-detail-header {
        font-size: 15px;
    }

    .modal-detail-item .label {
        font-size: 13px;
    }

    .modal-detail-item .value {
        font-size: 14px;
    }

    .welcome-header {
        padding: 32px 16px 20px;
    }

    .welcome-header .material-symbols-outlined {
        font-size: 48px;
    }

    .welcome-title {
        font-size: 19px;
    }

    .welcome-content {
        padding: 20px 12px;
    }

    .welcome-step {
        padding: 14px;
        margin-bottom: 12px;
    }

    .welcome-step-icon {
        width: 44px;
        height: 44px;
    }

    .welcome-step-icon .material-symbols-outlined {
        font-size: 22px;
    }

    .welcome-step-content p {
        font-size: 13px;
        line-height: 1.6;
    }

    .welcome-actions {
        padding: 16px 12px 20px;
    }

    .welcome-button {
        padding: 14px 24px;
        font-size: 14px;
    }
}

/* --- Animaciones --- */
.icon-spin {
    animation: spin 2s linear infinite;
}

.icon-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.icon-bounce {
    animation: bounce 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

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

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* TEMA OSCURO */
:root {
    --bg-p: #fff;
    --bg-s: #f5f5f7;
    --text-p: #1d1d1f;
    --text-s: #86868b;
    --border: #d2d2d7;
}

[data-theme="dark"] {
    --bg-p: #1c1c1e;
    --bg-s: #2c2c2e;
    --text-p: #f5f5f7;
    --text-s: #98989d;
    --border: #48484a;
}

body {
    background: var(--bg-s);
    color: var(--text-p);
    transition: all .3s;
}

.container,
.sidebar,
.weather-card,
.forecast-day {
    background: var(--bg-p);
}

.controls,
.tabs {
    background: var(--bg-s);
}

.weather-card,
.comparison-cell {
    background: var(--bg-s);
}

.theme-toggle {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle .material-symbols-outlined {
    color: #fff;
}

/* ALERTAS */
.weather-alerts-container {
    padding: 16px 20px;
    background: var(--bg-s);
    border-bottom: 1px solid var(--border);
}

.weather-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-p);
    border-left: 4px solid #ff9500;
    padding: 12px 16px;
    border-radius: 12px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-message {
    font-size: 12px;
    color: var(--text-s);
}

.alert-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
}

/* MI UBICACIÓN */
.location-button {
    background: #007aff;
    color: #fff;
    font-weight: 600;
    border: none;
    border-radius: 10px 10px 10px 10px;
    margin-left: 8px;
    padding: 16px;
    height: 42px;
    display: flex;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.location-button:hover {
    background: #007aff;
}

/* GRÁFICOS */
.chart-card {
    background: var(--bg-s);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.chart-card h4 {
    font-size: 14px;
    margin-bottom: 12px;
}

.chart-card canvas {
    max-height: 200px;
}