/* ============================================
   Coachella Valley H2S Monitoring Network
   ============================================ */

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body { 
    font-family: 'Open Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    font-size: 18px;
    line-height: 1.6;
    background-color: #f5f5f5; 
    color: #333; 
    min-height: 100vh; 
}

a:focus, button:focus, input:focus, select:focus {
    outline: 3px solid #4a90d9;
    outline-offset: 2px;
}

/* ============================================
   ALERT BANNER
   ============================================ */
.alert-banner { 
    background: #c41230; 
    color: #ffffff; 
    padding: 14px 30px; 
    text-align: center; 
    font-weight: 700; 
    font-size: 18px; 
    display: none; 
}
.alert-banner.visible { display: block; }
.alert-banner svg { 
    width: 24px; 
    height: 24px; 
    vertical-align: middle; 
    margin-right: 10px; 
}

/* ============================================
   HEADER - Title Centered
   ============================================ */
.header { 
    background: #006cb6; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 10px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.logo { display: flex; align-items: center; }
.logo-image { 
    height: 180px;
    width: auto; 
    border-radius: 4px; 
}

/* Centered Title - Updated Styling */
.header-center {
    flex: 1;
    text-align: center;
    padding: 0 20px;
}
.hero-title { 
    font-family: Arial, Verdana, Sans-serif; /*'skolar-sans-latin', 'Open Sans', sans-serif;*/
    font-size: 27px;
    font-weight: 400;
    font-style: italic;
    color: #ffffff;
    text-align: center;
    padding-top: 12px;
    margin: 0;
}
.hero-description {
    text-align: center;
    width: 65%;
    margin: 0 auto;
    padding: 10px 0 40px;
    font-size: 17px;
    line-height: 20px;
    color: #ffffff;
}

.nav { display: flex; gap: 10px; }
.nav a { 
    color: #ffffff; 
    text-decoration: none; 
    font-size: 15px; 
    font-weight: 600; 
    padding: 10px 18px; 
    border-radius: 4px; 
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.nav a:hover, .nav a:focus { 
    background: rgba(255,255,255,0.2); 
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content { 
    background: #f5f5f5; 
    padding: 30px; 
    max-width: 1400px; 
    margin: 0 auto; 
}

.dashboard-grid { 
    display: grid; 
    grid-template-columns: 1fr 1.5fr; 
    gap: 25px; 
    margin-bottom: 30px; 
}
.gauges-section { 
    display: grid; 
    grid-template-columns: repeat(2, 1fr); 
    gap: 15px; 
}

/* ============================================
   GAUGE CARDS
   ============================================ */
.gauge-card { 
    background: #ffffff; 
    text-align: center; 
    padding: 20px 15px; 
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.gauge-title { 
    font-size: 14px; 
    font-weight: 700; 
    color: #003366;
    margin-bottom: 12px; 
    min-height: 40px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

/* Gauge Wrapper */
.gauge-wrapper {
    position: relative;
    width: 140px;
    height: 80px;
    margin: 0 auto 10px auto;
}

/* Gauge Arc */
.gauge-arc {
    position: absolute;
    top: 0;
    left: 0;
    width: 140px;
    height: 70px;
    border-radius: 70px 70px 0 0;
    background: linear-gradient(90deg, 
        #e6f2ff 0%,
        #99c2ff 25%,
        #4a90d9 50%,
        #0066cc 75%,
        #003366 100%
    );
}

/* Inner white cutout */
.gauge-inner {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 120px;
    height: 60px;
    border-radius: 60px 60px 0 0;
    background: #ffffff;
}

/* Needle */
.gauge-needle {
    position: absolute;
    bottom: 10px;
    left: 50%;
    width: 4px;
    height: 50px;
    background: linear-gradient(to top, #1a1a1a, #4a4a4a);
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(-90deg);
    transition: transform 0.5s ease-out;
    z-index: 10;
    border-radius: 2px;
}

/* Center dot */
.gauge-center-dot {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 14px;
    background: #1a1a1a;
    border-radius: 50%;
    z-index: 11;
}

/* H2S Label */
.gauge-label-center {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 600;
    color: #666666;
    z-index: 5;
}

/* Min Label (0) */
.gauge-min {
    position: absolute;
    bottom: 0;
    left: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #666666;
}

/* Threshold Label - dynamically positioned based on config */
.gauge-threshold {
    position: absolute;
    font-size: 10px;
    font-weight: 700;
    color: #c41230;
    /* Position will be set dynamically via inline styles */
}

/* Max Label (40) */
.gauge-max {
    position: absolute;
    bottom: 0;
    right: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #666666;
}

/* Gauge Value Display */
.gauge-value { 
    font-size: 40px; 
    font-weight: 700; 
    color: #0066cc;
    margin-top: 5px; 
}
.gauge-value.warning { color: #004080; }
.gauge-value.danger { color: #c41230; font-weight: 800; }
.gauge-value.alert { color: #c41230; font-weight: 800; }  /* Red when notificationstatus = yes */
.gauge-value.unavailable { color: #999999; font-size: 24px; }

.gauge-unit { 
    font-size: 12px; 
    color: #666666; 
    margin-top: 4px;
    font-weight: 600;
}
.gauge-time { 
    font-size: 11px; 
    color: #666666; 
    margin-top: 6px; 
}

/* ============================================
   MAP SECTION
   ============================================ */
.map-section { 
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.map-section h2 { 
    font-size: 18px; 
    font-weight: 700;
    color: #003366;
    margin-bottom: 15px; 
}
#map { 
    height: 100%; 
    min-height: 380px; 
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}
.station-label { 
    background: transparent; 
    border: none;
    padding: 0; 
    font-size: 14px;
    font-weight: 800;
    color: #003366; 
    white-space: nowrap; 
    text-shadow: 2px 2px 3px #fff, -2px -2px 3px #fff, 2px -2px 3px #fff, -2px 2px 3px #fff, 0 0 8px #fff;
}

/* Map Popup */
.popup-container { min-width: 350px; }
.popup-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}
.popup-title { font-weight: 700; font-size: 16px; color: #003366; }
.popup-value { font-size: 24px; font-weight: 700; }
.popup-value.good { color: #2e7d32; }
.popup-value.moderate { color: #f9a825; }
.popup-value.elevated { color: #c41230; }
.popup-value.unavailable { color: #999999; font-size: 18px; }
.popup-chart { height: 150px; margin-top: 10px; }

/* Remove zoom button */
calcite-action[title="Zoom to"] {
    display: none !important;
}

/* Remove the action bar entirely (contains zoom button) */
calcite-action-bar[slot="action-bar"] {
    display: none !important;
}

/* Remove the undock button */
calcite-action[title="Undock"] {
    display: none !important;
}

/* Remove the title/header from popup — our content has its own */
calcite-flow-item::part(header) {
    display: none !important;
}

/* No scrollbar — let content size naturally */
.esri-features__container {
    max-height: none !important;
    overflow: visible !important;
}

.esri-features__content-container {
    max-height: none !important;
    overflow: visible !important;
}

/* Popup sizing */
.esri-popup__main-container {
    max-width: 450px !important;
    width: 420px !important;
}
/* ============================================
   CHART SECTION
   ============================================ */
.chart-section { 
    background: #ffffff; 
    border-radius: 8px; 
    padding: 25px; 
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.chart-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    margin-bottom: 20px; 
    flex-wrap: wrap; 
    gap: 15px; 
}
.chart-title { 
    font-size: 20px; 
    font-weight: 700;
    color: #003366;
}

.date-controls { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    flex-wrap: wrap; 
    background: #f5f5f5; 
    padding: 12px 15px; 
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}
.date-controls label { 
    font-size: 14px; 
    font-weight: 600;
    color: #333;
}
.date-controls input[type="date"] { 
    padding: 10px 12px; 
    border: 2px solid #cccccc; 
    border-radius: 4px; 
    background: #ffffff; 
    color: #333; 
    font-family: inherit;
    font-size: 14px;
}
.date-controls input[type="date"]:focus { border-color: #0066cc; }

.btn-icon { 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    padding: 10px 18px; 
    background: #003366; 
    color: #ffffff; 
    border: none; 
    border-radius: 4px; 
    font-size: 14px; 
    font-weight: 600; 
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.btn-icon:hover, .btn-icon:focus { background: #004080; }
.btn-icon svg { width: 18px; height: 18px; }

.chart-legend { 
    display: flex; 
    gap: 20px; 
    flex-wrap: wrap; 
    margin-top: 15px;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 4px;
}
.legend-item { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    font-size: 13px;
    font-weight: 600;
    color: #333;
}
.legend-color { width: 24px; height: 4px; border-radius: 2px; }
.chart-container { height: 350px; position: relative; }

/* ============================================
   SUBSCRIPTION SECTION
   ============================================ */
.subscription-section { 
    background: #ffffff; 
    border-radius: 8px; 
    padding: 25px; 
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.subscription-section h2 { 
    font-size: 20px; 
    font-weight: 700; 
    color: #003366;
    margin-bottom: 12px; 
}
.subscription-info { 
    font-size: 15px; 
    margin-bottom: 18px; 
    color: #666666;
    line-height: 1.6;
}
.station-checkboxes { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 20px; 
    margin-bottom: 20px; 
}
.station-checkbox { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    font-size: 14px;
    font-weight: 600;
    color: #333;
}
.station-checkbox input { 
    width: 20px; 
    height: 20px;
    accent-color: #003366;
}

.subscribe-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    max-width: 600px;
}
.subscribe-form input {
    flex: 1 1 100%;            /* email gets its own row */
    box-sizing: border-box;
    padding: 14px 16px;
    border: 2px solid #cccccc;
    border-radius: 4px;        /* full rounding now, not fused */
    font-size: 15px;
    color: #333;
}
.subscribe-form input:focus { border-color: #0066cc; }
.subscribe-form input::placeholder { color: #999999; }

.subscribe-form #captchaWidget {
    flex: 1 1 100%;            /* captcha on its own row */
}

.subscribe-form button,
.subscribe-form .btn-secondary {
    flex: 0 0 auto;            /* Subscribe + Manage share the next row */
    padding: 14px 22px;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;     /* Manage Subscriptions is an <a>, not a button */
    display: inline-flex;
    align-items: center;
    transition: background-color 0.2s ease;
}
.subscribe-form .btn-primary { background: #003366; color: #ffffff; }
.subscribe-form .btn-primary:hover, .subscribe-form .btn-primary:focus { background: #004080; }
.subscribe-form .btn-secondary { background: #e0e0e0; color: #333; }
.subscribe-form .btn-secondary:hover, .subscribe-form .btn-secondary:focus { background: #d0d0d0; }

/* ============================================
   MANAGE SUBSCRIPTIONS MODAL
   ============================================ */
.manage-sub-form input {
    width: 100%;
    max-width: 420px;
    padding: 12px 14px;
    border: 2px solid #cccccc;
    border-radius: 4px;
    font-size: 15px;
    color: #333;
    box-sizing: border-box;
}
.manage-sub-form input:focus { outline: none; border-color: #0066cc; }
.manage-sub-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.btn-manage-unsub {
    padding: 11px 20px;
    background: #c41230;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
.btn-manage-unsub:hover { background: #a30e27; }
.manage-sub-msg {
    margin-top: 14px;
    font-size: 14px;
    font-weight: 600;
    min-height: 20px;
}
.manage-sub-msg.error { color: #c41230; }
.manage-sub-msg.success { color: #007a33; }

/* ============================================
   FOOTER
   ============================================ */
.footer { 
    background: #003366; 
    color: #ffffff; 
    text-align: center; 
    padding: 25px 30px; 
    font-size: 14px;
}
.footer a { color: #99c2ff; text-decoration: none; }
.footer a:hover, .footer a:focus { text-decoration: underline; }

/* ============================================
   MODAL
   ============================================ */
.modal-overlay { 
    position: fixed; 
    top: 0; left: 0; right: 0; bottom: 0; 
    background: rgba(0, 0, 0, 0.6); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 3000; 
    opacity: 0; 
    visibility: hidden; 
    transition: all 0.25s ease; 
}
.modal-overlay.visible { opacity: 1; visibility: visible; }
.modal-content { 
    background: #ffffff; 
    border-radius: 8px; 
    max-width: 700px; 
    max-height: 85vh; 
    overflow-y: auto; 
    padding: 30px; 
    position: relative; 
    margin: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.modal-content h2 { 
    font-size: 24px; 
    margin-bottom: 20px; 
    color: #003366; 
    border-bottom: 3px solid #003366; 
    padding-bottom: 12px; 
}
.modal-content p { 
    color: #333; 
    margin-bottom: 16px; 
    line-height: 1.7; 
    font-size: 15px; 
}
.modal-content a { color: #0066cc; font-weight: 600; }
.modal-content a:hover { text-decoration: underline; }
.modal-content ul { list-style: none; color: #333; font-size: 15px; }
.modal-content li { 
    margin-bottom: 14px; 
    padding-left: 20px; 
    position: relative; 
}
.modal-content li::before { 
    content: '•'; 
    position: absolute; 
    left: 0; 
    color: #003366;
    font-weight: bold;
}
.modal-close { 
    position: absolute; 
    top: 15px; 
    right: 15px; 
    background: #f5f5f5; 
    border: none; 
    color: #333; 
    font-size: 28px; 
    cursor: pointer; 
    width: 40px; 
    height: 40px; 
    border-radius: 50%;
    line-height: 36px;
    text-align: center;
}
.modal-close:hover, .modal-close:focus { background: #e0e0e0; }

/* ============================================
   LOADING OVERLAY
   ============================================ */
.loading-overlay { 
    position: fixed; 
    top: 0; left: 0; right: 0; bottom: 0; 
    background: rgba(255, 255, 255, 0.95); 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    z-index: 2000; 
    transition: opacity 0.3s; 
}
.loading-overlay.hidden { opacity: 0; pointer-events: none; }
.spinner { 
    width: 50px; 
    height: 50px; 
    border: 5px solid #e0e0e0; 
    border-top-color: #003366; 
    border-radius: 50%; 
    animation: spin 1s linear infinite; 
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { 
    margin-top: 20px; 
    font-size: 16px; 
    color: #333;
    font-weight: 600;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) { 
    .dashboard-grid { grid-template-columns: 1fr; } 
    .gauges-section { grid-template-columns: repeat(4, 1fr); } 
    #map { min-height: 350px; } 
}
@media (max-width: 900px) { 
    .gauges-section { grid-template-columns: repeat(2, 1fr); } 
    .header {
        flex-direction: column;
        gap: 15px;
    }
    .header-center {
        order: 2;
    }
    .hero-description {
        width: 90%;
    }
    .nav {
        order: 3;
    }
}
@media (max-width: 768px) { 
    .logo-image { height: 120px; }
    .hero-title { font-size: 20px; }
    .hero-description { font-size: 14px; width: 100%; }
    .gauge-value { font-size: 32px; } 
    .date-controls { 
        flex-direction: column; 
        align-items: stretch; 
    }
    .date-controls input, .btn-icon {
        width: 100%;
        justify-content: center;
    }
    .subscribe-form { flex-direction: column; } 
    .subscribe-form input, .subscribe-form button { 
        border-radius: 4px;
        border: 2px solid #cccccc;
    }
    .subscribe-form .btn-primary { border-color: #003366; }
}

@media (prefers-reduced-motion: reduce) {
    .gauge-needle { transition: none; }
    .spinner { animation: none; }
    .modal-overlay { transition: none; }
}

@media print {
    .header, .footer, .modal-overlay, .loading-overlay, .date-controls, .subscribe-form { display: none; }
    body { background: white; color: black; }
}
