/* ==========================================================================
   Universe Of Tech - LMS Quiz Stylesheet (lms-quiz.css)
   ========================================================================== */

/* --- Tab Navigation --- */
.lms-tab-container {
    width: min(1180px, calc(100% - 40px));
    margin: 32px auto 0;
    display: flex;
    justify-content: center;
    border-bottom: 2px solid var(--border);
    padding-bottom: 2px;
}

.lms-tab-nav {
    display: flex;
    gap: 16px;
}

.lms-tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 800;
    color: var(--muted);
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease;
    border-radius: 12px 12px 0 0;
}

.lms-tab-btn:hover {
    color: var(--dark);
}

.lms-tab-btn.active {
    color: var(--green-dark);
}

.lms-tab-btn.active::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--green), var(--blue));
    border-radius: 99px;
}

body.dark-theme .lms-tab-btn:hover {
    color: var(--white);
}
body.dark-theme .lms-tab-btn.active {
    color: var(--green);
}

.tab-content {
    display: none;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-content.active {
    display: block;
}

.tab-content.active.show {
    opacity: 1;
    transform: translateY(0);
}

.tab-content.fade-out {
    opacity: 0;
    transform: translateY(-12px);
}

/* --- Course Selection View --- */
.lms-tracks-container {
    width: min(1180px, calc(100% - 40px));
    margin: 32px auto;
}

.lms-tracks-title {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.04em;
    margin-bottom: 8px;
    text-align: center;
}

.lms-tracks-desc {
    color: var(--muted);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 32px;
}

.lms-tracks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
}

.lms-track-card {
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 30px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.35s ease, border-color 0.35s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.lms-track-card:hover {
    transform: translateY(-8px) scale(1.015);
    box-shadow: var(--shadow);
    border-color: var(--track-color, var(--blue));
}

.lms-track-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: var(--track-color, var(--blue));
}

.lms-track-badge {
    align-self: flex-start;
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 20px;
    background: rgba(79, 140, 255, 0.1);
    color: var(--blue);
}

