/* ==========================================================================
   LDRRMO Bantay Panahon - Light Theme Dashboard (Official Colors)
   ========================================================================== */

:root {     
    --grid-gap: 16px;     
    --bg-color: #F0F2F5; /* Slightly deeper off-white to make white cards pop */
    --panel-bg: #ffffff; /* Clean white cards */
    --metric-bg: #f8fafc; /* Very light gray for metric boxes */
    --card-border: #94a3b8; /* Darkened border for robust separation */
    --inner-border: #e2e8f0; /* Soft border for internal elements */
    
    --text-primary: #1A05A2; /* Official Navy Blue for Titles */
    --text-dark: #1e293b; /* Deeper dark gray text for values */
    --text-secondary: #64748b; /* Muted gray text */
         
    --rain-light: #38bdf8;     
    --rain-yellow: #facc15;     
    --rain-orange: #f97316;     
    --rain-red: #ef4444;     
         
    --accent-blue: #0284c7;     
    --accent-green: #10b981;     
    --accent-amber: #f59e0b;     
    --danger-red: #dc2626;     
    --accent-purple: #9333ea;     
         
    --color-normal: #10b981;     
    --color-caution: #facc15;     
    --color-warning: #f97316;     
    --color-danger: #ef4444;     
         
    --aqi-good: #10b981;     
    --aqi-moderate: #facc15;     
    --aqi-sensitive: #f97316;     
    --aqi-unhealthy: #ef4444;     
    --aqi-very: #a855f7;     
    --aqi-hazardous: #9f1239;     
         
    --heat-normal: #10b981;     
    --heat-caution: #facc15;     
    --heat-extreme: #f97316;     
    --heat-danger: #ef4444;     
    --heat-critical: #9f1239;     
         
    --wind-normal: #0284c7;     
    --wind-sig1: #10b981;     
    --wind-sig2: #facc15;     
    --wind-sig3: #f97316;     
    --wind-sig4: #ef4444;     
    --wind-sig5: #a855f7;     
         
    --eq-safe: #10b981;     
    --eq-minor: #0284c7;     
    --eq-light: #facc15;     
    --eq-strong: #f97316;     
    --eq-major: #ef4444;     
         
    --status-safe: #10b981;     
    --status-watch: #facc15;     
    --status-warn: #f97316;     
    --status-danger: #ef4444;     
    --phivolcs-blue: #0284c7;     
}     

#panahon-dashboard {
    color: var(--text-dark);     
    font-family: system-ui, -apple-system, sans-serif;     
    overflow-x: hidden;     
}     

.parent {     
    display: grid;     
    grid-template-columns: repeat(4, 1fr);     
    grid-template-rows: auto auto 1fr;     
    gap: var(--grid-gap);     
    height: auto;     
    width: 100%;     
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--grid-gap);     
    box-sizing: border-box;     
}     

.parent > div {     
    background-color: var(--panel-bg);     
    border-radius: 8px;     
    border: 1px solid var(--card-border); /* Robust outer border */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1); /* Slightly deeper shadow for lift */
    overflow: auto;     
    display: flex;     
    flex-direction: column;     
    padding: 20px;     
    box-sizing: border-box;     
}     

.div1 { grid-area: 1 / 1 / 2 / 2; }     
.div2 { grid-area: 1 / 2 / 2 / 3; }     
.div3 { grid-area: 1 / 3 / 2 / 4; }     
.div4 { grid-area: 1 / 4 / 2 / 5; }     
.div5 { grid-area: 2 / 1 / 3 / 2; }     
.div6 { grid-area: 2 / 2 / 3 / 3; }     
.div7 { grid-area: 2 / 3 / 3 / 4; }     
.div8 { grid-area: 2 / 4 / 3 / 5; }     
     
.div9 {     
    grid-area: 3 / 1 / 4 / 5;     
    min-height: 600px;      
    position: relative;     
    padding: 0 !important;
    border: none !important; /* Remove border from iframe container to keep it flush */
    box-shadow: none !important;
}     

.div9 iframe {     
    position: absolute;     
    top: 0;     
    left: 0;     
    width: 100%;     
    height: 100%;     
    border: 1px solid var(--card-border); /* Border moved directly to iframe */
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}     

