/* EagleIV Dashboard Styles */

/* Override body for scrollable dashboard */
body.dashboard-body {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
    background: #f5f5f5;
}

/* Header Navigation */
.header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 32px;
}

.nav-link {
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover {
    color: #333;
    background: #f5f5f5;
}

.nav-link.active {
    color: #00bfa5;
    background: #e8f5f3;
    font-weight: 600;
}

/* Dashboard Container */
.dashboard-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px 24px 40px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 20px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    margin-bottom: 16px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-label {
    font-size: 10px;
    font-weight: 600;
    color: #999;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.filter-group-wide {
    min-width: 240px;
}

.filter-group-time {
    min-width: 160px;
}

/* ── Multi-Select Trigger ── */
.ms-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    color: #333;
    background: white;
    cursor: pointer;
    min-width: 110px;
    max-width: 260px;
    transition: border-color 0.2s;
    user-select: none;
}

.ms-trigger:hover {
    border-color: #bbb;
}

.ms-trigger-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.ms-trigger-arrow {
    color: #999;
    font-size: 10px;
    flex-shrink: 0;
}

/* ── Multi-Select Dropdown ── */
.ms-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 260px;
    max-width: 400px;
    display: none;
    z-index: 200;
}

.ms-dropdown.ms-open {
    display: block;
}

.ms-dropdown-time {
    min-width: 320px;
    padding: 16px;
}

/* Search */
.ms-search {
    padding: 8px 10px 4px;
}

.ms-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
}

.ms-search input:focus {
    border-color: #00bfa5;
}

/* Toolbar */
.ms-toolbar {
    display: flex;
    gap: 4px;
    padding: 4px 10px 6px;
    border-bottom: 1px solid #f0f0f0;
}

.ms-toolbar-btn {
    background: none;
    border: none;
    font-size: 11px;
    font-family: 'Inter', sans-serif;
    color: #00bfa5;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.ms-toolbar-btn:hover {
    background: #e8f5f3;
}

/* Options list */
.ms-options {
    max-height: 280px;
    overflow-y: auto;
    padding: 4px 0;
}

.ms-options::-webkit-scrollbar {
    width: 5px;
}

.ms-options::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.ms-option {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    font-size: 11.5px;
    color: #333;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
    line-height: 1.3;
}

.ms-option:hover {
    background: #f5f5f5;
}

.ms-option input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 13px;
    height: 13px;
    margin: 0;
    border: 1.5px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: all 0.15s;
    background: white;
}

.ms-option input[type="checkbox"]:checked {
    background: #00bfa5;
    border-color: #00bfa5;
}

.ms-option input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 1px;
    width: 4px;
    height: 7px;
    border: solid white;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
}

.ms-option input[type="checkbox"]:indeterminate {
    background: #00bfa5;
    border-color: #00bfa5;
}

.ms-option input[type="checkbox"]:indeterminate::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 4.5px;
    width: 7px;
    height: 0;
    border-bottom: 1.5px solid white;
}

.ms-option.ms-parent {
    font-weight: 600;
    color: #222;
}

.ms-option.ms-parent > span {
    font-weight: 600;
}

.ms-no-results {
    padding: 12px 16px;
    font-size: 12px;
    color: #999;
    text-align: center;
}

/* ── Time Range Slider ── */
.time-slider-wrap {
    position: relative;
    height: 32px;
    margin: 8px 0 4px;
}

.time-slider-track {
    position: absolute;
    top: 14px;
    left: 0;
    right: 0;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
}

.time-slider-fill {
    position: absolute;
    top: 0;
    height: 100%;
    background: #00bfa5;
    border-radius: 2px;
}

.time-slider-input {
    position: absolute;
    top: 4px;
    left: 0;
    width: 100%;
    height: 24px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
    padding: 0;
}

.time-slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00bfa5;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    pointer-events: auto;
}

.time-slider-input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #00bfa5;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    pointer-events: auto;
}

.time-slider-ticks {
    display: flex;
    justify-content: space-between;
    font-size: 9px;
    color: #999;
    padding: 2px 0 12px;
    font-family: monospace;
}