.lms-track-card.track-web { --track-color: var(--green); }
.lms-track-card.track-web .lms-track-badge { background: rgba(50, 214, 107, 0.1); color: var(--green-dark); }
.lms-track-card.track-db { --track-color: var(--blue); }
.lms-track-card.track-db .lms-track-badge { background: rgba(79, 140, 255, 0.1); color: var(--blue); }
.lms-track-card.track-cyber { --track-color: var(--purple); }
.lms-track-card.track-cyber .lms-track-badge { background: rgba(139, 92, 246, 0.1); color: var(--purple); }
.lms-track-card.track-code { --track-color: #f59e0b; }
.lms-track-card.track-code .lms-track-badge { background: rgba(245, 158, 11, 0.12); color: #b45309; }
.lms-track-card.track-data { --track-color: #ec4899; }
.lms-track-card.track-data .lms-track-badge { background: rgba(236, 72, 153, 0.11); color: #db2777; }
.lms-track-card.track-fullstack { --track-color: #06b6d4; }
.lms-track-card.track-fullstack .lms-track-badge { background: rgba(6, 182, 212, 0.11); color: #0891b2; }

.lms-track-title-text {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
}

.lms-track-description {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 24px;
    flex-grow: 1;
}

.lms-track-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 18px;
    margin-top: 18px;
}

.lms-track-modules-count {
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.lms-track-btn {
    font-weight: 900;
    font-size: 13px;
    color: white;
    background: var(--track-color, var(--blue));
    padding: 10px 18px;
    border-radius: 14px;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.lms-track-card:hover .lms-track-btn {
    transform: scale(1.05);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.15);
}

.lms-track-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

.lms-track-certificate-btn {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 11px;
    color: var(--muted);
    background: var(--soft);
    font: inherit;
    font-size: 10px;
    font-weight: 900;
    cursor: not-allowed;
}

.lms-track-certificate-btn.is-ready {
    border-color: rgba(180, 134, 28, 0.32);
    color: #805d0e;
    background: linear-gradient(135deg, #fff9df, #f7e9b7);
    box-shadow: 0 8px 18px rgba(180, 134, 28, 0.13);
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.lms-track-certificate-btn.is-ready:hover {
    transform: translateY(-2px);
    border-color: rgba(180, 134, 28, 0.55);
    box-shadow: 0 12px 24px rgba(180, 134, 28, 0.2);
}

.lms-track-certificate-btn:focus-visible {
    outline: 3px solid rgba(79, 140, 255, 0.24);
    outline-offset: 2px;
}

/* --- Classroom Layout --- */
.lms-classroom {
    width: min(1180px, calc(100% - 40px));
    margin: 32px auto;
    display: grid;
    grid-template-columns: 310px 1fr 280px;
    gap: 24px;
    align-items: start;
}

/* --- Left Sidebar (Course Outline) --- */
.lms-sidebar-outline {
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 96px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
}

.lms-sidebar-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.lms-back-tracks-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    background: none;
    border: none;
    cursor: pointer;
    margin-bottom: 12px;
    transition: color 0.2s ease;
}

.lms-back-tracks-btn:hover {
    color: var(--green-dark);
}

.lms-syllabus-title {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.03em;
}

.lms-sidebar-progress {
    margin-top: 12px;
}

.lms-sidebar-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 900;
    color: var(--muted);
    margin-bottom: 6px;
}

.lms-sidebar-progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.lms-sidebar-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green), var(--blue));
    width: 0%;
    transition: width 0.4s ease;
}

.lms-syllabus-tree {
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 4px;
}

.lms-syllabus-tree::-webkit-scrollbar {
    width: 6px;
}

.lms-syllabus-tree::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 99px;
}

.lms-chapter-group {
    margin-bottom: 18px;
}

.lms-chapter-header {
    font-size: 11px;
    font-weight: 900;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.lms-syllabus-item {
    width: 100%;
    color: inherit;
    font: inherit;
    text-align: left;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 750;
    margin-bottom: 4px;
    transition: background-color 0.25s ease, color 0.25s ease, transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.lms-syllabus-item:hover {
    background: rgba(79, 140, 255, 0.08);
    color: var(--blue);
    transform: translateX(4px);
}
body.dark-theme .lms-syllabus-item:hover {
    background: rgba(61, 219, 217, 0.1);
    color: var(--cyan);
}

.lms-syllabus-item.active {
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.12), rgba(139, 92, 246, 0.08));
    color: var(--blue);
    font-weight: 900;
    box-shadow: 0 4px 10px rgba(79, 140, 255, 0.05);
}
body.dark-theme .lms-syllabus-item.active {
    background: linear-gradient(135deg, rgba(61, 219, 217, 0.15), rgba(139, 92, 246, 0.1));
    color: var(--cyan);
}

.lms-syllabus-item.completed .lms-item-check {
    color: var(--green);
}

.lms-syllabus-item.needs-retry {
    background: rgba(249, 183, 77, 0.12);
    color: #b96b08;
}

body.dark-theme .lms-syllabus-item.needs-retry {
    background: rgba(249, 183, 77, 0.16);
    color: #ffd280;
}

.lms-syllabus-item.needs-retry .lms-item-check {
    color: #d9822b;
}

.lms-item-check {
    font-size: 14px;
    color: var(--muted);
    flex-shrink: 0;
}

.lms-item-title {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lms-item-type-icon {
    font-size: 12px;
    color: var(--muted);
    opacity: 0.7;
}

.lms-module-certificate-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 12px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(79, 140, 255, 0.08);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.lms-module-certificate-hint i {
    color: var(--blue);
}

.lms-module-certificate-hint.warning {
    background: rgba(249, 183, 77, 0.14);
    color: #9c640c;
}

.lms-module-certificate-hint.warning i {
    color: #d9822b;
}

.lms-module-certificate-hint.ready {
    background: rgba(59, 178, 115, 0.12);
    color: #146c43;
}

.lms-module-certificate-hint.ready i {
    color: var(--green);
}

/* --- Classroom Main Pane --- */
.lms-classroom-main {
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 34px;
    padding: 32px;
    box-shadow: var(--shadow-soft);
    min-height: 520px;
}

/* --- Lecture Material Style --- */
.lms-lecture {
    animation: fadeIn 0.4s ease both;
}

.lms-lecture-header {
    border-bottom: 2px solid var(--border);
    padding-bottom: 20px;
    margin-bottom: 24px;
}

.lms-lecture-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.lms-lecture-tag {
    padding: 4px 10px;
    background: var(--soft);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 11px;
    font-weight: 900;
    color: var(--muted);
}

.lms-lecture-title {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1.2;
}

.lms-lecture-body {
    font-size: 15.5px;
    line-height: 1.8;
    font-weight: 650;
    color: var(--dark);
}

.lms-lecture-body p {
    margin-bottom: 20px;
}

.lms-lecture-body h3 {
    font-size: 20px;
    font-weight: 850;
    margin: 32px 0 14px;
    letter-spacing: -0.03em;
}

.lms-lecture-body h4 {
    font-size: 16px;
    font-weight: 800;
    margin: 24px 0 10px;
}

.lms-lecture-body ul, 
.lms-lecture-body ol {
    margin-bottom: 20px;
    padding-left: 24px;
}

.lms-lecture-body li {
    margin-bottom: 8px;
}

.lms-lecture-body code {
    font-family: monospace;
    font-size: 13.5px;
    background: var(--soft);
    color: var(--pink);
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.lms-lecture-body pre {
    background: #0f172a;
    color: #f8fafc;
    padding: 18px;
    border-radius: 18px;
    overflow-x: auto;
    margin: 18px 0 24px;
    position: relative;
    border: 1px solid var(--border);
}

.lms-lecture-body pre code {
    background: none;
    color: inherit;
    padding: 0;
    border: none;
    font-size: 13px;
    line-height: 1.5;
}

.lms-lecture-body .copy-code-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s;
}

.lms-lecture-body .copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Callouts / Alerts in Lecture */
.lms-callout {
    padding: 16px 20px;
    border-radius: 18px;
    margin: 22px 0;
    border-left: 5px solid;
    font-size: 14.5px;
}

.lms-callout.tip {
    background: rgba(50, 214, 107, 0.08);
    border-color: var(--green);
    color: var(--dark);
}

.lms-callout.important {
    background: rgba(79, 140, 255, 0.08);
    border-color: var(--blue);
    color: var(--dark);
}

.lms-callout.warning {
    background: rgba(255, 159, 67, 0.08);
    border-color: var(--orange);
    color: var(--dark);
}

.lms-callout strong {
    display: block;
    margin-bottom: 6px;
    font-weight: 850;
    font-size: 15px;
}

.lms-lecture-footer {
    display: flex;
    justify-content: flex-end;
    border-top: 2px solid var(--border);
    padding-top: 24px;
    margin-top: 32px;
}

/* --- Quiz Prep / Intro Screen --- */
.lms-quiz-intro {
    text-align: center;
    padding: 20px;
    animation: fadeIn 0.4s ease both;
}

.lms-quiz-icon {
    font-size: 64px;
    margin-bottom: 18px;
    display: inline-block;
}

.lms-quiz-intro-title {
    font-size: 26px;
    font-weight: 900;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
}

.lms-quiz-intro-desc {
    color: var(--muted);
    font-weight: 650;
    max-width: 500px;
    margin: 0 auto 28px;
    line-height: 1.6;
}

.lms-focus-room-note {
    max-width: 480px;
    margin: 14px auto 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
    line-height: 1.55;
}

.lms-quiz-rules-card {
    background: var(--soft);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 20px;
    max-width: 480px;
    margin: 0 auto 32px;
    text-align: left;
}

.lms-quiz-rules-title {
    font-size: 15px;
    font-weight: 850;
    margin-bottom: 12px;
}

.lms-quiz-rules-list {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
    padding-left: 18px;
}

.lms-quiz-rules-list li {
    margin-bottom: 8px;
}

/* --- Right Sidebar (LMS Stats & Notes) --- */
.lms-right-sidebar {
    display: grid;
    gap: 16px;
    position: sticky;
    top: 96px;
}

.lms-badge-cabinet {
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 22px;
    box-shadow: var(--shadow-soft);
}

.lms-badge-title {
    font-size: 16px;
    font-weight: 900;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
    color: var(--dark);
}

.lms-badge-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.lms-badge-slot {
    aspect-ratio: 1;
    border-radius: 20px;
    background: var(--soft);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    color: inherit;
    font: inherit;
    transition: transform 0.28s cubic-bezier(0.25, 0.8, 0.25, 1.35), background-color 0.28s, border-color 0.28s, box-shadow 0.28s;
}
body.dark-theme .lms-badge-slot {
    background: rgba(255, 255, 255, 0.02);
}

.lms-badge-slot:disabled {
    cursor: default;
}

.lms-badge-slot:hover:not(:disabled) {
    transform: scale(1.1) rotate(4deg);
    box-shadow: var(--shadow-soft);
}

.lms-badge-slot.unlocked {
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.08), rgba(50, 214, 107, 0.06));
    border-color: rgba(79, 140, 255, 0.35);
}
body.dark-theme .lms-badge-slot.unlocked {
    background: linear-gradient(135deg, rgba(61, 219, 217, 0.12), rgba(50, 214, 107, 0.08));
}

.lms-badge-slot.unlocked:hover {
    box-shadow: 0 10px 20px rgba(50, 214, 107, 0.15);
    border-color: var(--green);
}
body.dark-theme .lms-badge-slot.unlocked:hover {
    box-shadow: 0 10px 20px rgba(50, 214, 107, 0.25);
}

.lms-badge-icon {
    font-size: 24px;
    opacity: 0.25;
    filter: grayscale(1);
    transition: opacity 0.3s, filter 0.3s;
}

.lms-badge-slot.unlocked .lms-badge-icon {
    opacity: 1;
    filter: none;
}

.lms-badge-tooltip {
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%) scale(0.9);
    background: var(--dark);
    color: var(--white);
    padding: 8px 14px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: var(--shadow);
    z-index: 10;
}