@media (max-width: 1024px) {     
    .parent {     
        height: auto;     
        min-height: 100vh;    
        grid-template-columns: repeat(2, 1fr);     
        grid-template-rows: auto;     
        grid-auto-rows: minmax(150px, auto);     
    }     
    .div1 { grid-area: 1 / 1 / 2 / 2; }     
    .div2 { grid-area: 1 / 2 / 2 / 3; }     
    .div3 { grid-area: 2 / 1 / 3 / 2; }     
    .div4 { grid-area: 2 / 2 / 3 / 3; }     
    .div5 { grid-area: 3 / 1 / 4 / 2; }     
    .div6 { grid-area: 3 / 2 / 4 / 3; }     
    .div7 { grid-area: 4 / 1 / 5 / 2; }     
    .div8 { grid-area: 4 / 2 / 5 / 3; }     
    .div9 { grid-area: 5 / 1 / 9 / 3; height: 70vh; }     
}     

@media (max-width: 600px) {     
    .parent { grid-template-columns: 1fr; }     
    .div1 { grid-area: 1 / 1 / 2 / 2; }     
    .div2 { grid-area: 2 / 1 / 3 / 2; }     
    .div3 { grid-area: 3 / 1 / 4 / 2; }     
    .div4 { grid-area: 4 / 1 / 5 / 2; }     
    .div5 { grid-area: 5 / 1 / 6 / 2; }     
    .div6 { grid-area: 6 / 1 / 7 / 2; }     
    .div7 { grid-area: 7 / 1 / 8 / 2; }     
    .div8 { grid-area: 8 / 1 / 9 / 2; }     
    .div9 { grid-area: 9 / 1 / 10 / 2; height: 80vh; }     
}     
    
.global-header {    
    background-color: transparent;     
    padding: 20px 0px;    
    display: flex;    
    justify-content: space-between;    
    align-items: center;    
    border-bottom: 2px solid var(--card-border); /* Thicker separation line for header */
    max-width: 1400px;
    margin: 0 auto 20px auto;  
}    
    
.header-left { display: flex; flex-direction: column; gap: 4px; }    
.header-title-row { display: flex; align-items: center; gap: 12px; }    
.header-title { font-size: 2.5rem; font-weight: 800; color: var(--text-primary); margin: 0; line-height: 1; }    
.header-subtitle { font-size: 1rem; color: #D53E0F; margin: 0; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;}    
.header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }    
.header-time { font-size: 1.25rem; font-weight: 700; color: var(--text-dark); margin: 0; line-height: 1; }    
.header-date { font-size: 0.9rem; color: var(--text-secondary); margin: 0; }    

.card-header {     
    display: flex; justify-content: space-between; align-items: flex-start;     
    margin-bottom: auto; border-bottom: 1px solid var(--inner-border); /* Softer inner line */
    padding-bottom: 12px; margin-bottom: 12px;     
}     

.station-info h1 { font-size: 1.1rem; font-weight: 800; color: var(--text-primary); margin: 0; line-height: 1.2; text-transform: uppercase; }     
.station-info p { font-size: 0.75rem; color: var(--text-secondary); margin: 2px 0 0 0; text-transform: uppercase; letter-spacing: 0.05em; }     
.time-badge { display: none !important; }     
.card-footer { display: none !important; }     
         
.status-banner { border-radius: 8px; padding: 8px; text-align: center; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; font-size: 0.8rem; display: none; }     
.status-desc { font-size: 0.7rem; font-weight: 600; text-transform: none; margin-top: 4px; opacity: 0.9; }     
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }     

/* Metric Boxes */
.metric-box { 
    background: var(--metric-bg); 
    border: 1px solid var(--inner-border); /* Crisp inner border */
    border-radius: 8px; 
    padding: 12px; 
    text-align: left; 
    position: relative; 
    transition: all 0.3s ease; 
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); /* Very subtle inset shadow for depth */
}     
.metric-label { font-size: 0.65rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; margin-bottom: 4px; }     
.metric-value { font-size: 1.35rem; font-weight: 800; color: var(--text-dark); font-variant-numeric: tabular-nums; }     
.metric-unit { font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; }     
.metric-status { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; margin-top: 6px; }     
.error-text { color: var(--danger-red); font-weight: bold; }     
         
/* Large Display Boxes */
.rain-box, .main-display-container, .eq-container, .primary-datum-box, .threat-module { 
    background: var(--metric-bg); 
    border: 1px solid var(--inner-border); 
    border-radius: 8px; 
    padding: 16px 12px; 
    text-align: center; 
    margin-bottom: 12px; 
    transition: border-color 0.3s ease; 
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}     

