/* ==========================================================================
   Chesapeake Weather - Main Theme & Media Layout
   ========================================================================== */

/* Global Reset & Dark Theme Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #080808;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    align-items: center;
    justify-content: flex-start;
}

/* Content Layout Wrapper */
.content-area, .container {
    flex: 1 0 auto;
    width: 100%;
    max-width: 1150px;
    padding: 20px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

/* Typography Base */
h1 { 
    font-size: 2.5rem; 
    font-weight: 700; 
    margin-bottom: 10px; 
}

h2 { 
    color: #3b82f6; 
    border-bottom: 1px solid #333; 
    padding-bottom: 10px; 
    margin-top: 40px; 
    text-align: center; 
}

h3 { 
    color: #888888; 
    font-size: 0.9rem; 
    text-transform: uppercase; 
    margin-bottom: 20px; 
    letter-spacing: 1px; 
}

/* ==========================================================================
   Top Navigation Fix (CURRENT CONDITIONS | LIVE FEED | STATION INFO)
   ========================================================================== */

.nav-main {
    margin-bottom: 20px;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 16px !important;
}

.nav-main a {
    text-decoration: none !important;
    font-weight: bold !important;
    font-size: 1.05rem;
    font-family: sans-serif;
    white-space: nowrap !important; /* Prevents STATION INFO from splitting */
    color: #3b82f6;
    transition: color 0.2s ease;
}

.nav-main a:hover { 
    color: #ffffff; 
}

/* ==========================================================================
   Navigation Dropdowns & Menu Buttons
   ========================================================================== */

/* Dropdown Parent Wrapper */
.nav-dropdown {
    position: relative;
    display: inline-block;
    margin: 4px 6px;
}

/* Button Styling (Overrides default blue/gray browser links & buttons) */
.dropbtn {
    background-color: #1a1a1c !important;
    color: #e1e1e6 !important;
    padding: 10px 16px !important;
    font-size: 0.85rem !important;
    font-weight: bold !important;
    font-family: inherit !important;
    border: 1px solid #33333d !important;
    border-radius: 20px !important;
    cursor: pointer !important;
    transition: background 0.2s ease, border-color 0.2s ease !important;
    outline: none !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.5) !important;
}

.dropbtn:hover, 
.dropbtn:focus {
    background-color: #26262e !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
}

/* Hidden Dropdown Menu Box */
.dropdown-content {
    display: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 100%;
    margin-top: 8px;
    background-color: #121212 !important;
    min-width: 220px;
    box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.8);
    border: 1px solid #2a2a2a !important;
    border-radius: 8px;
    z-index: 1000;
    overflow: hidden;
    padding: 4px 0;
}

/* JS Active Class / Hover to Display Menu */
.dropdown-content.show,
.nav-dropdown:hover .dropdown-content {
    display: block !important;
}

/* Dropdown Menu Item Links */
.dropdown-content a,
.dropdown-content a:link,
.dropdown-content a:visited {
    color: #cccccc !important;
    padding: 12px 16px !important;
    text-decoration: none !important;
    display: block !important;
    font-size: 0.85rem !important;
    text-align: center !important;
    font-weight: 500 !important;
    border-bottom: 1px solid #1f1f1f !important;
    background-color: transparent !important;
    white-space: nowrap !important;
    transition: background 0.15s ease, color 0.15s ease !important;
}

.dropdown-content a:last-child {
    border-bottom: none !important;
}

.dropdown-content a:hover,
.dropdown-content a:active {
    background-color: #3b82f6 !important;
    color: #ffffff !important;
}

/* ==========================================================================
   Dashboard Grid & Centered Layout Fixes
   ========================================================================== */

.dashboard-grid { 
    display: flex; 
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 20px; 
    margin-bottom: 30px; 
}

.card, .sensor-card, .spec-item {
    background: #111111;
    border: 1px solid #2a2a2a;
    border-radius: 15px;
    padding: 30px;
    min-width: 280px;
    flex: 1 1 280px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    transition: transform 0.2s, border-color 0.2s;
}

.card:hover, .sensor-card:hover, .spec-item:hover {
    border-color: #444444;
    transform: translateY(-2px);
}

.highlight {
    border: 1px solid #1c1c1e;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.15);
}

/* Dynamic Centering for Station Identifiers & Grid Lists (Fixes 4th Item Offset) */
.precip-box { 
    background: #111111; 
    border: 1px solid #2a2a2a; 
    border-radius: 15px; 
    padding: 35px; 
    width: 100%; 
}

.precip-grid { 
    display: flex; 
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 20px; 
    margin-top: 20px; 
}

.precip-grid > div {
    background: #161618;
    border: 1px solid #2a2a2c;
    border-radius: 10px;
    padding: 20px;
    min-width: 220px;
    flex: 1 1 220px;
    max-width: 320px;
    text-align: center;
}