.lms-badge-slot:hover .lms-badge-tooltip {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Notebook widget */
.lms-notes-widget {
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 22px;
    box-shadow: var(--shadow-soft);
}

.lms-notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.lms-notes-title {
    font-size: 16px;
    font-weight: 900;
    margin-bottom: 0;
    color: var(--dark);
}

.lms-notes-save-indicator {
    font-size: 10px;
    font-weight: 800;
    color: var(--green-dark);
    opacity: 0;
    transition: opacity 0.3s ease;
}
body.dark-theme .lms-notes-save-indicator {
    color: var(--green);
}

.lms-notes-textarea {
    width: 100%;
    height: 120px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--soft);
    padding: 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    resize: none;
    outline: none;
    color: var(--dark);
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}
body.dark-theme .lms-notes-textarea {
    background: rgba(255, 255, 255, 0.02);
}

.lms-notes-textarea:focus {
    border-color: var(--blue);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.15);
}
body.dark-theme .lms-notes-textarea:focus {
    background: rgba(17, 32, 51, 0.65);
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(61, 219, 217, 0.2);
}

/* --- Interactive AI Tutor Drawer --- */
.lms-ai-tutor-container {
    margin-top: 18px;
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    max-height: 0;
    opacity: 0;
    box-shadow: var(--shadow-soft);
}

