:root {
    --bg-color: #0f172a;
    --surface-color: rgba(30, 41, 59, 0.7);
    --surface-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --font-family: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--bg-color) 0%, #172554 100%);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

#app-container {
    width: 100%;
    max-width: 1000px;
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 80vh;
}

/* Header & Progress */
#app-header {
    padding: 2rem;
    border-bottom: 1px solid var(--surface-border);
    background: rgba(15, 23, 42, 0.5);
}

#app-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#progress-bar-container {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

#progress-bar {
    height: 100%;
    width: 25%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#stage-nav {
    display: flex;
    justify-content: space-between;
}

.stage-indicator {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.3s ease;
}

.stage-indicator.active {
    color: var(--text-primary);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Main Content Area */
#app-content {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
    position: relative;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

/* Common UI Elements */
.section-title {
    font-size: 1.4rem;
    margin-bottom: 1rem;
    color: #e2e8f0;
}

.description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-family);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

/* List Items (Questions, Tests) */
.item-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.list-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--surface-border);
    padding: 1.2rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
    border-color: rgba(255, 255, 255, 0.2);
}

.list-item.selected {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent-color);
}

.item-content {
    flex: 1;
}

.item-title {
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.item-result {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-style: italic;
    display: none;
}

.list-item.selected .item-result {
    display: block;
    animation: fadeIn 0.3s ease forwards;
}

/* Input Fields */
.input-group {
    margin-bottom: 1.5rem;
}

.text-input {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-family: var(--font-family);
    transition: all 0.2s ease;
}

.text-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Feedback Specific */
.feedback-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--surface-border);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.feedback-card.success {
    border-left: 4px solid var(--success-color);
}

.feedback-card.warning {
    border-left: 4px solid var(--warning-color);
}

.feedback-card.danger {
    border-left: 4px solid var(--danger-color);
}

.feedback-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feedback-title.success { color: var(--success-color); }
.feedback-title.warning { color: var(--warning-color); }
.feedback-title.danger { color: var(--danger-color); }

/* Navigation Row below logic */
.nav-row {
    display: flex;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--surface-border);
}

/* Dashboard Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

.modal-content {
    background: #ffffff;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.open .modal-content {
    transform: translateY(0);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--surface-border);
}

.stat-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: bold;
    color: var(--accent-color);
}

/* 10-Trial Evaluation Screen Styles */
.eval-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.eval-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.eval-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.eval-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.eval-card-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.eval-card-subtext {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Success Circle Indicator */
.success-ring-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 0.5rem;
}

.success-ring-svg {
    transform: rotate(-90deg);
}

.success-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
}

.success-ring-bar {
    fill: none;
    stroke: var(--success-color);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s ease;
}

.success-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Didactic Reflection Box */
.reflection-box {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-left: 5px solid #6366f1;
    border-radius: 16px;
    padding: 1.8rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.reflection-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #a5b4fc;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reflection-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #cbd5e1;
}

/* Interactive Collapsible Trial Accordion */
.accordion-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.trial-accordion-item {
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.trial-accordion-item:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.trial-header {
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.trial-header:hover {
    background: rgba(255, 255, 255, 0.07);
}

.trial-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.trial-num-badge {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.85rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trial-patient-name {
    font-weight: 500;
    font-size: 0.95rem;
    color: #e2e8f0;
}

.trial-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.trial-score-badge {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-right: 0.5rem;
}

.status-badge {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    letter-spacing: 0.03em;
}

.status-badge.correct {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--success-color);
    color: #34d399;
}

.status-badge.incorrect {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid var(--danger-color);
    color: #f87171;
}

.toggle-icon {
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

/* Accordion Body */
.trial-body {
    display: none;
    padding: 1.5rem;
    border-top: 1px solid var(--surface-border);
    background: rgba(0, 0, 0, 0.15);
}

.trial-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.trial-detail-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.trial-detail-value {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.trial-diagnostics-section {
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.test-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.test-tag {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.test-tag.relevant {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #a7f3d0;
}

.test-tag.irrelevant {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Restart Button */
.eval-restart-btn-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--surface-border);
}

.eval-restart-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border: none;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-family);
}

.eval-restart-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.5);
    transform: translateY(-3px) scale(1.02);
}

