/* ============================================================
   Community Weather & River Monitor — Styles
   ============================================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

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

/* Navbar */
.navbar {
    background: #2c3e50;
    padding: 0.8rem 0;
    margin-bottom: 1.5rem;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    color: #ecf0f1;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-logo {
    height: 32px;
    width: 32px;
    max-height: 32px;
    max-width: 32px;
    border-radius: 4px;
    object-fit: contain;
}

.nav-burger {
    display: none;
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
}

.nav-links a {
    color: #bdc3c7;
    text-decoration: none;
    margin-left: 1.5rem;
    font-size: 0.95rem;
}

.nav-links a:hover { color: #fff; }

.nav-community-switch {
    font-size: 1.1rem;
    opacity: 0.6;
    margin-left: 0.5rem !important;
}

.nav-community-switch:hover {
    opacity: 1;
}

.community-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
    transition: all 0.15s;
}

/* User dropdown menu */
.nav-user-menu {
    position: relative;
    display: inline-block;
    margin-left: 1.5rem;
}

.nav-user-btn {
    background: none;
    border: 1px solid #7f8c8d;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #bdc3c7;
    padding: 0;
}

.nav-user-btn:hover {
    color: #fff;
    border-color: #fff;
}

.nav-user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 180px;
    z-index: 1000;
    overflow: hidden;
}

.nav-user-dropdown.open {
    display: block;
}

.nav-user-name {
    padding: 0.7rem 1rem;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 1px solid #ecf0f1;
    font-size: 0.9rem;
}

.nav-user-dropdown a {
    display: block;
    padding: 0.6rem 1rem;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    margin: 0;
}

.nav-user-dropdown a:hover {
    background: #f5f7fa;
    color: #2980b9;
}