.rain-value { font-size: 3rem; font-weight: 800; color: var(--text-dark); line-height: 1; margin: 8px 0; }     
.rain-unit { font-size: 1rem; font-weight: 600; }     
         
.live-badge { display: flex; align-items: center; gap: 6px; background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.3); color: var(--accent-green); padding: 2px 8px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; }     
.pulse-dot { width: 6px; height: 6px; background-color: var(--accent-green); border-radius: 50%; animation: pulse 2s infinite; }     
@keyframes pulse { 0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); } 70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); } 100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); } }     

.primary-value { font-size: 2.5rem; font-weight: 800; color: var(--text-primary); line-height: 1; margin: 6px 0; }     
.primary-label { font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; }     
.primary-subtext { font-size: 0.65rem; color: #D53E0F; margin-top: 4px; font-weight: 700; }     

.secondary-datum-box { display: flex; justify-content: space-between; align-items: center; background-color: var(--metric-bg); border: 1px solid var(--inner-border); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }     
.refresh-notification { font-size: 0.7rem; color: var(--accent-green); font-weight: 700; opacity: 0; transition: opacity 0.4s ease-in-out; }     
.refresh-notification.active { opacity: 1; }     
.time-container { display: none !important; }     
    
.alert-badge { margin-top: 8px; padding: 4px 8px; border-radius: 4px; font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; text-align: center; color: #fff;}     
         
.main-display-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 6px; }     
.main-display-value { font-size: 3rem; font-weight: 800; line-height: 1; margin-bottom: 8px; color: var(--text-dark); }     
.main-display-unit { font-size: 1.25rem; color: var(--text-secondary); font-weight: 600; }     
         
.eq-value { font-size: 1.5rem; font-weight: 800; color: var(--text-dark); line-height: 1.2; margin-bottom: 6px; }     
.eq-meta { font-size: 0.75rem; color: var(--text-secondary); font-weight: 600; }     

.history-wrapper { background-color: var(--metric-bg); border: 1px solid var(--inner-border); border-radius: 8px; padding: 12px; margin-bottom: 12px; flex: 1; overflow-y: auto; box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);}     
.history-header { font-size: 0.65rem; color: var(--text-primary); text-transform: uppercase; font-weight: 800; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--inner-border); }     
.history-list { display: flex; flex-direction: column; gap: 8px; }     
.history-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; color: var(--text-dark); font-weight: 600;}     
.history-info { display: flex; flex-direction: column; gap: 2px; }     
.history-date { font-size: 0.6rem; color: var(--text-secondary); font-weight: normal;}     
.mag-badge { padding: 4px 8px; border-radius: 4px; font-weight: 800; font-size: 0.7rem; background-color: var(--card-border); color: #fff; }     

.module-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--inner-border); }     
.module-title { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; }     
.module-status { font-size: 0.7rem; font-weight: 800; padding: 2px 8px; border-radius: 20px; background-color: var(--card-border); color: #fff; }     
.tsunami-meta { font-size: 0.75rem; color: var(--text-dark); line-height: 1.3; font-weight: 600;}     
.river-desc { font-size: 0.7rem; color: var(--text-dark); line-height: 1.3; background-color: #ffffff; padding: 8px; border-radius: 6px; margin-top: 8px; border: 1px solid var(--inner-border); font-weight: 600;}     
    
@keyframes danger-pulse {    
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); border-color: var(--danger-red); }    
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); border-color: #ff7b7b; }    
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); border-color: var(--danger-red); }    
}    
    
.danger-alert-zone {    
    animation: danger-pulse 1.5s infinite;    
    border-width: 2px !important;    
    border-style: solid !important;    
}    

.alert-toggle-btn {    
    background-color: var(--panel-bg);    
    border: 1px solid var(--card-border);    
    color: var(--text-primary);    
    padding: 8px 16px;    
    border-radius: 4px;    
    cursor: pointer;    
    font-weight: 700;    
    display: flex;    
    align-items: center;    
    gap: 8px;    
    transition: all 0.2s;    
}    
    
.alert-toggle-btn.btn-danger {    
    background-color: var(--danger-red);    
    color: white;    
    border-color: #ff7b7b;    
    animation: danger-pulse 1.5s infinite;    
}    
    
.alert-toggle-btn.btn-danger:hover {    
    background-color: #dc2626;    
}    

.alert-toggle-btn:hover {    
    background-color: var(--metric-bg);    
}    

.alert-toggle-btn.muted {    
    opacity: 0.7;    
    color: var(--text-secondary);    
}