/* Base styles for dark theme */
button, input, select, textarea {
    color: var(--color-text);
    font-family: inherit;
}

/* Custom scrollbars for dark theme */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--color-bg-lighter);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-border);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-bg-lighter) var(--color-bg);
}

/* Assessment Layout */
.assessment-layout {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    min-height: calc(100vh - 80px);
    gap: 0;
}

/* Sidebar */
.sidebar {
    background: var(--color-bg-light);
    border-right: 1px solid var(--color-border);
    padding: 1.5rem;
    height: calc(100vh - 80px);
    overflow-y: auto;
    position: sticky;
    top: 80px;
}

.sidebar-sticky {
    position: sticky;
    top: 2rem;
}

.assessment-info h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.assessment-info p {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

/* Progress Section */
.progress-section {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--color-border);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.progress-percentage {
    color: var(--color-primary);
}

.progress-bar {
    height: 8px;
    background: var(--color-bg-lighter);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
    border-radius: 999px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Results Section */
.results-section {
    opacity: 1;
    transition: opacity 0.3s;
}

.results-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.maturity-score {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.score-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
    border: 3px solid var(--color-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-primary);
}

.score-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.business-functions {
    margin-bottom: 1rem;
}

.function-score {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 0.75rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.function-score:hover {
    background: var(--color-bg-lighter);
    border-color: var(--color-primary);
}

.function-score.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--color-primary);
}

.function-info {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    flex: 1;
}

.function-name {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.function-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.function-progress {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-left: 1rem;
}

.function-progress .complete-check {
    color: var(--color-success);
    font-weight: 700;
}

.function-value {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 1rem;
}

.chart-container {
    position: relative;
    margin: 1rem 0;
    background: var(--color-bg);
    border-radius: 0.75rem;
    padding: 0.75rem;
    min-height: 180px;
}

.chart-toggle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.2rem 0.5rem;
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: 0.25rem;
    color: var(--color-text-secondary);
    font-size: 0.6rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chart-toggle:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.chart-toggle.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-bg-lighter);
}

.btn-reset {
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-reset:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

/* Main Content */
.main-content {
    padding: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.assessment-header {
    margin-bottom: 2.5rem;
}

.assessment-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.assessment-header p {
    font-size: 1rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Answer Legend */
.answer-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: var(--color-bg-light);
    border-radius: 0.75rem;
    border: 1px solid var(--color-border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.legend-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.75rem;
}

/* Business Function Sections */
.business-function-sections {
    counter-reset: business-function;
}

.business-function-section {
    margin-bottom: 3rem;
    counter-reset: practice;
    counter-increment: business-function;
}

.function-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-border);
}

.function-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.function-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.function-title h2::before {
    content: counter(business-function) ". ";
    color: var(--color-text);
}

/* Practice Cards */
.practice-card {
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: 1rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    counter-increment: practice;
}

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

.practice-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.practice-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
}

.practice-title::before {
    content: counter(business-function) "." counter(practice) " ";
    color: var(--color-text-muted);
}

.practice-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-count {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.practice-checkmark {
    font-size: 1.25rem;
    color: var(--color-success);
    font-weight: 700;
}

/* Streams Container */
.streams-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.stream-section {
    background: var(--color-bg);
    border-radius: 0.75rem;
    padding: 1rem;
}

.stream-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.stream-badge {
    background: var(--color-primary);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.stream-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
}

.stream-levels {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Question Cards */
.question-card {
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: 0.75rem;
    padding: 1rem;
    transition: all 0.2s;
}

.question-card.answered {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.05);
}

.question-card.highlight {
    animation: highlightPulse 3s ease-out;
    border-color: #ef4444 !important;
}

@keyframes highlightPulse {
    0% {
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.7);
        background: rgba(239, 68, 68, 0.15);
    }
    70% {
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.4);
        background: rgba(239, 68, 68, 0.1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        background: transparent;
    }
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.level-indicator {
    padding: 0.2rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--color-bg);
}