/* Headings */
h1 { margin-bottom: 1rem; color: #2c3e50; }
h2 { margin: 1.5rem 0 1rem; color: #2c3e50; }
h3 { margin-bottom: 0.5rem; }
.subtitle { color: #7f8c8d; margin-top: -0.8rem; margin-bottom: 1rem; }

/* Station Grid */
.station-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.station-card {
    background: #fff;
    border-radius: 8px;
    padding: 1.2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.station-card h3 a {
    color: #2c3e50;
    text-decoration: none;
}

.station-card h3 a:hover { color: #2980b9; }

.station-meta {
    font-size: 0.85rem;
    color: #95a5a6;
    margin: 0.3rem 0;
}

.station-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

.river-badge {
    display: inline-block;
    background: #ebf5fb;
    color: #2980b9;
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

/* Weather Panels */
.weather-panels {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.panel-label {
    font-size: 0.8rem;
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0.3rem 0;
}

.panel-sub {
    font-size: 0.8rem;
    color: #7f8c8d;
}

/* River Widget */
.river-widget {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin: 1.5rem 0;
    border-left: 4px solid #2980b9;
}

.river-current {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0.5rem 0;
}

.river-depth {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
}

.river-trend { font-weight: 600; }

.river-alert-time {
    background: #fdf2e9;
    color: #e67e22;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    margin: 0.5rem 0;
    font-weight: 600;
}

.river-alert-time.warning {
    background: #fdedec;
    color: #e74c3c;
}

.river-rain {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin: 0.3rem 0;
}

/* River Hero (dedicated page) */
.river-hero {
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    text-align: center;
}

.river-hero-depth {
    margin-bottom: 0.5rem;
}

.depth-value {
    font-size: 3.5rem;
    font-weight: 700;
    color: #2c3e50;
}

.depth-unit {
    font-size: 1.2rem;
    color: #95a5a6;
    margin-left: 0.3rem;
}

.river-hero-trend {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0.5rem 0;
}

/* Trend colours */
.trend-falling { color: #27ae60; }
.trend-slowly-falling { color: #2ecc71; }
.trend-stable { color: #95a5a6; }
.trend-rising { color: #f39c12; }
.trend-rising-fast { color: #e67e22; }
.trend-rising-rapidly { color: #e74c3c; }

/* Tables */
.rate-table, .predictions {
    background: #fff;
    border-radius: 8px;
    padding: 1.2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    display: inline-block;
    vertical-align: top;
    margin-right: 1rem;
}

.rate-table h3, .predictions h3 {
    margin-bottom: 0.8rem;
    color: #2c3e50;
}

table {
    border-collapse: collapse;
    width: 100%;
}

th, td {
    padding: 0.5rem 1rem;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

th { color: #7f8c8d; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; }

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    height: 250px;
    position: relative;
}

.chart-container.chart-large {
    height: 350px;
}

.chart-range-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.range-btn {
    background: #ecf0f1;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.range-btn:hover { background: #d5dbdb; }
.range-btn.active { background: #2980b9; color: #fff; }
.range-separator { color: #bdc3c7; margin: 0 0.2rem; }

/* Buttons */
.btn {
    display: inline-block;
    background: #2980b9;
    color: #fff;
    padding: 0.5rem 1.2rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 0.8rem;
}

.btn:hover { background: #2471a3; }
.btn-small { font-size: 0.8rem; padding: 0.3rem 0.8rem; margin-top: 0; }
.btn-danger { background: #c0392b; }
.btn-danger:hover { background: #a93226; }

/* Station header with follow button */
.station-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.station-header h1 { margin-bottom: 0; }

/* Alert rules table */
.alert-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    display: block;
}

.rule-disabled td { opacity: 0.5; }

/* EA badge */
.ea-badge {
    display: inline-block;
    background: #8e44ad;
    color: #fff;
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-weight: 600;
    vertical-align: middle;
    margin-left: 0.3rem;
}

/* Following badge */
.following-badge {
    display: inline-block;
    background: #d5f5e3;
    color: #1e8449;
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
    border-radius: 3px;
    font-weight: 600;
    vertical-align: middle;
    margin-left: 0.3rem;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* Footer */
.site-footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    background: #ecf0f1;
    text-align: center;
    font-size: 0.85rem;
    color: #7f8c8d;
}

/* Auth Forms */
.auth-form {
    max-width: 400px;
    margin: 2rem auto;
    background: #fff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: #2c3e50;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.7rem;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2980b9;
    box-shadow: 0 0 0 2px rgba(41,128,185,0.2);
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.auth-link a { color: #2980b9; }

/* Help steps */
.help-step {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.help-step-number {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: #2980b9;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    margin-top: 0.2rem;
}

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

.help-step-content h3 {
    margin-bottom: 0.3rem;
    color: #2c3e50;
}

.help-step-content ol,
.help-step-content ul {
    margin: 0.5rem 0 0.5rem 1.5rem;
}

.help-step-content li {
    margin-bottom: 0.3rem;
}

.help-step-content code {
    background: #ecf0f1;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.85rem;
}

/* Info dialogs */
.info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #bdc3c7;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, serif;
    cursor: pointer;
    border: none;
    vertical-align: middle;
    margin-left: 0.3rem;
    line-height: 1;
    padding: 0;
}

.info-btn:hover {
    background: #2980b9;
}

.info-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.info-overlay.open {
    display: flex;
}

.info-dialog {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 480px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    position: relative;
}

.info-dialog h3 {
    margin-bottom: 0.8rem;
    color: #2c3e50;
}

.info-dialog p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #555;
}

.info-dialog ul {
    margin: 0.5rem 0 0.5rem 1.5rem;
    font-size: 0.9rem;
    color: #555;
}

.info-dialog li {
    margin-bottom: 0.3rem;
}

.info-close {
    position: absolute;
    top: 0.8rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: #95a5a6;
    padding: 0;
}

.info-close:hover {
    color: #2c3e50;
}

/* Alerts / Flash messages */
.alert {
    padding: 0.8rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-success { background: #d5f5e3; color: #1e8449; }
.alert-error { background: #fdedec; color: #c0392b; }
.alert-warning { background: #fef9e7; color: #b7950b; }

/* Responsive */
@media (max-width: 768px) {
    /* Burger menu */
    .nav-burger {
        display: block;
    }

    .nav-links {
        display: none;
        width: 100%;
        padding-top: 0.8rem;
    }

    .nav-links.open {
        display: flex;
        flex-direction: column;
    }

    .nav-links a {
        margin-left: 0;
        padding: 0.5rem 0;
        border-top: 1px solid #34495e;
    }

    .navbar .container {
        flex-wrap: wrap;
    }

    /* Flatten user dropdown into burger menu on mobile */
    .nav-user-menu {
        margin-left: 0;
        display: contents;
    }

    .nav-user-btn {
        display: none;
    }

    .nav-user-dropdown {
        display: contents;
        position: static;
        background: none;
        box-shadow: none;
    }

    .nav-user-name {
        color: #7f8c8d;
        border-bottom: none;
        padding: 0.5rem 0;
        border-top: 1px solid #34495e;
    }

    .nav-user-dropdown a {
        color: #bdc3c7;
        padding: 0.5rem 0;
        border-top: 1px solid #34495e;
    }

    .nav-user-dropdown a:hover {
        background: none;
        color: #fff;
    }

    /* Weather panels */
    .weather-panels { grid-template-columns: repeat(2, 1fr); }

    /* Charts */
    .charts-grid { grid-template-columns: 1fr; }

    /* Range buttons — time range on one row, toggles below */
    .chart-range-selector {
        gap: 0.3rem;
    }

    .range-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .range-separator {
        flex-basis: 100%;
        height: 0;
        margin: 0;
        overflow: hidden;
    }

    /* River page */
    .depth-value { font-size: 2.5rem; }
    .rate-table, .predictions { display: block; margin-right: 0; width: 100%; }

    /* Station header */
    .station-header {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Auth forms */
    .auth-form {
        margin: 1rem auto;
        padding: 1.5rem;
    }

    /* Tables scroll horizontally */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}
