/* ============================================
 * fire-warning UI スタイルシート
 * Reactor層（UI）のビジュアル定義
 * ============================================ */

/* === CSS変数（ステータス別カラー） === */
:root {
    --fw-safe-bg: rgba(232, 245, 233, 0.7);
    --fw-safe-text: #1b5e20;
    --fw-caution-bg: rgba(255, 249, 196, 0.75);
    /* レベル1：薄い黄色・ベージュ系 */
    --fw-caution-text: #827717;
    --fw-advisory-bg: rgba(255, 152, 0, 0.15);
    /* レベル2：オレンジ系の下地 */
    --fw-advisory-text: #e65100;
    --fw-warning-bg: rgba(255, 235, 238, 0.85);
    --fw-warning-text: #b71c1c;
}

/* === メインボックス（ガラスモーフィズム） === */
.fire-warning-box {
    position: relative;
    padding: 8px 16px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    font-family: 'Klee One', sans-serif;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.25);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

/* === ステータス別スタイル === */
.status-safe {
    background: rgba(232, 245, 233, 0.85);
    color: #1b5e20;
    border-color: rgba(76, 175, 80, 0.3);
}

.status-caution {
    background: rgba(255, 249, 196, 0.85);
    /* レベル1：注意喚起（黄色） */
    color: #827717;
    border-color: rgba(251, 192, 45, 0.3);
}

.status-advisory {
    background: rgba(255, 152, 0, 0.1);
    /* レベル2：注意報（オレンジ） */
    color: #e65100;
    border-color: rgba(255, 152, 0, 0.4);
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.1);
    border-width: 2px;
}

.status-warning {
    background: rgba(255, 235, 238, 0.9);
    color: #b71c1c;
    border-color: rgba(244, 67, 54, 0.4);
    animation: extreme-shake 0.15s infinite;
}

/* === コンテンツレイアウト === */
.fire-warning-content {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* === ステータスセクション（1行目） === */
.fw-status-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.fire-warning-label {
    font-size: 0.95rem;
    font-weight: bold;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.fire-warning-icon {
    font-size: 1.1rem;
}

/* === 気象セクション（2行目） === */
.fw-weather-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    font-size: 0.85rem;
    padding-top: 2px;
}

.weather-item {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.85;
}

.weather-temp {
    font-weight: bold;
    color: #333;
}

/* === サイレンユニット === */
.siren-unit {
    position: relative;
    width: 18px;
    height: 20px;
    flex-shrink: 0;
}

.siren-glass {
    width: 14px;
    height: 18px;
    background: rgba(255, 0, 0, 0.5);
    border-radius: 6px 6px 1px 1px;
    position: relative;
    overflow: hidden;
}

.status-safe .siren-unit {
    display: none;
}

.status-caution .siren-glass {
    background: rgba(255, 152, 0, 0.6);
}

.status-advisory .siren-glass {
    background: rgba(251, 192, 45, 0.6);
}

.status-warning .siren-glass {
    background: rgba(239, 83, 80, 0.8);
}

.siren-reflector {
    position: absolute;
    top: 0;
    left: -100%;
    width: 300%;
    height: 100%;
    background: linear-gradient(90deg, transparent 45%, rgba(255, 255, 255, 0.8) 50%, transparent 55%);
    animation: siren-spin 1s linear infinite;
}

.status-warning .siren-reflector {
    animation-duration: 0.5s;
}

/* === ハザードライン === */
.hazard-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: repeating-linear-gradient(45deg, #fbcc05, #fbcc05 8px, #000 8px, #000 16px);
    display: none;
}

.status-warning .hazard-line {
    display: block;
    animation: hazard-move 1s linear infinite;
}

/* === キーフレーム === */
@keyframes hazard-move {
    from {
        background-position: 0 0;
    }

    to {
        background-position: 22.6px 0;
    }
}

@keyframes extreme-shake {

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

    25% {
        transform: translateX(-1px);
    }

    75% {
        transform: translateX(1px);
    }
}

@keyframes siren-spin {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(66%);
    }
}

