/**
 * Gosy Weather - Frontend Styles
 * Pill widget + alert banner + weather tab
 */

:root {
    --gosy-sand: #f5f0e8;
    --gosy-ocean: #1a4a6e;
    --gosy-sky: #3b82c4;
    --gosy-coral: #e8573f;
    --gosy-sun: #f4b942;
    --gosy-foam: #e8f4f8;
    --gosy-dark: #0f1e2d;
    --gosy-wire: #b8c8d8;
    --gosy-wire-dark: #7a99b0;
    --gosy-green: #3daa7a;
}

/* ========== PILL MINI ========== */

.gosy-weather-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--gosy-dark);
    width: 100%;
}

.gosy-pill-mini {
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 16px;
    background: var(--gosy-foam);
    border: 1px solid var(--gosy-wire);
    border-radius: 999px;
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    user-select: none;
    margin-top: 6px;
}

.gosy-pill-mini:hover {
    background: #ddeef5;
    border-color: var(--gosy-sky);
}

/* Izquierda: emoji + temperatura — ancho fijo al contenido */
.gosy-pill-mini__left {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

/* Centro: viento + precip — ocupa el espacio restante, centrado */
.gosy-pill-mini__center {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
}

/* Derecha: badge + toggle — ancho fijo al contenido */
.gosy-pill-mini__right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.gosy-pill-mini__emoji {
    font-size: 18px;
    line-height: 1;
}

.gosy-pill-mini__temp {
    font-weight: 800;
    color: var(--gosy-ocean);
    font-size: 16px;
    white-space: nowrap;
}

.gosy-pill-mini__sep {
    color: var(--gosy-wire);
    font-weight: 300;
}

.gosy-pill-mini__detail {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--gosy-wire-dark);
    font-weight: 500;
    font-size: 12px;
    white-space: nowrap;
}

.gosy-pill-mini__badge {
    padding: 3px 9px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.4;
    white-space: nowrap;
}

.gosy-pill-mini__badge--ideal  { background: var(--gosy-green); color: #fff; }
.gosy-pill-mini__badge--ok     { background: var(--gosy-sun);   color: var(--gosy-dark); }
.gosy-pill-mini__badge--riesgo { background: var(--gosy-coral);  color: #fff; }

.gosy-pill-mini__toggle {
    display: inline-flex;
    align-items: center;
    transition: transform 0.25s ease;
}

.gosy-pill-mini__toggle svg {
    width: 16px;
    height: 16px;
    fill: var(--gosy-wire-dark);
}

.gosy-pill-mini.is-open .gosy-pill-mini__toggle {
    transform: rotate(180deg);
}

/* Viento en el pill mini */
.gosy-pill-mini .gosy-wind-arrow {
    font-size: 12px;
}

.gosy-pill-mini .gosy-wind-label {
    font-size: 10px;
}

/* Estado: evento en curso — punto pulsante */
.gosy-pill-mini__live {
    font-size: 10px;
    color: var(--gosy-green);
    animation: gosy-pulse 1.4s ease-in-out infinite;
}

@keyframes gosy-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.3; }
}

/* ========== PILL EXTENDED ========== */