.level-indicator.level-1 { color: #fbbf24; border: 1px solid #fbbf24; }
.level-indicator.level-2 { color: #60a5fa; border: 1px solid #60a5fa; }
.level-indicator.level-3 { color: #34d399; border: 1px solid #34d399; }

.criteria-btn {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.criteria-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(99, 102, 241, 0.1);
}

.question-text {
    font-size: 0.85rem;
    color: var(--color-text);
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

/* Answer Options */
.answer-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.375rem;
}

.answer-btn {
    padding: 0.5rem 0.25rem;
    border: 1px solid var(--color-border);
    border-radius: 0.5rem;
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.answer-btn:hover {
    border-color: var(--color-primary);
    background: rgba(99, 102, 241, 0.1);
}

.answer-btn.selected {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: white;
}

.answer-label {
    font-size: 0.7rem;
    font-weight: 600;
    display: block;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--color-bg-light);
    border-radius: 1rem;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--color-border);
}

.modal-small {
    max-width: 500px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--color-bg-light);
    z-index: 10;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-muted);
    cursor: pointer;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.modal-body {
    padding: 1.5rem;
}

.criteria-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.criteria-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.criteria-question {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.criteria-section h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

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

.criteria-list li {
    padding: 0.625rem 0.75rem;
    background: var(--color-bg);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-text);
    line-height: 1.5;
}

.criteria-list li::before {
    content: "✓";
    color: var(--color-success);
    margin-right: 0.5rem;
    font-weight: 700;
}

/* Recommendations Sidebar */
.recommendations-sidebar {
    background: var(--color-bg-light);
    border-left: 1px solid var(--color-border);
    padding: 1.5rem;
    height: calc(100vh - 80px);
    overflow-y: auto;
    position: sticky;
    top: 80px;
}

.recommendations-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

.recommendations-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.recommendations-body {
    font-size: 0.875rem;
}

.empty-state {
    text-align: center;
    color: var(--color-text-muted);
    padding: 2rem 1rem;
}

.congratulations {
    text-align: center;
    padding: 2rem 1rem;
}

.congrats-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--color-success);
    color: white;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.congratulations h3 {
    color: var(--color-success);
    margin-bottom: 0.5rem;
}

.congratulations p {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
}

.recommendation-group {
    margin-bottom: 1.25rem;
}

.group-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    display: inline-block;
}

.group-title.high {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.group-title.medium {
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.group-title.low {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
}

.recommendation-card {
    background: var(--color-bg);
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--color-primary);
    transition: all 0.2s;
}

.recommendation-card.clickable {
    cursor: pointer;
}

.recommendation-card.clickable:hover {
    background: var(--color-bg-lighter);
    transform: translateX(4px);
}

.recommendation-card[data-priority="high"] {
    border-left-color: #f87171;
}

.recommendation-card[data-priority="medium"] {
    border-left-color: #fbbf24;
}

.recommendation-card[data-priority="low"] {
    border-left-color: #60a5fa;
}

.rec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
}

.rec-practice {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    border-left: 2px solid;
}

.rec-level {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--color-text-muted);
    background: var(--color-bg-light);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}

.rec-question {
    font-size: 0.8rem;
    color: var(--color-text);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.rec-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

/* Responsive */
@media (max-width: 1400px) {
    .assessment-layout {
        grid-template-columns: 280px 1fr 280px;
    }
}

@media (max-width: 1200px) {
    .assessment-layout {
        grid-template-columns: 260px 1fr 260px;
    }

    .streams-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1024px) {
    .assessment-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: relative;
        top: 0;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }

    .recommendations-sidebar {
        position: relative;
        top: 0;
        height: auto;
        border-left: none;
        border-top: 1px solid var(--color-border);
    }

    .sidebar-sticky {
        position: static;
    }

    .chart-container {
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }

    .streams-container {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .streams-container {
        grid-template-columns: 1fr;
    }

    .answer-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .answer-legend {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 640px) {
    .main-content {
        padding: 1rem;
    }

    .assessment-header h1 {
        font-size: 1.75rem;
    }

    .function-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .answer-options {
        grid-template-columns: 1fr 1fr;
    }
}