.precip-label { 
    color: #aaaaaa; 
    font-size: 0.85rem; 
    font-weight: bold;
    letter-spacing: 0.5px;
    margin-bottom: 8px; 
    text-transform: uppercase;
}

/* Text Metrics Sizing */
.sensor-value, .large-text {
    font-size: 3.2rem;
    font-weight: bold;
    margin: 10px 0;
}

.med-text {
    font-size: 1.3rem;
    font-weight: 600;
    color: #ffffff;
}

.sub-text {
    font-size: 0.95rem;
    color: #aaaaaa;
    margin-top: 8px;
}

/* Buttons & QC Badges */
.btn-qc {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.85rem;
    background: #32d74b;
    color: #000000;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-qc:hover { 
    opacity: 0.9;
    transform: translateY(-1px);
}

/* ==========================================================================
   Live Feed Section & Video Box
   ========================================================================== */

/* Live Indicator Header */
.live-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #ffffff;
    margin-top: 20px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

/* Pulsing Red Dot for Live Status */
.live-indicator .dot {
    height: 10px;
    width: 10px;
    background-color: #ff3b30;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    box-shadow: 0 0 8px #ff3b30;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(255, 59, 48, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0);
    }
}

/* Video Box Outer Container */
.video-box {
    width: 100%;
    background: #121212;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    margin-bottom: 25px;
}

/* Aspect-Ratio Maintained Video Wrapper (16:9 Responsive) */
.video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background-color: #000000;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #1f1f1f;
}

/* HTML5 Video Element inside Container */
.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    outline: none;
}

/* Offline State Placeholder */
.offline-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #888888;
    text-align: center;
    padding: 20px;
}

.offline-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.offline-placeholder h3 {
    color: #cccccc;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.offline-placeholder p {
    font-size: 0.85rem;
    max-width: 80%;
}

/* Stream Attribution Subtext */
.video-attribution {
    font-size: 0.85rem;
    color: #888888;
    text-align: right;
    margin-top: 8px;
}

.video-attribution strong {
    color: #cccccc;
}

/* ==========================================================================
   Footer Styling
   ========================================================================== */

footer {
    flex-shrink: 0;
    margin-top: auto;
    padding: 30px 0;
    text-align: center;
    font-size: 0.85rem;
    color: #777777;
    width: 100%;
    border-top: 1px solid #1f1f1f;
}

footer a {
    color: #3b82f6;
    text-decoration: none;
    transition: color 0.2s ease;
}

footer a:hover {
    color: #60a5fa;
    text-decoration: underline;
}

/* ==========================================================================
   Mobile & Responsive Optimizations
   ========================================================================== */
@media (max-width: 600px) {
    .content-area {
        padding: 10px;
    }
    
    .video-box {
        padding: 8px;
        border-radius: 8px;
    }
    
    .live-indicator {
        font-size: 0.85rem;
    }

    /* Top Nav Mobile Scaling */
    .nav-main {
        gap: 8px !important;
    }

    .nav-main a {
        font-size: 0.85rem !important;
    }

    /* Dropdown Mobile Layout */
    .nav-dropdown {
        display: block;
        margin: 8px auto;
        width: 100%;
    }

    .dropbtn {
        width: 100% !important;
    }

    .dropdown-content {
        position: static;
        transform: none;
        width: 100%;
        margin-top: 4px;
    }

    .precip-grid > div {
        max-width: 100%;
    }
}

/* ==========================================================================
   Sponsors & Partners Page Multi-Column Grid
   ========================================================================== */
.sponsor-category {
    margin-top: 35px;
    margin-bottom: 25px;
    width: 100%;
}

.category-title {
    color: #3b82f6;
    border-bottom: 1px solid #222222;
    padding-bottom: 8px;
    margin-bottom: 4px;
    font-size: 1.25rem;
    font-weight: 600;
}

.category-subtitle {
    color: #cccccc !important; /* Increased contrast from #888888 */
    font-size: 0.9rem;
    margin-top: 0;
    margin-bottom: 18px;
}

.sponsors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    width: 100%;
}

@media (min-width: 768px) {
    .sponsors-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .sponsors-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.sponsor-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
    background: #111111;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    box-sizing: border-box;
}

.sponsor-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
}

.partner-logo-container {
    width: 100%;
    height: 60px;
    background-color: #ffffff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    margin-top: 15px;
    margin-bottom: 12px;
    box-sizing: border-box;
    overflow: hidden;
}

.partner-logo-container img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.logo-fallback-text {
    color: #111111;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    text-align: center;
}

.sponsor-card h3 {
    margin: 4px 0 6px 0;
    font-size: 1rem;
    color: #ffffff;
}

.sponsor-card p {
    color: #e0e0e0 !important; /* Increased contrast from #aaaaaa */
    font-size: 0.95rem;
    line-height: 1.5;
    flex-grow: 1;
    margin: 0 0 16px 0;
}

.card-action {
    margin-top: auto;
}

.card-action .btn-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.82rem;
}
