/* VARIABLES & RESET */
:root {
    --primary: #0284c7;
    /* Medical Blue */
    --primary-dark: #0369a1;
    --secondary: #64748b;
    /* Slate Gray */
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #ef4444;
    --radius: 8px;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background: #0f172a;
    /* Dark Slate */
    color: white;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    /* Sticky & Scrollable */
    position: -webkit-sticky;
    /* Safari */
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    padding: 24px;
    font-size: 1.25rem;
    font-weight: 700;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    /* Prevent header shrinking */
}

.brand span {
    color: var(--primary);
}

.nav-menu {
    flex: 1;
    padding: 16px 12px;
    /* Reduced padding */
    list-style: none;
}

.nav-item {
    margin-bottom: 2px;
    /* Compact spacing */
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px;
    /* Smaller touch targets */
    color: #cbd5e1;
    text-decoration: none;
    border-radius: var(--radius);
    transition: all 0.2s;
    font-size: 0.95rem;
}

.nav-link:hover,
.nav-link.active {
    background: #1e293b;
    color: white;
}

.nav-icon {
    width: 20px;
    text-align: center;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* TOPBAR */
.topbar {
    background: white;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.auth-body {
    /* Stacked Backgrounds:
       1. The image (top layer). If missing, it's transparent.
       2. The Gradient (bottom layer). Always visible as fallback.
    */
    background:
        linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    /* Fallback Gradient */

    background-size: cover;
    /* Ensures image covers full screen */

    align-items: center;
    justify-content: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* DASHBOARD GRID */
.container {
    padding: 32px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-trend {
    font-size: 0.875rem;
    margin-top: 8px;
}

.trend-up {
    color: var(--success);
}

/* TABLES */
.card-section {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    text-decoration: none;
    font-size: 0.9rem;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 16px 24px;
    background: #f8fafc;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-high {
    background: #fef2f2;
    color: var(--danger);
}

.status-low {
    background: #ecfdf5;
    color: var(--success);
}

/* Custom Risk Badges */
.status-badge.status-moderate {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Card Utility */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* Dashboard Core Styles */

/* Global Layout */
body {
    background-color: #f1f5f9;
    /* Light gray background for the whole page */
    color: #1e293b;
    font-family: 'Inter', sans-serif;
}

/* Header */
.dashboard-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.dashboard-header h1 {
    font-size: 1.8rem;
    color: #0f172a;
    margin: 0 0 0.5rem 0;
}

.dashboard-header p {
    color: #64748b;
    font-size: 1rem;
    margin: 0;
}

/* --- Components: Accordion --- */
details.accordion {
    margin-bottom: 1.5rem;
    /* Increased separation */
    border: 1px solid #cbd5e1;
    /* Slightly darker border for contrast */
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    /* Ensure rounded corners clip content */
}

details.accordion summary,
.accordion-trigger {
    padding: 1.25rem;
    background: #e0f2fe;
    /* User Requested: Light Blue constantly */
    cursor: pointer;
    font-weight: 700;
    font-size: 1.1rem;
    color: #1e293b;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s, color 0.2s;
}

/* Summary Hover */
details.accordion summary:hover {
    background: #bae6fd;
    /* Slightly darker on hover */
}

/* Open State */
details.accordion[open] summary {
    border-bottom: 1px solid #e2e8f0;
    background: #e0f2fe;
    /* Light Blue when open */
    color: #0c4a6e;
}

/* Hide Generic Marker */
details.accordion summary::-webkit-details-marker {
    display: none;
}

/* Custom Marker w/ Plus/Minus */
details.accordion summary::after {
    content: '+';
    font-size: 1.5rem;
    font-weight: 300;
    color: #94a3b8;
    margin-left: 1rem;
}

details.accordion[open] summary::after {
    content: '-';
}

/* Click Hint (Hidden when open) */
.click-hint {
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: normal;
    margin-left: 10px;
    opacity: 0.8;
}

details.accordion[open] .click-hint {
    display: none;
}

/* Content Area */
.accordion-content {
    padding: 1.5rem;
    background: white;
}

/* Variant: Compact (for My Assessments) */
details.accordion.compact summary {
    padding: 1rem;
    font-size: 1rem;
    background: #eff6ff;
    /* Blue tint for headers */
    border-bottom: 1px solid transparent;
}

details.accordion.compact summary:hover {
    background: #dbeafe;
    /* Darker blue on hover */
}

details.accordion.compact[open] summary {
    background: #bfdbfe;
    /* Even stronger blue when open */
    border-bottom: 1px solid #93c5fd;
}

/* --- Components: Feature Grid (Marketing Hub) --- */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-top: 1.5rem;
    border-top: 2px dashed #e2e8f0;
    padding-top: 1.5rem;
}

@media (max-width: 900px) {
    .feature-grid {
        grid-template-columns: 1fr;
    }
}

.feature-card {
    padding: 1.25rem;
    text-align: center;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    height: 100%;
}

.feature-card h4 {
    margin: 0 0 0.5rem 0;
    color: #334155;
    font-size: 1rem;
}

.feature-card p {
    color: #64748b;
    font-size: 0.85rem;
    margin: 0;
}

/* --- Components: Quiz Manager --- */
.quiz-manager-grid {
    display: grid;
    grid-template-columns: 1fr minmax(200px, 250px);
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1200px) {
    .quiz-manager-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Components: Toggle Switch --- */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    /* Default Gray */
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #2563eb;
    /* Blue Active */
}

input:checked+.slider:before {
    transform: translateX(24px);
}

/* --- Components: Tables --- */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #64748b;
    border-bottom: 2px solid #f1f5f9;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* --- Utilities --- */
.section-divider {
    margin: 2.5rem 0 1.5rem 0;
    text-align: center;
}

.section-divider span {
    background: #f1f5f9;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: #64748b;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.input-field {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.btn-outline {
    background: white;
    border: 1px solid #cbd5e1;
    color: #475569;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
}

.btn-outline:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}