/* === 展開トグルボタン === */
.fw-expand-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    padding: 6px 0;
    min-height: 32px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 0 0 8px 8px;
    color: inherit;
    opacity: 0.7;
    font-size: 0.75rem;
    cursor: pointer;
    transition: opacity 0.2s, background 0.2s;
    font-family: 'Klee One', sans-serif;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.fw-expand-toggle:hover,
.fw-expand-toggle:active {
    opacity: 1;
    background: rgba(0, 0, 0, 0.08);
}

.fw-expand-toggle .chevron {
    transition: transform 0.3s ease;
    font-size: 0.55rem;
}

.fw-expand-toggle.open .chevron {
    transform: rotate(180deg);
}

/* === 詳細パネル === */
.fw-detail-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 0;
    width: 100%;
}

.fw-detail-panel.open {
    max-height: 2000px;
    opacity: 1;
}

.fw-detail-panel .row {
    margin: 0 -6px;
}

.fw-detail-panel [class*="col-"] {
    padding: 0 6px;
}

.fw-detail-card {
    background: rgba(255, 255, 255, 0.55);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 10px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(6px);
}

.fw-detail-card h6 {
    font-size: 0.7rem;
    font-weight: bold;
    margin: 0 0 8px 0;
    opacity: 0.7;
    letter-spacing: 0.05em;
}

.fw-detail-loading {
    text-align: center;
    padding: 20px;
    font-size: 0.75rem;
    opacity: 0.6;
}

/* === 実効湿度ゲージ === */
.fw-eh-value {
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    line-height: 1.2;
}

.fw-eh-label {
    text-align: center;
    font-size: 0.65rem;
    opacity: 0.7;
    margin-bottom: 6px;
}