.gosy-pill-ext {
    background: var(--gosy-foam);
    border: 1px solid var(--gosy-wire);
    border-radius: 14px;
    padding: 14px 16px 12px;
    margin-top: 6px;
    font-size: 13px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.gosy-pill-ext[data-collapsed="true"] {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    border-color: transparent;
    opacity: 0;
}

.gosy-pill-ext[data-collapsed="false"] {
    max-height: 500px;
    opacity: 1;
}

.gosy-pill-ext__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.gosy-pill-ext__title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 12px;
    color: var(--gosy-wire-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gosy-pill-ext__title-emoji {
    font-size: 14px;
}

.gosy-pill-ext__badge {
    padding: 3px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gosy-pill-ext__badge--ideal  { background: var(--gosy-green); color: #fff; }
.gosy-pill-ext__badge--ok     { background: var(--gosy-sun);   color: var(--gosy-dark); }
.gosy-pill-ext__badge--riesgo { background: var(--gosy-coral);  color: #fff; }

.gosy-pill-ext__hours {
    display: flex;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.gosy-pill-ext__hours::-webkit-scrollbar {
    display: none;
}

.gosy-pill-ext__hour {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 0;
    min-width: 56px;
    flex: 1;
    position: relative;
}

.gosy-pill-ext__hour + .gosy-pill-ext__hour::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    bottom: 12px;
    width: 1px;
    background: var(--gosy-wire);
}

.gosy-pill-ext__hour-time {
    font-size: 11px;
    font-weight: 700;
    color: var(--gosy-ocean);
    letter-spacing: 0.3px;
}

.gosy-pill-ext__hour-emoji {
    font-size: 18px;
    line-height: 1;
    margin: 2px 0;
}

.gosy-pill-ext__hour-temp {
    font-size: 15px;
    font-weight: 800;
    color: var(--gosy-dark);
    line-height: 1;
}

.gosy-pill-ext__hour-wind {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 11px;
    color: var(--gosy-wire-dark);
    font-weight: 500;
}

/* ========== UV INDEX ========== */

.gosy-uv {
    font-weight: 700;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 4px;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

/* Escala OMS */
.gosy-uv--low       { background: #c8e6c9; color: #1b5e20; } /* 0-2  Verde    */
.gosy-uv--moderate  { background: #fff9c4; color: #7c5e00; } /* 3-5  Amarillo */
.gosy-uv--high      { background: #ffe0b2; color: #8d3400; } /* 6-7  Naranja  */
.gosy-uv--very-high { background: #ffcdd2; color: #7f0000; } /* 8-10 Rojo     */
.gosy-uv--extreme   { background: #e1bee7; color: #4a148c; } /* 11+  Violeta  */

.gosy-pill-ext__hour-uv {
    font-size: 9px;
}

/* Wind direction arrow — rotated inline via style attribute */
.gosy-wind-arrow {
    font-size: 12px;
    line-height: 1;
    color: var(--gosy-sky);
    display: inline-block;
    /* transition for smooth updates if refreshed via AJAX */
    transition: transform 0.4s ease;
}

/* Compass label: N, NE, SO … */
.gosy-wind-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--gosy-ocean);
    letter-spacing: 0.2px;
}

/* Mini pill wind label slightly smaller */
.gosy-pill-mini .gosy-wind-label {
    font-size: 10px;
}

.gosy-pill-mini .gosy-wind-arrow {
    font-size: 13px;
}

.gosy-pill-ext__hour-precip {
    font-size: 10px;
    color: var(--gosy-sky);
    font-weight: 600;
}

.gosy-pill-ext__hour-precip--zero {
    color: var(--gosy-wire);
}

/* Resumen por factor (temp · viento · lluvia) */
.gosy-pill-ext__factors {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 10px;
    padding: 8px 0 4px;
    border-top: 1px solid var(--gosy-wire);
}

.gosy-pill-ext__factor {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.6);
    border-radius: 999px;
    padding: 3px 8px 3px 6px;
}

.gosy-pill-ext__factor-icon {
    font-size: 13px;
    line-height: 1;
}

.gosy-pill-ext__factor-name {
    font-size: 10px;
    color: var(--gosy-wire-dark);
    font-weight: 500;
}

.gosy-pill-ext__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--gosy-wire);
    font-size: 10px;
    color: var(--gosy-wire-dark);
}

.gosy-pill-ext__foot-source {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ⓘ info icon */
.gosy-pill-ext__info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--gosy-wire);
    color: #fff;
    font-size: 9px;
    font-style: normal;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
}

.gosy-pill-ext__info:hover,
.gosy-pill-ext__info:focus-visible {
    background: var(--gosy-sky);
    outline: none;
}

/* Tooltip — rendered via JS into body to avoid overflow:hidden clipping */
.gosy-weather-tooltip {
    position: fixed;
    z-index: 99999;
    background: var(--gosy-dark, #0f1e2d);
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    padding: 9px 12px;
    border-radius: 7px;
    max-width: 240px;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.gosy-weather-tooltip.is-visible {
    opacity: 1;
}

/* Arrow — left position set by JS via --arrow-left */
.gosy-weather-tooltip::before {
    content: '';
    position: absolute;
    bottom: -5px;
    left: var(--arrow-left, 50%);
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom: none;
    border-top-color: var(--gosy-dark, #0f1e2d);
}

/* ========== WEATHER TAB (inside venue) ========== */

.gosy-weather-tab {
    padding: 16px 0;
}

.gosy-wt-current {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.gosy-wt-icon {
    font-size: 40px;
    line-height: 1;
}

.gosy-wt-desc {
    font-weight: 600;
    color: var(--gosy-dark);
    font-size: 15px;
}

.gosy-wt-temp {
    font-size: 24px;
    font-weight: 700;
    color: var(--gosy-ocean);
}

.gosy-wt-apparent {
    font-size: 14px;
    font-weight: 400;
    color: var(--gosy-wire-dark);
}

.gosy-wt-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.gosy-wt-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.gosy-wt-stat-icon {
    font-size: 18px;
}

.gosy-wt-stat-val {
    font-weight: 700;
    font-size: 14px;
    color: var(--gosy-dark);
}

.gosy-wt-stat-label {
    font-size: 11px;
    color: var(--gosy-wire-dark);
}

.gosy-wt-footer {
    padding-top: 8px;
    border-top: 1px solid var(--gosy-wire);
    font-size: 11px;
    color: var(--gosy-wire-dark);
}

/* ========== ALERT BANNER ========== */

.gosy-weather-alert-banner {
    background: linear-gradient(135deg, var(--gosy-coral) 0%, #c7452e 100%);
    color: white;
    padding: 20px;
    margin: 16px 0;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(232, 87, 63, 0.25);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.alert-banner-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.alert-icon {
    font-size: 28px;
    line-height: 1;
}

.alert-text {
    flex: 1;
}

.alert-title {
    font-weight: 700;
    font-size: 18px;
    margin: 0 0 6px 0;
}

.alert-message {
    font-size: 14px;
    margin: 0 0 8px 0;
    opacity: 0.95;
}

.alert-details {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.detail-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

.alert-reasons {
    font-size: 13px;
    opacity: 0.85;
    margin: 0;
}

.alert-banner-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.alert-btn {
    flex: 1;
    min-width: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.2s;
    font-family: inherit;
}

.alert-btn:hover {
    opacity: 0.9;
}

.alert-btn-cancel {
    background: rgba(0, 0, 0, 0.25);
    color: white;
}

.alert-btn-confirm {
    background: var(--gosy-green);
    color: white;
}

.alert-btn-location {
    background: var(--gosy-sky);
    color: white;
}

.alert-processing {
    text-align: center;
    padding: 16px;
}

.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: gosy-spin 0.6s linear infinite;
}

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

.processing-text {
    margin-left: 8px;
    font-weight: 600;
}

/* ========== MODAL ========== */

.gosy-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 30, 45, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
}

.gosy-modal .modal-content {
    background: white;
    border-radius: 12px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.gosy-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gosy-wire);
}

.gosy-modal .modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gosy-dark);
    margin: 0;
}

.gosy-modal .modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gosy-wire-dark);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.gosy-modal .modal-body {
    padding: 20px;
}

.gosy-modal .form-group {
    margin-bottom: 16px;
}

.gosy-modal .form-group label {
    display: block;
    font-weight: 600;
    color: var(--gosy-dark);
    margin-bottom: 6px;
    font-size: 13px;
}

.gosy-modal .form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--gosy-wire);
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.gosy-modal .form-control:focus {
    outline: none;
    border-color: var(--gosy-sky);
}

.gosy-modal .form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.gosy-modal .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
}

.gosy-modal .btn-primary {
    background: var(--gosy-ocean);
    color: white;
}

.gosy-modal .btn-secondary {
    background: var(--gosy-wire);
    color: var(--gosy-dark);
}

/* ========== NOTIFICATION ========== */

.gosy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 9999999;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s ease;
}

.gosy-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.gosy-notification-success {
    background: var(--gosy-green);
    color: white;
}

.gosy-notification-error {
    background: var(--gosy-coral);
    color: white;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 768px) {
    .gosy-pill-ext__factor-name {
        display: none;
    }
}

@media (max-width: 480px) {

    .gosy-pill-mini {
        padding: 8px 12px;
    }

    .gosy-pill-mini__temp { font-size: 14px; }

    .gosy-pill-mini__detail { font-size: 11px; }

    /* En móvil muy pequeño ocultar el separador central para ganar espacio */
    .gosy-pill-mini__sep { display: none; }

    .gosy-pill-ext {
        padding: 10px 10px 8px;
    }

    .gosy-pill-ext__hour {
        min-width: 48px;
        padding: 6px 0;
    }

    .gosy-pill-ext__hour-temp { font-size: 14px; }
    .gosy-pill-ext__hour-emoji { font-size: 16px; }
}

@media (max-width: 600px) {
    .alert-banner-actions {
        flex-direction: column;
    }

    .alert-btn {
        min-width: auto;
    }

    .gosy-wt-stats {
        gap: 16px;
    }
}
