.dashboard-container {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    animation: fade-in 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Profile Header --- */
.profile-header {
    position: relative;
    padding: 4rem 2rem 3rem;
    display: flex;
    justify-content: center;
    overflow: hidden;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}

.header-grid-bg {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 60px 60px;
    background-position: center;
    mask-image: radial-gradient(circle at center, black, transparent 80%);
}

.profile-visual {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.avatar-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
}

.profile-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
    position: relative;
    z-index: 2;
    background: var(--bg-surface);
}

.avatar-glow {
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background: #10b981;
    filter: blur(20px);
    opacity: 0.4;
    z-index: 1;
    animation: pulse-glow 3s infinite;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.05); opacity: 0.6; }
}

.username {
    font-family: var(--nexus-font-sans);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-main);
    letter-spacing: 1px;
    text-transform: lowercase;
}

.username::before {
    content: '[';
    color: var(--nexus-neon);
    margin-right: 4px;
}

.username::after {
    content: ']';
    color: var(--nexus-neon);
    margin-left: 4px;
}

.status-pills {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.status-pill {
    padding: 0.6rem 1.25rem;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 100px;
    display: flex;
    gap: 0.5rem;
    font-size: 0.9rem;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.05);
}

.pill-label { color: var(--text-muted); }
.pill-value { color: var(--text-main); font-weight: 600; }

/* --- Dashboard Content --- */
.dashboard-content {
    padding: 3rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.section-title {
    font-family: var(--nexus-font-serif);
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-main);
}

.main-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 2rem;
}

