/* ============================================
   NIS2 Assessment Tool - Professional Theme
   ============================================ */

:root {
    --primary: #1a56db;
    --primary-dark: #1240a8;
    --primary-light: #e8eeff;
    --accent: #0ea5e9;
    --success: #198754;
    --warning: #ffc107;
    --danger: #dc3545;
    --sidebar-width: 280px;
    --navbar-height: 56px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --heatmap-1: #dc3545;
    --heatmap-2: #fd7e14;
    --heatmap-3: #ffc107;
    --heatmap-4: #20c997;
    --heatmap-5: #198754;
    --heatmap-0: #e9ecef;
}

[data-bs-theme="dark"] {
    --primary-light: #1e293b;
    --heatmap-0: #374151;
}

* { font-family: var(--font-family); }

body {
    background: #f4f6f9;
    min-height: 100vh;
    overflow-x: hidden;
}

[data-bs-theme="dark"] body { background: #0f172a; }

/* Navbar */
.bg-primary-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%) !important;
}

.navbar-brand { font-size: 1.15rem; letter-spacing: -0.02em; }

/* Layout */
.main-container {
    display: flex;
    margin-top: var(--navbar-height);
    min-height: calc(100vh - var(--navbar-height));
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid #e5e7eb;
    padding: 1.25rem;
    position: fixed;
    top: var(--navbar-height);
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
}

[data-bs-theme="dark"] .sidebar {
    background: #1e293b;
    border-right-color: #334155;
}

.sidebar-header { margin-bottom: 1rem; }

.progress-bar-container { padding-right: 0.25rem; }

.step-nav { list-style: none; padding: 0; margin: 0; }

.step-nav-item {
    display: flex;
    align-items: center;
    padding: 0.55rem 0.75rem;
    margin-bottom: 2px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    color: #6b7280;
    gap: 0.65rem;
}

.step-nav-item:hover { background: var(--primary-light); color: var(--primary); }

.step-nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.step-nav-item.completed { color: var(--success); }

.step-nav-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    flex-shrink: 0;
    background: #e5e7eb;
    color: #9ca3af;
    font-weight: 600;
    transition: all 0.2s;
}

.step-nav-item.active .step-nav-icon {
    background: var(--primary);
    color: #fff;
}

.step-nav-item.completed .step-nav-icon {
    background: var(--success);
    color: #fff;
}

/* Content Area */
.content-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 2.5rem 6rem;
    max-width: calc(100% - var(--sidebar-width));
}

/* Wizard Steps */
.wizard-step { display: none; animation: fadeIn 0.3s ease; }
.wizard-step.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Step Header */
.step-header { margin-bottom: 1.5rem; }
.step-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.step-header h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.25rem; }

/* Welcome Hero */
.welcome-hero { max-width: 900px; margin: 0 auto; }
.hero-icon {
    font-size: 4rem;
    color: var(--primary);
    width: 120px;
    height: 120px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.feature-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

[data-bs-theme="dark"] .feature-card {
    background: #1e293b;
    border-color: #334155;
}

/* Classification Boxes */
.classification-box {
    background: var(--primary-light);
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
}
.classification-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.classification-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
}

/* Assessment Question Cards */
.question-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.question-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.question-card.answered { border-left: 4px solid var(--success); }

[data-bs-theme="dark"] .question-card {
    background: #1e293b;
    border-color: #334155;
}