.lms-ai-tutor-container.open {
    max-height: 400px;
    opacity: 1;
    margin-bottom: 12px;
}

.lms-ai-header {
    background: linear-gradient(90deg, #102138, #07101c);
    color: white;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.lms-ai-title {
    font-size: 13px;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lms-ai-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-weight: 900;
    font-size: 15px;
    transition: transform 0.2s ease;
}
.lms-ai-close-btn:hover {
    transform: scale(1.1);
}

.lms-ai-chat-history {
    height: 240px;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(255, 255, 255, 0.3);
}
.dark-theme .lms-ai-chat-history {
    background: rgba(13, 27, 44, 0.4);
}

.lms-ai-bubble {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
}

.lms-ai-bubble.tutor {
    align-self: flex-start;
    background: var(--white);
    color: var(--dark);
    border: 1px solid var(--border);
    border-top-left-radius: 4px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.lms-ai-bubble.student {
    align-self: flex-end;
    background: var(--blue);
    color: white;
    border-top-right-radius: 4px;
}

.lms-ai-typing-loader {
    display: flex;
    gap: 4px;
    padding: 8px;
}

.lms-ai-typing-loader span {
    width: 6px;
    height: 6px;
    border-radius: 99px;
    background: var(--muted);
    animation: typingDots 1.4s infinite ease-in-out;
}

.lms-ai-typing-loader span:nth-child(2) { animation-delay: 0.2s; }
.lms-ai-typing-loader span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingDots {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.lms-ai-footer {
    padding: 10px;
    border-top: 1px solid var(--border);
    background: var(--white);
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
}
.lms-ai-footer::-webkit-scrollbar { display: none; }

.lms-ai-chip {
    padding: 6px 12px;
    background: var(--soft);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
    color: var(--dark);
}

.lms-ai-chip:hover {
    background: rgba(79, 140, 255, 0.1);
    border-color: var(--blue);
}

/* --- Digital Certificate Design --- */
.lms-modal {
    position: fixed;
    inset: 0;
    background: rgba(13, 27, 44, 0.65);
    backdrop-filter: blur(12px);
    z-index: 1000;
    display: none;
    place-items: center;
    padding: 24px;
    animation: fadeIn 0.3s ease;
}

.lms-modal.show {
    display: grid;
}

.lms-modal-content {
    background: var(--white);
    border-radius: 34px;
    width: 100%;
    max-width: 880px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    animation: slideUp 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28) both;
}

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

.lms-modal-title {
    font-size: 18px;
    font-weight: 900;
}

.lms-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--muted);
}

.lms-modal-body {
    padding: 24px;
    max-height: 80vh;
    overflow-y: auto;
}

/* Print Area (The Certificate itself) */
.lms-cert-frame {
    background: radial-gradient(circle, #fdfbf7 0%, #faf6ec 100%);
    border: 18px double #d4af37; /* Double Gold border */
    padding: 50px 40px;
    border-radius: 4px;
    text-align: center;
    position: relative;
    color: #1e293b;
    box-shadow: inset 0 0 100px rgba(212, 175, 55, 0.08), 0 15px 35px rgba(0,0,0,0.1);
    font-family: 'Inter', Georgia, serif;
}

.lms-cert-frame::before {
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(212, 175, 55, 0.45);
    pointer-events: none;
}

.lms-cert-kicker {
    font-family: 'Cinzel', 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: #d4af37;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    margin-bottom: 18px;
}

.lms-cert-header {
    font-family: 'Cinzel', 'Inter', sans-serif;
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 0.05em;
    color: #0f172a;
    margin-bottom: 24px;
    text-shadow: 1px 1px 1px rgba(255,255,255,0.8);
}

.lms-cert-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 15px;
    font-style: italic;
    color: #475569;
    font-weight: 500;
    margin-bottom: 18px;
}

.lms-cert-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 38px;
    font-weight: 800;
    font-style: italic;
    color: #0f172a;
    border-bottom: 2px solid rgba(212, 175, 55, 0.4);
    display: inline-block;
    padding-bottom: 4px;
    margin-bottom: 24px;
    min-width: 320px;
    outline: none;
    letter-spacing: 0.02em;
}