.glass-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel:hover {
    background: var(--bg-surface);
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Reading Card */
.reading-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.reading-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.card-body {
    display: flex;
    gap: 2rem;
}

.reading-thumb {
    width: 120px;
    flex-shrink: 0;
}

.reading-thumb img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.reading-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.progress-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

.progress-container {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: var(--nexus-neon);
    border-radius: 4px;
    position: relative;
    box-shadow: 0 0 10px rgba(0, 255, 153, 0.3);
}

.progress-bubble {
    position: absolute;
    right: -20px;
    top: -30px;
    background: var(--nexus-neon);
    color: #000;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
}

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

.reading-desc {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0;
}

.card-actions {
    display: flex;
    gap: 1rem;
}

/* Secondary Grid Items */
.secondary-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

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

.panel-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Graph Placeholder */
.graph-placeholder {
    height: 180px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.graph-node {
    position: absolute;
    border-radius: 50%;
    background: #333;
    border: 1px solid rgba(255,255,255,0.1);
}

.graph-node.central {
    width: 40px;
    height: 40px;
    background: var(--nexus-neon);
    box-shadow: 0 0 20px rgba(0, 255, 153, 0.4);
}

.graph-node.satellite {
    width: 16px;
    height: 16px;
    transform: rotate(var(--angle)) translateY(var(--dist));
    background: rgba(0, 255, 153, 0.4);
    border: 1px solid var(--nexus-neon);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.graph-node.satellite:hover {
    background: var(--nexus-neon);
    box-shadow: 0 0 15px var(--nexus-neon);
    transform: rotate(var(--angle)) translateY(var(--dist)) scale(1.3);
}

.active-node-label {
    position: absolute;
    bottom: 20px;
    right: 20px;
    padding: 4px 12px;
    background: rgba(0, 255, 153, 0.1);
    border: 1px solid var(--nexus-neon);
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--nexus-neon);
    font-weight: 700;
}

/* Quiz Preview */
.quiz-preview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.question {
    font-size: 0.95rem;
    color: var(--text-main);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-option {
    padding: 0.75rem 1rem;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    display: flex;
    gap: 0.75rem;
    cursor: pointer;
    color: var(--text-main);
}

.quiz-option.active {
    background: rgba(0, 255, 153, 0.05);
    border-color: var(--nexus-neon);
    color: var(--nexus-neon);
}

.option-letter {
    font-weight: 700;
}

/* Buttons */
.btn-nexus {
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-nexus.primary {
    background: #10b981;
    color: #000;
}

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

.btn-nexus:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

/* Empty State */
.empty-state {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
    gap: 1.5rem !important;
}

.empty-icon {
    opacity: 0.3;
    color: var(--nexus-neon);
    filter: drop-shadow(0 0 10px rgba(0, 255, 153, 0.2));
}

.empty-state .reading-info {
    align-items: center;
    max-width: 400px;
}

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

/* --- Quiz History Styling --- */
.quiz-history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quiz-history-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.2s ease;
}

.quiz-history-item:hover {
    background: var(--bg-base);
    border-color: var(--border);
}

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

.quiz-topic {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
}

.quiz-item-meta {
    display: flex;
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

.badge-success {
    background: rgba(0, 255, 153, 0.1);
    color: var(--nexus-neon);
    border: 1px solid rgba(0, 255, 153, 0.3);
}

.badge-warning {
    background: rgba(255, 170, 0, 0.1);
    color: #ffa800;
    border: 1px solid rgba(255, 170, 0, 0.3);
}

.badge-danger {
    background: rgba(255, 50, 50, 0.1);
    color: #ff3232;
    border: 1px solid rgba(255, 50, 50, 0.3);
}

.empty-quiz-state {
    text-align: center;
    padding: 2rem 1rem;
}

.empty-quiz-state .sub-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* --- Concept Detail Toast for Dashboard --- */
.concept-detail-toast {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 12px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.concept-detail-toast.placeholder {
    opacity: 0.5;
}

.concept-type {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--nexus-neon);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.concept-content {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-main);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mobile Dashboard Overrides */
@media (max-width: 767px) {
    .dashboard-content {
        padding: 0.5rem 0.5rem calc(1.5rem + 64px) !important;
    }

    .profile-header {
        padding: 10px 12px;
        background: var(--bg-surface);
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 10px;
    }

    .profile-visual {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: center;
        gap: 0.5rem;
    }

    .avatar-wrapper {
        width: 40px;
        height: 40px;
        margin: 0;
    }

    .user-info {
        flex: 1;
    }

    .username {
        font-size: 1.05rem;
        font-weight: 600;
        text-align: left;
        margin: 0;
        letter-spacing: 0px;
    }

    .user-role {
        font-size: 0.8rem;
    }

    .status-pills {
        grid-column: span 2;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
        gap: 0.25rem;
        margin-top: 0.15rem;
    }

    .status-pill {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0.25rem 0.4rem;
        font-size: 0.65rem;
        gap: 0.2rem;
        white-space: nowrap;
        border-radius: 6px;
    }

    .section-title {
        font-size: 1.25rem;
        font-weight: 700;
        letter-spacing: -0.5px;
        margin-top: 4px;
        margin-bottom: 8px;
        color: var(--text-main);
    }

    .main-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    .secondary-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }

    /* Force all widgets to take 100% width and fit inside parent container nicely */
    .glass-panel {
        width: 100% !important;
        padding: 12px !important;
        box-sizing: border-box;
    }

    /* Compress Knowledge Graph and Concept stack heights to maximize visible fold space */
    .graph-placeholder {
        height: 120px;
    }

    .concepts-linear-stack {
        height: 120px !important;
        max-height: 120px !important;
        overflow-y: auto !important;
        padding-right: 4px;
    }

    .concept-linear-item {
        padding: 6px 8px !important;
        font-size: 0.75rem !important;
        gap: 0.5rem !important;
        min-height: auto !important; /* Prevent touch target min-height expansion */
    }

    .concept-badge {
        padding: 2px 6px !important;
        font-size: 0.65rem !important;
    }

    /* Expand touch-targets to 48px min height for interactive elements */
    .btn-nexus, .quiz-option, .satellite, .logout-btn, .nav-item, .quiz-item {
        min-height: 48px;
        display: flex;
        align-items: center;
        touch-action: manipulation;
    }
}

/* --- Architecture Guide Block --- */
.architecture-guide-panel {
    margin-top: 2.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
}

.architecture-content {
    max-width: 800px;
    margin: 0 auto;
    font-family: var(--nexus-font-sans, "Outfit", sans-serif);
}

.architecture-content h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1.25rem;
    letter-spacing: -0.01em;
}

.architecture-content p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-main);
    margin-bottom: 1.25rem;
}

.architecture-content code {
    background: var(--bg-base);
    color: #10b981;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

/* ============================================================
   LIGHT THEME OVERRIDES — "Warm Paper / Soft Sepia"
   ============================================================ */

.theme-light .username::before,
.theme-light .username::after {
    color: var(--accent);
}

.theme-light .avatar-glow {
    background: var(--accent);
    filter: blur(15px);
    opacity: 0.2;
}

.theme-light .progress-container {
    background: #e4e1d9;
}

.theme-light .progress-bar {
    background: var(--accent);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
}

.theme-light .progress-bubble {
    background: var(--accent);
    color: #ffffff;
}

.theme-light .graph-node {
    background: rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.theme-light .graph-node.central {
    background: var(--accent);
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.theme-light .graph-node.satellite {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--accent);
}

.theme-light .graph-node.satellite:hover {
    background: var(--accent);
    box-shadow: 0 0 10px var(--accent);
}

.theme-light .active-node-label {
    background: rgba(16, 185, 129, 0.06);
    border: 1px solid var(--accent);
    color: var(--accent);
}

.theme-light .quiz-option.active {
    background: rgba(16, 185, 129, 0.06);
    border-color: var(--accent);
    color: var(--accent);
}

.theme-light .btn-nexus.primary {
    background: var(--accent);
    color: #0d0d0d;
}

.theme-light .btn-nexus.primary:hover {
    background: #059669;
    color: #ffffff;
}

.theme-light .empty-icon {
    color: var(--accent);
    filter: none;
}

.theme-light .badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.theme-light .concept-type {
    color: var(--accent);
}

/* --- Concepts Linear Stack for Mobile/Utility Switch --- */
.concepts-linear-stack {
    height: 180px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    gap: 0.5rem;
    padding-right: 0.5rem;
}

.concept-linear-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.concept-linear-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.concept-linear-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(0, 255, 153, 0.2);
    transform: translateX(2px);
}

.concept-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.concept-badge.rule {
    background: rgba(255, 70, 70, 0.1);
    color: #ff8b8b;
    border: 1px solid rgba(255, 70, 70, 0.2);
}

.concept-badge.definition {
    background: rgba(255, 176, 58, 0.1);
    color: #ffd18c;
    border: 1px solid rgba(255, 176, 58, 0.2);
}

.concept-badge.table {
    background: rgba(217, 70, 239, 0.1);
    color: #f5d0fe;
    border: 1px solid rgba(217, 70, 239, 0.2);
}

.concept-badge.section {
    background: rgba(59, 130, 246, 0.1);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.concept-badge.bridge {
    background: rgba(6, 182, 212, 0.1);
    color: #67e8f9;
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.concept-badge.concept {
    background: rgba(0, 210, 196, 0.05);
    color: #e0e0e0;
    border: 1px solid rgba(0, 210, 196, 0.2);
}

.concept-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

.concepts-empty-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    gap: 0.5rem;
}

.concepts-empty-list p {
    margin: 0;
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    background: rgba(0, 255, 153, 0.08);
    border-color: var(--accent);
    color: var(--accent);
}

/* --- Light Theme Overrides for Concepts Stack --- */
.theme-light .concept-linear-item {
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-main);
}

.theme-light .concept-linear-item:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(16, 185, 129, 0.2);
}

.theme-light .concept-badge.rule {
    background: rgba(220, 38, 38, 0.05);
    color: #991b1b;
    border-color: rgba(220, 38, 38, 0.15);
}

.theme-light .concept-badge.definition {
    background: rgba(217, 119, 6, 0.05);
    color: #92400e;
    border-color: rgba(217, 119, 6, 0.15);
}

.theme-light .concept-badge.table {
    background: rgba(192, 132, 252, 0.05);
    color: #6b21a8;
    border-color: rgba(192, 132, 252, 0.15);
}

.theme-light .concept-badge.section {
    background: rgba(37, 99, 235, 0.05);
    color: #1e3a8a;
    border-color: rgba(37, 99, 235, 0.15);
}

.theme-light .concept-badge.bridge {
    background: rgba(8, 145, 178, 0.05);
    color: #155e75;
    border-color: rgba(8, 145, 178, 0.15);
}

.theme-light .concept-badge.concept {
    background: rgba(13, 148, 136, 0.03);
    color: #115e59;
    border-color: rgba(13, 148, 136, 0.1);
}

.theme-light .view-toggle-btn {
    background: rgba(0, 0, 0, 0.02);
}

.theme-light .view-toggle-btn:hover {
    background: rgba(16, 185, 129, 0.08);
    border-color: var(--accent);
    color: var(--accent);
}



