:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-strong: #e9eef5;
    --text: #1f2937;
    --muted: #6b7280;
    --brand: #0f4c81;
    --accent: #f97316;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
    --card-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
    --radius: 24px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at top center, #eff6ff 0%, #f4f7fb 35%, #f8fafc 100%);
    color: var(--text);
}


img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

button, .button {
    font: inherit;
    border: none;
    cursor: pointer;
}

.container {
    width: min(1160px, calc(100% - 2rem));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(18px);
    background: rgba(255,255,255,0.92);
    border-bottom: 1px solid rgba(148,163,184,0.18);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.brand-logo {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    overflow: hidden;
    padding: 0;
    display: grid;
    place-items: center;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.brand-title {
    line-height: 1.1;
}

.brand-title strong {
    display: block;
    font-size: 1rem;
    letter-spacing: 0.02em;
}

.brand-tagline {
    font-size: 0.78rem;
    color: var(--muted);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text);
    font-weight: 600;
}

.nav-links a.active {
    color: var(--brand);
}

.header-actions {
    display: flex;
    gap: 0.85rem;
    align-items: center;
}

.btn-primary,
.btn-secondary,
.btn-tertiary {
    border-radius: 999px;
    padding: 0.85rem 1.35rem;
    font-weight: 700;
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand), #2563eb);
    color: #fff;
    box-shadow: 0 18px 30px rgba(59, 130, 246, 0.2);
}

.btn-secondary {
    background: var(--surface-strong);
    color: var(--text);
}

.btn-tertiary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-tertiary:hover {
    transform: translateY(-1px);
}

.hero {
    position: relative;
    padding: 3rem 0 2rem;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.3fr 0.9fr;
    gap: 1.75rem;
    align-items: start;
}

.hero-copy {
    display: grid;
    gap: 1.2rem;
}

.hero-copy h1 {
    margin: 0;
    font-size: clamp(2.65rem, 5vw, 3.9rem);
    line-height: 1.02;
}

.hero-copy p {
    margin: 0;
    font-size: 1.06rem;
    max-width: 44rem;
    color: var(--muted);
}

.alert-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-weight: 700;
}

.alert-banner.alert-yellow {
    background: #fef3c7;
    color: #92400e;
}

.alert-banner.alert-red {
    background: #fee2e2;
    color: #991b1b;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    background: #dcfce7;
    color: #166534;
    font-size: 0.85rem;
    font-weight: 700;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.85rem;
}

.hero-actions .button-large {
    min-width: 190px;
    padding: 1.05rem 1.4rem;
    font-size: 1rem;
}

.about-sources {
    overflow: hidden;
}

.about-sources .source-buttons {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    width: 100%;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    position: relative;
}

.about-sources .source-buttons::-webkit-scrollbar {
    height: 6px;
}

.about-sources .source-buttons::-webkit-scrollbar-thumb {
    background: rgba(15, 76, 129, .25);
    border-radius: 999px;
}

.about-sources .source-buttons::-webkit-scrollbar-track {
    background: transparent;
}

.about-sources .source-buttons li {
    margin: 0;
    flex: 0 0 auto;
}

.about-sources .source-buttons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.42rem 0.75rem;
    border-radius: 999px;
    border: 1px solid rgba(15, 76, 129, 0.25);
    background: rgba(15, 76, 129, 0.06);
    color: var(--brand);
    font-weight: 700;
    font-size: 0.82rem;
    min-width: 180px;
    white-space: nowrap;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.about-sources .source-buttons a:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 76, 129, 0.18);
    background: rgba(15, 76, 129, 0.14);
}

.about-ramon p,
.about-ramon ul,
.about-ramon li {
    overflow-wrap: break-word;
    word-break: break-word;
}

@media (max-width: 768px) {
    .about-ramon p,
    .about-ramon li {
        font-size: 0.93rem;
        line-height: 1.5;
    }
    .about-ramon p {
        padding-right: 0.25rem;
        padding-left: 0.25rem;
    }
}

.hero-panel {
    display: grid;
    gap: 1rem;
}

.status-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--card-shadow);
}

.status-card h3 {
    margin: 0 0 1rem;
    font-size: 1rem;
}

.level-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.level-indicator span {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
}

.level-indicator .dot {
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    background: var(--success);
}

.level-indicator .dot.yellow { background: var(--warning); }
.level-indicator .dot.red { background: var(--danger); }

.dam-meter {
    border-radius: 1.5rem;
    overflow: hidden;
    background: #e2e8f0;
    height: 14px;
}

.dam-meter span {
    display: block;
    height: 100%;
    width: 72%;
    background: linear-gradient(90deg, #2563eb, #38bdf8);
}

.weather-meta {
    display: grid;
    gap: 0.65rem;
    font-size: 0.95rem;
    color: var(--muted);
}

.section {
    padding: 2.5rem 0;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.section-title h2 {
    margin: 0;
    font-size: 1.4rem;
}

.section-title p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.hotline-grid,
.feature-grid {
    display: grid;
    gap: 1rem;
}

.news-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
    justify-content: center;
}

.about-ramon {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    width: 100%;
    text-align: justify;
    display: grid;
}

.feature-item {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.75rem 1.4rem;
    box-shadow: var(--card-shadow);
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.feature-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -6px rgba(15, 23, 42, 0.12);
    border-color: rgba(37, 99, 235, 0.35);
}

.feature-item .material-symbols-outlined {
    font-size: 1.85rem;
    color: var(--primary, #2563eb);
    background: rgba(37, 99, 235, 0.08);
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.25rem auto;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.feature-item:hover .material-symbols-outlined {
    transform: scale(1.08);
    background: var(--primary, #2563eb);
    color: #ffffff;
}

.hotline-card,
.news-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--card-shadow);
}

.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.12);
    display: grid;
    place-items: center;
    font-size: 1.75rem;
    margin: 0 auto;
}