.question-number {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.question-text {
    font-weight: 500;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    line-height: 1.45;
}

.question-help {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-bottom: 0.75rem;
    font-style: italic;
}

/* Maturity Rating */
.maturity-rating {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.maturity-option {
    flex: 1;
    min-width: 90px;
    text-align: center;
    padding: 0.5rem 0.4rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.78rem;
    background: transparent;
    position: relative;
}

.maturity-option:hover { border-color: var(--primary); background: var(--primary-light); }

.maturity-option.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.maturity-option .maturity-level {
    font-weight: 700;
    font-size: 1rem;
    display: block;
    margin-bottom: 2px;
}

.maturity-option .maturity-label {
    display: block;
    line-height: 1.2;
}

/* Domain Info Card */
.domain-info {
    background: linear-gradient(135deg, var(--primary-light), #f0f4ff);
    border: none;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

[data-bs-theme="dark"] .domain-info {
    background: linear-gradient(135deg, #1e293b, #1a2540);
}

.domain-info .domain-article {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary);
    font-weight: 600;
}
.domain-info .domain-desc {
    font-size: 0.9rem;
    color: #4b5563;
    margin-top: 0.25rem;
}

[data-bs-theme="dark"] .domain-info .domain-desc { color: #94a3b8; }

/* Results - Score Cards */
.score-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    text-align: center;
    border: 1px solid #e5e7eb;
    transition: transform 0.2s;
}
.score-card:hover { transform: translateY(-2px); }

[data-bs-theme="dark"] .score-card {
    background: #1e293b;
    border-color: #334155;
}

.score-card .score-value {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
}
.score-card .score-label {
    font-size: 0.78rem;
    color: #6b7280;
    margin-top: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.score-card .score-sublabel {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 0.15rem;
}

/* Heat Map */
.heatmap-container { overflow-x: auto; padding: 1rem; }

.heatmap-grid {
    display: grid;
    gap: 3px;
    min-width: 600px;
}

.heatmap-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    color: #fff;
    cursor: default;
    transition: transform 0.15s;
    position: relative;
}

.heatmap-cell:hover {
    transform: scale(1.08);
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.heatmap-cell.header {
    background: transparent !important;
    color: #4b5563;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: center;
    line-height: 1.2;
    min-height: 52px;
    cursor: default;
    transform: none !important;
    box-shadow: none !important;
}

[data-bs-theme="dark"] .heatmap-cell.header { color: #94a3b8; }

.heatmap-cell.row-label {
    background: transparent !important;
    color: #1f2937;
    font-size: 0.8rem;
    font-weight: 600;
    justify-content: flex-start;
    padding-left: 0.5rem;
    cursor: default;
    transform: none !important;
    box-shadow: none !important;
    min-width: 180px;
}

[data-bs-theme="dark"] .heatmap-cell.row-label { color: #e2e8f0; }

.heatmap-cell[data-score="1"] { background: var(--heatmap-1); }
.heatmap-cell[data-score="2"] { background: var(--heatmap-2); }
.heatmap-cell[data-score="3"] { background: var(--heatmap-3); color: #333; }
.heatmap-cell[data-score="4"] { background: var(--heatmap-4); }
.heatmap-cell[data-score="5"] { background: var(--heatmap-5); }
.heatmap-cell[data-score="0"] { background: var(--heatmap-0); color: #9ca3af; }

.heatmap-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 0.4rem 0.65rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 400;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
}

.heatmap-cell:hover .heatmap-tooltip { opacity: 1; }

/* Heat Map Legend */
.heatmap-legend .legend-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
}

/* Gap Analysis Table */
#gapAnalysisTable th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
#gapAnalysisTable td { vertical-align: middle; }

.priority-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.priority-critical { background: #fef2f2; color: #dc2626; }
.priority-high { background: #fff7ed; color: #ea580c; }
.priority-medium { background: #fefce8; color: #ca8a04; }
.priority-low { background: #f0fdf4; color: #16a34a; }

[data-bs-theme="dark"] .priority-critical { background: #451a1a; }
[data-bs-theme="dark"] .priority-high { background: #451a00; }
[data-bs-theme="dark"] .priority-medium { background: #45400a; }
[data-bs-theme="dark"] .priority-low { background: #0a3520; }

/* Country Requirements */
.country-req-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e5e7eb;
}
.country-req-item:last-child { border-bottom: none; }
.country-req-label {
    min-width: 180px;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
}
.country-req-value { font-size: 0.875rem; color: #6b7280; }

[data-bs-theme="dark"] .country-req-label { color: #e2e8f0; }
[data-bs-theme="dark"] .country-req-value { color: #94a3b8; }

/* Wizard Navigation */
.wizard-nav {
    position: fixed;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding: 0.75rem 2.5rem;
    display: flex;
    align-items: center;
    z-index: 100;
}

[data-bs-theme="dark"] .wizard-nav {
    background: #1e293b;
    border-top-color: #334155;
}

/* Responsive */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        min-width: 260px;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }
    .sidebar.show { transform: translateX(0); }
    .content-area { margin-left: 0; max-width: 100%; padding: 1.5rem 1rem 6rem; }
    .wizard-nav { left: 0; padding: 0.75rem 1rem; }
    .maturity-option { min-width: 70px; font-size: 0.72rem; }
    .maturity-option .maturity-label { display: none; }
    .welcome-hero .row { flex-direction: column; align-items: center; }
    .welcome-hero .col-md-3 { max-width: 280px; }
}

@media (max-width: 575px) {
    .heatmap-cell.row-label { min-width: 120px; font-size: 0.7rem; }
    .heatmap-cell { min-height: 34px; font-size: 0.75rem; }
}

/* Print Styles */
@media print {
    .navbar, .sidebar, .wizard-nav, .btn, .toast-container { display: none !important; }
    .content-area { margin-left: 0 !important; max-width: 100% !important; padding: 0 !important; }
    .wizard-step { display: block !important; page-break-inside: avoid; }
    .wizard-step:not([data-step="12"]) { display: none !important; }
    .card { break-inside: avoid; box-shadow: none !important; border: 1px solid #ddd !important; }
    .heatmap-cell:hover { transform: none !important; box-shadow: none !important; }
    body { background: #fff !important; }
}

/* Scrollbar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }

/* Utility */
.text-primary { color: var(--primary) !important; }
.bg-primary { background-color: var(--primary) !important; }
.btn-primary { background-color: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background-color: var(--primary-dark); border-color: var(--primary-dark); }

/* Domain progress indicator */
.domain-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.domain-progress-text {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
}

/* Score gauge in results */
.gauge-container {
    width: 140px;
    height: 140px;
    margin: 0 auto;
    position: relative;
}
.gauge-container canvas { width: 100%; height: 100%; }
.gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.8rem;
    font-weight: 800;
}

/* Animate score card values */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.score-animate { animation: countUp 0.5s ease-out; }
