/* =========================
   INSTITUTIONAL BRAND THEME
   ========================= */

:root {
    --brand-primary: #984242;   /* Former red indicators */
    --brand-secondary: #E6C96D; /* Former yellow indicators */
    --brand-positive: #334567;  /* Former green indicators (now institutional blue) */

    --bg-main: #f4f6f8;
    --panel-bg: #ffffff;
    --panel-border: #e3e6ea;

    --text-main: #2c3e50;
    --text-muted: #6b7280;
}

/* =========================
   BASE LAYOUT
   ========================= */

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg-main);
    color: var(--text-main);
}

/* =========================
   HEADER (Institutional Style)
   ========================= */

.dashboard-header {
    background: var(--panel-bg);
    border-bottom: 4px solid var(--brand-primary);
    padding: 20px 28px 16px 28px;
}

.dashboard-header h1 {
    margin: 0;
    font-size: 24px;
    letter-spacing: 0.4px;
}

.dashboard-subtitle {
    margin-top: 6px;
    font-size: 14px;
    color: var(--text-muted);
}

/* =========================
   DASHBOARD GRID (Flexible Rows)
   ========================= */

.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 26px;
    padding: 26px 28px 40px 28px;
}

/* =========================
   WIDGET PANELS (Institutional Soft Cards)
   ========================= */

.widget-panel {
    background: var(--panel-bg);
    border-radius: 12px;
    border: 1px solid var(--panel-border);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.widget-panel:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

/* Draggable Header Bar */
.widget-header {
    padding: 12px 16px;
    background: #fafafa;
    border-bottom: 1px solid var(--panel-border);
    cursor: grab;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
}

.widget-header:active {
    cursor: grabbing;
    background: #f0f0f0;
}

/* =========================
   IFRAME WIDGET CONTAINERS
   ========================= */

.widget-frame {
    width: 100%;
    height: 440px;
    border: none;
    background: #ffffff;
}

/* Larger analytical widgets */
.widget-large .widget-frame {
    height: 620px;
}

/* =========================
   SLIDE-OUT CONTROL PANEL
   (Upper Right Hover)
   ========================= */

/* Invisible hover zone */
#controlTrigger {
    position: fixed;
    top: 0;
    right: 0;
    width: 50px;
    height: 100px;
    z-index: 1000;
}

/* Panel container */
#controlPanel {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: #ffffff;
    border-left: 4px solid var(--brand-primary);
    box-shadow: -3px 0 14px rgba(0, 0, 0, 0.08);
    padding: 22px 18px;
    transition: right 0.3s ease;
    z-index: 1001;
}

/* Visible state */
#controlPanel.visible {
    right: 0;
}

#controlPanel h3 {
    margin-top: 0;
    margin-bottom: 18px;
    color: var(--brand-positive);
    font-size: 16px;
    letter-spacing: 0.3px;
}

/* Control Buttons (Institutional style) */
#controlPanel button {
    width: 100%;
    padding: 11px 12px;
    margin-bottom: 12px;
    border: none;
    border-radius: 6px;
    background: var(--brand-positive);
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.05s ease;
}

#controlPanel button:hover {
    background: #2a3957;
}

#controlPanel button:active {
    transform: scale(0.98);
}

/* =========================
   DRAGGING VISUAL FEEDBACK
   ========================= */

.widget-panel[draggable="true"] {
    user-select: none;
}

.widget-panel.dragging {
    opacity: 0.5;
}

.widget-container {
    padding: 14px 16px 16px 16px;
}

.header-line {
    font-size: 14px;
    color: #444;
    margin-bottom: 10px;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
}

.slider-row input[type="range"] {
    flex: 1;
}

.slider-value {
    min-width: 40px;
    font-weight: bold;
    color: var(--theme-blue);
}

/* Table styling (restored look) */
.coverage-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 6px;
    overflow: hidden;
}

.coverage-table th {
    text-align: left;
    font-size: 13px;
    padding: 10px 10px;
    background: #e9e9e9;
    color: #000;
}

.coverage-table td {
    padding: 9px 10px;
    font-size: 14px;
    border-top: 1px solid #d0d0d0;
}

.coverage-table tr:nth-child(even) {
    background: #f6f6f6;
}

/* Weak row shading (like your screenshot) */
.row-weak {
    background: rgba(152, 66, 66, 0.20) !important;
}

.row-moderate {
    background: rgba(230, 201, 109, 0.35) !important;
}

/* Coverage bar */
.bar-container {
    width: 100%;
    height: 16px;
    background: #d9d9d9;
    border-radius: 10px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.6s ease;
}

.bar-strong {
    background: #334567;
}

.bar-moderate {
    background: #E6C96D;
}

.bar-weak {
    background: #984242;
}

/* =========================
   RESPONSIVE (Still Institutional, Not Grid-Heavy)
   ========================= */

@media (max-width: 1100px) {
    .widget-frame {
        height: 520px;
    }

    .widget-large .widget-frame {
        height: 700px;
    }
}

@media (max-width: 700px) {
    .dashboard-grid {
        padding: 18px 16px 30px 16px;
        gap: 20px;
    }

    .dashboard-header {
        padding: 16px 18px 14px 18px;
    }

    .dashboard-header h1 {
        font-size: 20px;
    }
}