.feature-item h3,
.news-card h3 {
    margin: 0;
    font-size: 1.05rem;
}

.feature-item p,
.news-card p,
.about-ramon {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.hotline-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.hotline-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid rgba(226, 232, 240, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.hotline-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12);
}

.hotline-header-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hotline-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.hotline-card .hotline-header {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--text, #0f172a);
    margin: 0;
}

.hotline-lines-group {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.hotline-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(241, 245, 249, 0.6);
    border: 1px solid rgba(226, 232, 240, 0.8);
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    gap: 0.75rem;
}

.hotline-line span {
    color: var(--text, #0f172a);
    font-size: 0.92rem;
    font-weight: 600;
}

.hotline-line button {
    background: var(--brand, #0f4c81);
    color: #fff;
    border-radius: 999px;
    padding: 0.5rem 1rem;
    border: none;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background 0.2s ease, transform 0.15s ease;
}

.hotline-line button:hover {
    background: #0284c7;
    transform: scale(1.04);
}

@media (max-width: 900px) {
    .hotline-grid,
    .feature-grid {
        grid-template-columns: 1fr;
    }
}


.footer {
    padding: 2rem 0 3rem;
    color: var(--muted);
    font-size: 0.95rem;
    text-align: center;
}

.chatbot {
    position: fixed;
    right: 1.1rem;
    bottom: 1.1rem;
    z-index: 40;
    display: grid;
    gap: 0.85rem;
    align-items: end;
}

.chatbot-toggle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #0f4c81);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.6rem;
    box-shadow: 0 18px 35px rgba(37, 99, 235, 0.3);
}

.chat-panel {
    width: min(360px, calc(100vw - 2rem));
    max-height: 520px;
    background: rgba(255,255,255,0.98);
    border-radius: 28px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    display: none;
}

.chat-panel.open {
    display: grid;
}

.chat-panel header {
    padding: 1rem 1.2rem;
    background: #0f4c81;
    color: #fff;
}

.chat-panel .messages {
    padding: 1rem;
    display: grid;
    gap: 0.8rem;
    max-height: 320px;
    overflow-y: auto;
}

.chat-panel .message {
    padding: 0.85rem 1rem;
    border-radius: 20px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.chat-panel .message.user {
    margin-left: auto;
    background: #e0f2fe;
    color: #0c4a6e;
}

.chat-panel .message.bot {
    background: #f8fafc;
    color: var(--text);
}

.chat-panel form {
    display: flex;
    gap: 0.75rem;
    padding: 0.95rem 1rem 1rem;
    border-top: 1px solid #e2e8f0;
}

.chat-panel input {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    padding: 0.9rem 1rem;
    font-size: 0.95rem;
}

.chat-panel button {
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    padding: 0.9rem 1.1rem;
}

/* ==========================================================================
   PWA INSTALLATION PROMPTS & BUTTONS
   ========================================================================== */
.btn-install-pwa {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff !important;
    border: none;
    border-radius: 999px;
    padding: 0.55rem 1.1rem;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    transition: all 0.25s ease;
    text-decoration: none;
}

.btn-install-pwa:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.btn-install-pwa .material-symbols-outlined {
    font-size: 18px;
}

/* Floating PWA Install Banner Toast */
.pwa-install-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    width: calc(100% - 32px);
    max-width: 480px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 18px;
    box-shadow: 0 20px 35px -10px rgba(15, 23, 42, 0.25), 0 1px 3px rgba(0,0,0,0.05);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    z-index: 10050;
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
}

.pwa-install-banner.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.pwa-banner-icon {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.pwa-banner-text {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-width: 0;
}

.pwa-banner-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.pwa-banner-desc {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 3px;
    line-height: 1.35;
}

.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pwa-btn-install {
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
    transition: background 0.2s ease, transform 0.15s ease;
}

.pwa-btn-install:hover {
    background: #1d4ed8;
    transform: scale(1.04);
}

.pwa-btn-dismiss {
    background: transparent;
    border: none;
    color: #94a3b8;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.pwa-btn-dismiss:hover {
    background: #f1f5f9;
    color: #0f172a;
}

@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
    }

    .site-header .container {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .header-actions {
        width: 100%;
        justify-content: center;
    }

    .hotline-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .brand-logo {
        width: 46px;
        height: 46px;
    }

    .site-header .container {
        gap: 0.75rem;
    }

    .hero {
        padding: 2rem 0 1.5rem;
    }

    .hero-copy h1 {
        font-size: 2.45rem;
    }

    .hero-actions {
        flex-direction: column;
    }

    .chatbot {
        right: 0.75rem;
        bottom: 0.75rem;
    }
}
