/* Custom CSS cho ThayDucTinHoc - Phong cách Modern & Professional */
:root {
  --md-primary-fg-color:        #4F46E5; /* Indigo 600 - Main Brand Color */
  --md-primary-fg-color--light: #6366F1; /* Indigo 500 */
  --md-primary-fg-color--dark:  #4338CA; /* Indigo 700 */
  --md-accent-fg-color:         #0EA5E9; /* Sky 500 - Secondary Accent */
  
  --card-bg-light: #ffffff;
  --card-bg-dark:  #1e293b;
  --card-shadow:   0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --card-radius:   12px;
}

/* ===== GLOBAL TYPOGRAPHY ===== */
body {
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.md-typeset h1 {
  font-weight: 800;
  color: var(--md-primary-fg-color);
  letter-spacing: -0.025em;
  margin-bottom: 1.5rem;
}

[data-md-color-scheme="slate"] .md-typeset h1 {
    color: #f1f5f9;
}

.md-typeset h2 {
  font-weight: 700;
  margin-top: 2.5rem;
  letter-spacing: -0.015em;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

[data-md-color-scheme="slate"] .md-typeset h2 {
    border-bottom-color: #334155;
}

.md-typeset h3 {
  font-weight: 600;
  margin-top: 2rem;
}

/* ===== LANDING PAGE / HERO SECTION ===== */
.hero-section {
    text-align: center;
    padding: 4rem 1rem;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
    border-radius: 24px;
    margin-bottom: 3rem;
    box-shadow: inset 0 0 20px rgba(79, 70, 229, 0.05);
}

[data-md-color-scheme="slate"] .hero-section {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    background: -webkit-linear-gradient(45deg, #4F46E5, #0EA5E9);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: #64748b;
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

[data-md-color-scheme="slate"] .hero-subtitle {
    color: #94a3b8;
}

.cta-button {
    display: inline-block;
    background-color: var(--md-primary-fg-color);
    color: white !important;
    padding: 12px 32px;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px 0 rgba(79, 70, 229, 0.39);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.23);
    background-color: var(--md-primary-fg-color--light);
}

/* ===== FEATURE GRID / CARDS ===== */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.card {
    background: var(--card-bg-light);
    border: 1px solid #e2e8f0;
    border-radius: var(--card-radius);
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

[data-md-color-scheme="slate"] .card {
    background: var(--card-bg-dark);
    border-color: #334155;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow);
    border-color: var(--md-primary-fg-color--light);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--md-primary-fg-color);
}

.card-title {
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.card-desc {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.5;
}

[data-md-color-scheme="slate"] .card-desc {
    color: #94a3b8;
}

/* ===== NAVIGATION ADJUSTMENTS ===== */
.md-header {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
}

/* Light mode: hàng trên cùng của header (logo, tiêu đề, icon, ô tìm kiếm) nằm
   trên nền trắng nên foreground phải là màu tối — nếu không sẽ bị chữ trắng trên
   nền trắng (vô hình). Chỉ ghi đè trong .md-header__inner để KHÔNG ảnh hưởng
   thanh .md-tabs (nằm trong <header> nhưng có nền indigo, cần chữ trắng). */
[data-md-color-scheme="default"] .md-header__inner {
    --md-primary-bg-color: #1e293b;
    --md-primary-bg-color--light: rgba(30, 41, 59, 0.72);
    color: #1e293b;
}

[data-md-color-scheme="slate"] .md-header {
    background-color: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid #1e293b;
}

/* Override default header colors to match new theme */
.md-header[data-md-state="shadow"] {
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

/* ===== ADMONITIONS ===== */
.md-typeset .admonition, 
.md-typeset details {
    border-radius: 8px;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.md-typeset .admonition-title, 
.md-typeset summary {
    font-weight: 600;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

/* ===== CODE BLOCKS ===== */
.md-typeset pre > code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    border-radius: 8px;
}

/* ===== TABLES ===== */
.md-typeset table:not([class]) {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 0 1px #e2e8f0;
    font-size: 0.9rem;
}

.md-typeset table:not([class]) th {
    background-color: #f8fafc;
    color: #334155;
    font-weight: 600;
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) {
    box-shadow: 0 0 0 1px #334155;
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
    background-color: #1e293b;
    color: #e2e8f0;
}

/* ===== QUIZ COMPONENTS ===== */
.quiz-wrapper {
    /* Container only, no visual style */
    margin: 24px 0;
}

.quiz-question {
    background: var(--card-bg-light);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem; /* Tách biệt các câu hỏi */
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

[data-md-color-scheme="slate"] .quiz-question {
    background: var(--card-bg-dark);
    border-color: #334155;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.quiz-question:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Loại bỏ border-bottom cũ */
.quiz-question:last-child {
    margin-bottom: 1.5rem;
}

.question-text {
    font-size: 1.15rem; /* To hơn chút */
    font-weight: 700;
    margin-bottom: 1.2rem;
    color: #1e293b; /* Màu đậm hơn cho Light mode */
    line-height: 1.5;
}

[data-md-color-scheme="slate"] .question-text {
    color: #f1f5f9; /* Màu sáng rõ cho Dark mode */
}

.option-item {
    display: flex;
    align-items: center;
    padding: 12px 16px; /* Tăng padding */
    margin-bottom: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background-color: #fff;
}

[data-md-color-scheme="slate"] .option-item {
    background-color: #1e293b; 
    border-color: #475569;
    color: #e2e8f0; /* Chữ option sáng */
}

.option-item:hover {
    background-color: #f8fafc;
    border-color: var(--md-primary-fg-color);
    transform: translateX(5px); /* Hiệu ứng di chuyển nhẹ */
}

[data-md-color-scheme="slate"] .option-item:hover {
    background-color: #334155;
}

.option-item input[type="radio"] {
    margin-right: 15px;
    accent-color: var(--md-primary-fg-color);
    width: 18px;
    height: 18px;
}

/* Correct/Wrong Styles */
.quiz-question.correct {
    border-color: #10b981;
    background-color: rgba(16, 185, 129, 0.05);
}

[data-md-color-scheme="slate"] .quiz-question.correct {
    background-color: rgba(16, 185, 129, 0.1);
}

.quiz-question.wrong {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
}

[data-md-color-scheme="slate"] .quiz-question.wrong {
    background-color: rgba(239, 68, 68, 0.1);
}

.quiz-question.correct .option-item input:checked + .option-text {
    color: #059669;
    font-weight: 700;
}

[data-md-color-scheme="slate"] .quiz-question.correct .option-item input:checked + .option-text {
    color: #34d399;
}

.quiz-question.wrong .option-item input:checked + .option-text {
    color: #dc2626;
    font-weight: 700;
}

[data-md-color-scheme="slate"] .quiz-question.wrong .option-item input:checked + .option-text {
    color: #f87171;
}

.correct-answer-highlight {
    background-color: rgba(16, 185, 129, 0.1) !important;
    border-color: #10b981 !important;
    box-shadow: 0 0 0 1px #10b981;
}

.explanation {
    margin-top: 15px;
    padding: 15px;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95em;
    line-height: 1.6;
}

[data-md-color-scheme="slate"] .explanation {
    background-color: #0f172a;
    border-color: #334155;
    color: #cbd5e1;
}

/* Result Box */
.quiz-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px dashed #e2e8f0;
}

[data-md-color-scheme="slate"] .quiz-controls {
    border-top-color: #334155;
}

.quiz-result {
    text-align: center;
    width: 100%;
    animation: fadeIn 0.5s ease-out;
}

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

.score-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: var(--md-primary-fg-color);
    color: white;
    padding: 15px 30px;
    border-radius: 16px;
    margin-bottom: 15px;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

.score-number {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 5px;
}

.score-text {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-message {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--md-primary-fg-color);
    margin-top: 10px;
}

[data-md-color-scheme="slate"] .result-message {
    color: #818cf8;
}