.fw-eh-bar-wrap {
    position: relative;
    height: 8px;
    background: linear-gradient(90deg, #d32f2f 0%, #ff9800 40%, #4caf50 70%, #2e7d32 100%);
    border-radius: 4px;
    margin-top: 6px;
}

.fw-eh-bar-marker {
    position: absolute;
    top: -3px;
    width: 3px;
    height: 14px;
    background: #333;
    border-radius: 2px;
    transform: translateX(-50%);
}

.fw-eh-bar-threshold {
    position: absolute;
    top: -2px;
    width: 1px;
    height: 12px;
    background: rgba(0, 0, 0, 0.3);
}

.fw-eh-danger { color: #d32f2f; }
.fw-eh-caution { color: #ff9800; }
.fw-eh-normal { color: #2e7d32; }

/* === タイムライン === */
.fw-timeline-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fw-timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.7rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.fw-timeline-item:last-child {
    border-bottom: none;
}

.fw-timeline-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 3px;
}

.fw-timeline-dot.level-0 { background: #4caf50; }
.fw-timeline-dot.level-1 { background: #fbc02d; }
.fw-timeline-dot.level-2 { background: #ff9800; }
.fw-timeline-dot.level-3 { background: #d32f2f; }

.fw-timeline-time {
    font-size: 0.6rem;
    opacity: 0.5;
    white-space: nowrap;
}

/* === 乾燥度メーター === */
.fw-drought-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.7rem;
}

.fw-drought-label {
    width: 50px;
    flex-shrink: 0;
    font-weight: bold;
    font-size: 0.65rem;
}

.fw-drought-bar-wrap {
    flex: 1;
    position: relative;
    height: 10px;
    background: linear-gradient(90deg, #e0e0e0 0%, #f5f5f5 100%);
    border-radius: 5px;
    overflow: visible;
}

.fw-drought-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
}

.fw-drought-bar-fill.wet { background: linear-gradient(90deg, #42a5f5, #1e88e5); }
.fw-drought-bar-fill.dry { background: linear-gradient(90deg, #ff9800, #e65100); }
.fw-drought-bar-fill.critical { background: linear-gradient(90deg, #ef5350, #b71c1c); }

.fw-drought-threshold {
    position: absolute;
    top: -2px;
    width: 2px;
    height: 14px;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.fw-drought-value {
    width: 55px;
    text-align: right;
    font-size: 0.65rem;
    flex-shrink: 0;
}

/* === 風向コンパス === */
.fw-wind-compass {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 6px;
}

.fw-wind-circle {
    width: 80px;
    height: 80px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    position: relative;
}

.fw-wind-arrow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 32px;
    margin-left: -2px;
    margin-top: -32px;
    transform-origin: bottom center;
    transition: transform 0.5s ease;
}

.fw-wind-arrow::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid #1976d2;
}

.fw-wind-arrow::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 22px;
    background: #1976d2;
}

.fw-wind-label-n, .fw-wind-label-s,
.fw-wind-label-e, .fw-wind-label-w {
    position: absolute;
    font-size: 0.55rem;
    font-weight: bold;
    opacity: 0.4;
}

.fw-wind-label-n { top: 2px; left: 50%; transform: translateX(-50%); }
.fw-wind-label-s { bottom: 2px; left: 50%; transform: translateX(-50%); }
.fw-wind-label-e { top: 50%; right: 4px; transform: translateY(-50%); }
.fw-wind-label-w { top: 50%; left: 4px; transform: translateY(-50%); }

.fw-wind-info {
    text-align: center;
    font-size: 0.75rem;
}

.fw-wind-speed {
    font-size: 1.2rem;
    font-weight: bold;
}

.fw-wind-dir-name {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* === 発令予測スコア === */
.fw-pred-score {
    font-size: 2.2rem;
    font-weight: bold;
    text-align: center;
    line-height: 1.1;
}

.fw-pred-score-unit {
    font-size: 0.8rem;
    font-weight: normal;
    opacity: 0.6;
}

.fw-pred-bar-wrap {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    margin: 6px 0;
    overflow: hidden;
}

.fw-pred-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
    background: linear-gradient(90deg, #4caf50, #ff9800, #d32f2f);
}

.fw-pred-sample {
    font-size: 0.6rem;
    text-align: center;
    opacity: 0.5;
}

/* === 週間予報グリッド === */
.fw-forecast-grid {
    display: flex;
    gap: 4px;
    overflow-x: auto;
}

.fw-forecast-day {
    flex: 1;
    min-width: 48px;
    text-align: center;
    padding: 4px 2px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.4);
    font-size: 0.6rem;
}

.fw-forecast-date {
    font-weight: bold;
    font-size: 0.6rem;
    margin-bottom: 2px;
}

.fw-forecast-icon {
    font-size: 1rem;
    margin: 2px 0;
}

.fw-forecast-pop {
    font-size: 0.6rem;
    color: #1976d2;
}

.fw-forecast-temp {
    font-size: 0.55rem;
    opacity: 0.7;
}

.fw-forecast-outlook {
    margin-top: 8px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    text-align: center;
}

.fw-forecast-outlook.drought {
    background: rgba(255, 152, 0, 0.1);
    color: #e65100;
    border: 1px solid rgba(255, 152, 0, 0.2);
}

.fw-forecast-outlook.normal {
    background: rgba(76, 175, 80, 0.1);
    color: #2e7d32;
    border: 1px solid rgba(76, 175, 80, 0.2);
}

/* === データなし表示 === */
.fw-nodata {
    text-align: center;
    font-size: 0.7rem;
    opacity: 0.5;
    padding: 10px 0;
}

/* === レスポンシブ: 詳細パネル === */
@media (max-width: 576px) {
    .fw-expand-toggle {
        min-height: 38px;
        font-size: 0.8rem;
        opacity: 0.8;
        padding: 8px 0;
    }

    .fw-detail-panel [class*="col-6"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .fw-eh-value {
        font-size: 1.6rem;
    }

    .fw-pred-score {
        font-size: 1.8rem;
    }

    .fw-wind-compass {
        width: 65px;
        height: 65px;
    }

    .fw-wind-circle {
        width: 65px;
        height: 65px;
    }
}