.time-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.time-input-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.time-input-label {
    font-size: 10px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.time-input {
    width: 70px;
    padding: 5px 8px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    font-size: 13px;
    font-family: monospace;
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.time-input:focus {
    border-color: #00bfa5;
}

.time-input-sep {
    font-size: 12px;
    color: #999;
    padding-bottom: 6px;
}

/* Sentinel Events Banner */
.sentinel-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    border: 1px solid #f5c6cb;
    border-left: 4px solid #d32f2f;
    border-radius: 10px;
    margin-bottom: 20px;
}

.sentinel-icon {
    font-size: 22px;
    color: #d32f2f;
    flex-shrink: 0;
}

.sentinel-text {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sentinel-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.sentinel-count {
    font-size: 22px;
    font-weight: 700;
    color: #d32f2f;
}

.sentinel-review-btn {
    padding: 8px 20px;
    background: #d32f2f;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.2s;
}

.sentinel-review-btn:hover {
    background: #b71c1c;
}

/* Section */
.section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    padding-left: 4px;
}

.section-subtitle {
    font-weight: 400;
    letter-spacing: 0.5px;
    color: #bbb;
    font-size: 10px;
}

/* Overview Grid */
.overview-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 12px;
}

/* Stat Cards */
.stat-card {
    background: white;
    border-radius: 10px;
    padding: 16px 20px;
    border: 1px solid #e0e0e0;
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.stat-card-tall {
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
}

.stat-icon-large {
    font-size: 28px;
    color: #00bfa5;
    margin-bottom: 4px;
}

.stat-value-large {
    font-size: 36px;
    font-weight: 700;
    color: #333;
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 6px;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
}

.stat-value-xl {
    font-size: 28px;
}

.stat-pct {
    font-size: 13px;
    font-weight: 500;
    color: #999;
}

.stat-detail {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

/* Card color variants */
.stat-card-primary {
    border-left: 4px solid #00bfa5;
}

.stat-card-primary .stat-value,
.stat-card-primary .stat-value-large {
    color: #00bfa5;
}

.stat-card-warn {
    border-left: 4px solid #ffc107;
}

.stat-card-warn .stat-value {
    color: #e6a700;
}

.stat-card-info {
    border-left: 4px solid #1976d2;
}

.stat-card-info .stat-value {
    color: #1976d2;
}

.stat-card-danger {
    border-left: 4px solid #d32f2f;
}

.stat-card-danger .stat-value {
    color: #d32f2f;
}

.stat-card-success {
    border-left: 4px solid #2e7d32;
    background: #f0fdf4;
}

.stat-card-success .stat-value {
    color: #2e7d32;
}

.stat-card-neutral {
    border-left: 4px solid #9e9e9e;
}

.stat-card-neutral .stat-value {
    color: #616161;
}

.stat-card-highlight {
    background: linear-gradient(135deg, #f0fdf4 0%, #e8f5e9 100%);
    border: 1px solid #a5d6a7;
}

/* Accuracy Section */
.accuracy-row {
    margin-bottom: 12px;
}

.accuracy-row:last-child {
    margin-bottom: 0;
}

.accuracy-row-label {
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 8px;
    padding-left: 4px;
}

.accuracy-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Chart Section */
.chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.chart-row:last-child {
    margin-bottom: 0;
}

.chart-card {
    background: white;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    overflow: hidden;
    transition: all 0.2s;
}

.chart-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px 0;
}

.chart-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.chart-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-badge-accuracy {
    background: #e3f2fd;
    color: #1565c0;
}

.chart-badge-sterility {
    background: #e8f5f3;
    color: #00897b;
}

.chart-badge-safety {
    background: #ffebee;
    color: #c62828;
}

.chart-badge-mitigated {
    background: #e8f5e9;
    color: #2e7d32;
}

.chart-body {
    padding: 12px 18px 16px;
    position: relative;
    height: 220px;
}

.chart-body canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Scrollbar for dashboard */
.dashboard-body::-webkit-scrollbar {
    width: 8px;
}

.dashboard-body::-webkit-scrollbar-track {
    background: #f5f5f5;
}

.dashboard-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.dashboard-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Sentinel Review Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    background: white;
    border-radius: 12px;
    width: 640px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: translateY(10px);
    transition: transform 0.2s;
}

.modal-overlay.visible .modal-card {
    transform: translateY(0);
}

.modal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-card-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-card-header h3 span {
    color: #d32f2f;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.modal-card-body {
    padding: 24px;
}

.modal-field {
    margin-bottom: 16px;
}

.modal-field:last-child {
    margin-bottom: 0;
}

.modal-field-label {
    font-size: 10px;
    font-weight: 600;
    color: #999;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.modal-field-value {
    font-size: 13px;
    color: #333;
    line-height: 1.6;
}

.modal-severity {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #ffebee;
    color: #c62828;
}

.modal-card-footer {
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
}

.modal-btn-close {
    padding: 8px 24px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-close:hover {
    background: #e0e0e0;
}

/* Modal close button */
.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    line-height: 1;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* Modal body */
.modal-body {
    padding: 20px 24px;
}

.modal-event-id {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fafafa;
    border-radius: 6px;
    margin-bottom: 16px;
}

.modal-event-id .modal-field-label {
    margin-bottom: 0;
}

.modal-event-id .modal-field-value {
    font-family: monospace;
    font-weight: 600;
    font-size: 13px;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
    margin-bottom: 20px;
}

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

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

.modal-order-detail {
    font-size: 13px;
    color: #333;
    padding: 12px 14px;
    background: #f5f5f5;
    border-radius: 6px;
    line-height: 1.5;
    font-weight: 500;
}

/* Alert box */
.modal-alert-box {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    border: 1px solid #f5c6cb;
    border-left: 4px solid #d32f2f;
    border-radius: 8px;
}

.modal-alert-icon {
    font-size: 20px;
    color: #d32f2f;
    flex-shrink: 0;
    line-height: 1.4;
}

.modal-alert-box p {
    margin: 6px 0 0;
    font-size: 12px;
    color: #555;
    line-height: 1.6;
}

.modal-alert-box strong {
    color: #333;
}

/* Detection steps */
.modal-detection-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-step {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
    color: #444;
    line-height: 1.5;
}

.modal-step-num {
    width: 22px;
    height: 22px;
    background: #00bfa5;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Resolution */
.modal-resolution {
    font-size: 12px;
    color: #444;
    line-height: 1.6;
    padding: 12px 14px;
    background: #f0fdf4;
    border-left: 3px solid #2e7d32;
    border-radius: 6px;
}

/* Impact */
.modal-impact {
    font-size: 12px;
    color: #444;
    line-height: 1.6;
    padding: 12px 14px;
    background: #fff5f5;
    border-left: 3px solid #d32f2f;
    border-radius: 6px;
}

.modal-impact-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #d32f2f;
    color: white;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 6px;
    vertical-align: middle;
}

/* Modal footer */
.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
}

.modal-btn-secondary {
    padding: 8px 24px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-secondary:hover {
    background: #e0e0e0;
}

/* Modal header/body/footer layout */
.modal-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
}

.modal-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.modal-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.modal-event-detail {
    padding: 16px 20px;
    font-size: 13px;
    color: #333;
    line-height: 1.6;
}

.modal-event-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.modal-event-label {
    width: 160px;
    font-size: 12px;
    color: #666;
    flex-shrink: 0;
}

.modal-event-value {
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.modal-event-value.critical {
    color: #d32f2f;
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .overview-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .stat-card-tall {
        grid-row: auto;
        grid-column: 1 / -1;
    }

    .chart-row {
        grid-template-columns: 1fr;
    }

    .filter-select-wide {
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        padding: 12px;
    }

    .overview-grid {
        grid-template-columns: 1fr 1fr;
    }

    .accuracy-cards {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        gap: 8px;
    }

    .filter-select-wide {
        min-width: 160px;
    }
}