.lms-cert-course {
    font-family: 'Cinzel', 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: #0d2c54;
    margin-bottom: 32px;
}

.lms-cert-seal-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-top: 36px;
}

.lms-cert-sig {
    border-top: 1px solid #cbd5e1;
    padding-top: 8px;
    width: 150px;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
}

.lms-cert-sig-line {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 18px;
    font-weight: 700;
    font-style: italic;
    color: #0d2c54;
    margin-bottom: 6px;
}

.lms-cert-seal {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffe259 0%, #ffa751 100%);
    border: 4px solid #fff;
    box-shadow: 0 8px 20px rgba(212, 175, 55, 0.4), inset 0 0 12px rgba(255, 255, 255, 0.6);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.lms-cert-seal::after {
    content: "🏆";
    font-size: 32px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.lms-cert-ribbon-l, .lms-cert-ribbon-r {
    position: absolute;
    width: 16px;
    height: 44px;
    top: 60px;
    z-index: -1;
}

.lms-cert-ribbon-l {
    background: #d4af37;
    left: 18px;
    transform: rotate(20deg);
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 50% 85%, 0% 100%);
    box-shadow: -2px 4px 8px rgba(0, 0, 0, 0.1);
}

.lms-cert-ribbon-r {
    background: #bfa030;
    right: 18px;
    transform: rotate(-20deg);
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 50% 85%, 0% 100%);
    box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.1);
}

