/* MIT AIRI Delphi Dashboard - Main Styles */

/* ===== BASE STYLES ===== */
body {
    font-family: 'Figtree', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    min-height: 100vh;
}

.matrix-container {
    background: white;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-width: 2400px;
    margin: 20px auto;
    overflow-x: auto;
    border: 3px solid #000;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, #a31e38 0%, #8a1830 100%);
    color: white;
    padding: 15px 35px;
    display: flex;
    align-items: center;
    gap: 20px;
    overflow: visible;
    position: relative;
}

.header h1 {
    margin: 0;
    font-size: 42px;
    font-weight: 700;
    text-align: center;
    flex: 1;
    letter-spacing: -0.5px;
    margin-right: 120px;
}

.brand-logo {
    height: 120px;
    width: auto;
    position: relative;
    z-index: 10;
}

.round-badge {
    position: absolute;
    top: 10px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
}

/* ===== CONTROLS ===== */
.controls {
    background: #e8e8e8;
    padding: 15px 20px;
    border-bottom: 2px solid #000;
    display: flex;
    gap: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.dropdown-container {
    position: relative;
    display: inline-block;
}

.dropdown-button {
    background: white;
    border: 2px solid #333;
    border-radius: 4px;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 500;
    font-family: 'Figtree', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dropdown-button:hover {
    border-color: #a31e38;
    background-color: #fafafa;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.dropdown-arrow {
    border: solid #666;
    border-width: 0 2px 2px 0;
    padding: 3px;
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    margin-left: auto;
}

.dropdown-button.open .dropdown-arrow {
    transform: rotate(-135deg);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 100%;
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
    border: 1px solid #ddd;
    border-radius: 6px;
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    top: 100%;
    left: 0;
    margin-top: 5px;
}

.dropdown-content.show {
    display: block;
}

.dropdown-header {
    padding: 15px 20px;
    border-bottom: 2px solid #ddd;
    background: #f8f8f8;
    display: flex;
    gap: 10px;
}

.dropdown-header button {
    padding: 8px 16px;
    border: 1px solid #666;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

.dropdown-header button:hover {
    background: #a31e38;
    color: white;
    border-color: #a31e38;
}

.dropdown-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Figtree', sans-serif;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-item:hover {
    background-color: #f8f8f8;
}

.dropdown-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

.item-code {
    font-weight: 600;
    color: #333;
    min-width: 35px;
    flex-shrink: 0;
}

.item-title {
    flex: 1;
    color: #333;
    line-height: 1.4;
}

.display-options {
    display: flex;
    gap: 20px;
    align-items: center;
}

.checkbox-group {
    display: flex;
    gap: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ===== TABLE ===== */
.table-wrapper {
    padding: 30px;
    background: #fafafa;
    overflow-x: auto;
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 1200px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.matrix-table th,
.matrix-table td {
    border: 1.5px solid #000;
    padding: 8px;
    text-align: center;
    vertical-align: middle;
    position: relative;
}

.matrix-table th:first-child,
.matrix-table td:first-child {
    width: 320px;
    text-align: left;
    padding: 10px 12px;
    font-size: 16px;
}

.matrix-table th:first-child.corner-label {
    text-align: center;
}

.category-header {
    background: white;
    color: #333;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    height: 45px;
}

.matrix-table th.corner-label {
    background: white !important;
    color: #333 !important;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
}

.actor-header {
    background: #4a4a4a;
    color: white;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.3;
    word-wrap: break-word;
    min-width: 140px;
    max-width: 180px;
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 8px 6px;
}

.actor-header:hover {
    background: #5a5a5a;
}

.sector-header {
    background: #4a4a4a;
    color: white;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.3;
    word-wrap: break-word;
    min-width: 140px;
    max-width: 180px;
    cursor: pointer;
    transition: background 0.2s ease;
    padding: 8px 6px;
}

.sector-header:hover {
    background: #5a5a5a;
}

.risk-label {
    background: #4a4a4a;
    color: white;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease;
}

.risk-label:hover {
    background: #5a5a5a;
}

/* ===== RESPONSIBILITY LEVELS ===== */
.resp-1 { background-color: #2c7bb6; color: white; }
.resp-2 { background-color: #abd9e9; color: black; }
.resp-3 { background-color: #ffffbf; color: black; }
.resp-4 { background-color: #fdae61; color: black; }
.resp-5 { background-color: #d7191c; color: white; }

.cell {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.15s ease;
    font-size: 14px;
    font-weight: 700;
    height: 60px;
}

.cell:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    z-index: 10;
    filter: brightness(1.1);
    outline: 3px solid #000;
    outline-offset: -3px;
}

/* ===== MINI BAR CHART ===== */
.mini-chart {
    display: flex;
    height: 5px;
    width: 55px;
    margin: 4px auto;
    border-radius: 1px;
    overflow: hidden;
    background-color: white;
    border: 1px solid #999;
}

.mini-bar {
    height: 100%;
}

.mini-bar.resp-1 { background-color: #2c7bb6; }
.mini-bar.resp-2 { background-color: #abd9e9; }
.mini-bar.resp-3 { background-color: #ffffbf; }
.mini-bar.resp-4 { background-color: #fdae61; }
.mini-bar.resp-5 { background-color: #d7191c; }

/* ===== NON-CONSENSUS MARKER ===== */
.non-consensus-marker {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 18px;
    font-weight: 700;
    color: white;
    line-height: 1;
    text-shadow:
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        1px 1px 0 #000,
        0 0 3px rgba(0,0,0,0.8);
    cursor: help;
    pointer-events: none;
}

/* ===== HIDDEN ===== */
.hidden-row {
    display: none !important;
}

.hidden-col {
    display: none !important;
}

/* ===== LEGEND ===== */
.legend {
    background: #e8e8e8;
    padding: 25px 30px;
    border-top: 2px solid #000;
}

.legend-section {
    margin-bottom: 20px;
}

.legend-section:last-child {
    margin-bottom: 0;
}

.legend-title {
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 10px;
}

.legend-items {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.legend-color {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    border: 2px solid #333;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* ===== FOOTER ===== */
.footer {
    background: linear-gradient(135deg, #a31e38 0%, #8a1830 100%);
    color: white;
    padding: 20px 30px;
    text-align: center;
    font-size: 14px;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    overflow-y: auto;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

/* Larger modals for actor and risk views */
#actorModal .modal-content,
#riskModal .modal-content {
    max-width: 1600px;
    width: 95%;
}

/* Extra wide modal for sector views (14 sectors need more space) */
#sectorModal .modal-content {
    max-width: 1800px;
    width: 98%;
}

.modal-header {
    background: linear-gradient(135deg, #a31e38 0%, #8a1830 100%);
    color: white;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
}

.modal-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    flex: 1;
}

.modal-subtitle {
    font-size: 15px;
    color: #fff;
    margin: 10px 0 0 0;
    font-weight: 400;
    line-height: 1.5;
    opacity: 0.95;
    max-width: 90%;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    color: #bbb;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.close:hover {
    color: #fff;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 36px;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.modal-close:hover {
    background: rgba(255,255,255,0.2);
}

.modal-body {
    padding: 0;
    background-color: #1a1a1a;
}

/* White background for cell detail modal content */
#detailModal .modal-body {
    background-color: #ffffff;
    padding: 0;
}

.expert-responses {
    padding: 10px 30px 25px 30px;
    background-color: #ffffff;
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid #ddd;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    border: none;
    padding: 0;
}

.indicator-pills {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}


.pill {
    background: #f0f0f0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pill-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.distribution-chart {
    margin: 20px 0;
}

.dist-bar {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.dist-label {
    width: 120px;
    font-weight: 600;
    font-size: 14px;
}

.dist-bar-container {
    flex: 1;
    height: 30px;
    background: #f0f0f0;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
    margin: 0 10px;
}

.dist-bar-fill {
    height: 100%;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.dist-count {
    min-width: 80px;
    text-align: right;
    font-size: 14px;
}

.median-indicator {
    border: 2px solid #a31e38;
}

/* ===== CORNER CELL (blank top-left) ===== */
#actorHeaderRow th:first-child {
    background: white !important;
    background-color: white !important;
    border: 1.5px solid #000 !important;
}