.lms-cert-meta {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 32px;
    border-top: 1px solid #f1f5f9;
    padding-top: 12px;
}

/* User Input layout in certificate popup */
.lms-cert-input-row {
    margin-bottom: 18px;
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--soft);
    padding: 14px 18px;
    border-radius: 18px;
    border: 1px solid var(--border);
}

.lms-cert-input-row label {
    font-size: 13px;
    font-weight: 900;
    color: var(--muted);
}

.lms-cert-input-row input {
    flex-grow: 1;
    min-height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    padding: 0 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    color: var(--dark);
    background: var(--white);
}

/* --- Print overrides --- */
@media print {
    body * {
        visibility: hidden;
    }
    .lms-cert-frame, .lms-cert-frame * {
        visibility: visible;
    }
    .lms-cert-frame {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        border: 10px double #d4af37;
        box-shadow: none;
        background: white;
    }
    .lms-modal-content, .lms-modal {
        background: none;
        backdrop-filter: none;
        border: none;
        box-shadow: none;
    }
}

/* --- Fade In animation --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Responsive Adjustments --- */
@media (max-width: 1024px) {
    .lms-classroom {
        grid-template-columns: 260px 1fr;
    }
    .lms-right-sidebar {
        grid-column: 1 / -1;
        grid-template-columns: repeat(2, 1fr);
        position: static;
        margin-top: 16px;
    }
}

@media (max-width: 768px) {
    .lms-classroom {
        grid-template-columns: 1fr;
    }
    .lms-sidebar-outline {
        position: static;
        max-height: 300px;
    }
    .lms-right-sidebar {
        grid-template-columns: 1fr;
    }
    .lms-tracks-grid {
        grid-template-columns: 1fr;
    }
    .lms-modal-content {
        border-radius: 20px;
    }
    .lms-cert-frame {
        padding: 20px;
        border-width: 8px;
    }
    .lms-cert-header {
        font-size: 26px;
    }
    .lms-cert-name {
        font-size: 22px;
        min-width: 180px;
    }
    .lms-cert-course {
        font-size: 15px;
    }

    .lms-track-meta {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    .lms-track-actions {
        justify-content: stretch;
    }

    .lms-track-actions .lms-track-btn,
    .lms-track-certificate-btn {
        flex: 1 1 150px;
        text-align: center;
    }
}

/* --- Global Stats Bar (Clean layout override) --- */
.lms-global-stats {
    margin-bottom: 32px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    text-align: center;
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    box-shadow: var(--shadow-soft);
    padding: 8px;
}

.lms-stat-line {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    border-right: 1px solid var(--border);
}

.lms-stat-line:last-child {
    border-right: none;
}

.lms-stat-label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--muted);
}

.lms-stat-value {
    font-size: 24px;
    font-weight: 900;
}

.lms-stat-value.green { color: var(--green-dark); }
body.dark-theme .lms-stat-value.green { color: var(--green); }
.lms-stat-value.blue { color: var(--blue); }
.lms-stat-value.purple { color: var(--purple); }

/* --- Question Card Smooth Switching Animation --- */
#questionCard, #lmsQuestionCard {
    transition: opacity 0.18s cubic-bezier(0.4, 0, 0.2, 1), transform 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-fade-out {
    opacity: 0;
    transform: translateY(-12px);
}

.question-fade-in {
    opacity: 0;
    transform: translateY(12px);
    transition: none !important;
}
