/* ============================================
   pages.css — Style riêng cho các trang pages/ và ai-tools/
   ============================================ */

/* Auth forms (login/register) */
.auth-card {
    max-width: 28rem;
    margin: 0 auto;
}

/* Course detail chapter rows */
.chapter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* AI Tools workspace form field group */
.workspace-field label {
    display: block;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #334155;
    margin-bottom: .5rem;
}

/* Blog card */
.blog-card img,
.blog-card .blog-thumb {
    height: 10rem;
    width: 100%;
    object-fit: cover;
}

/* Library resource card */
.resource-card {
    transition: transform .15s ease, box-shadow .15s ease;
}
.resource-card:hover {
    transform: translateY(-2px);
}

/* Legal pages (terms/privacy/cookie) */
.legal-content h2 {
    font-size: 1.125rem;
    font-weight: 800;
    color: #0f172a;
    margin-top: 2rem;
    margin-bottom: .5rem;
}
.legal-content p {
    font-size: .875rem;
    color: #475569;
    line-height: 1.7;
    margin-bottom: .75rem;
}

/* ============================================
   AI TOOLS — style bổ sung riêng cho 6 công cụ trong ai-tools/
   (nối thêm, không sửa các class phía trên)
   ============================================ */

/* Khối giá trị đầu vào dạng thẻ chọn (radio/checkbox card) dùng ở nhiều công cụ */
.option-card {
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: .75rem 1rem;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .75rem;
    font-weight: 600;
    color: #475569;
    background: #fff;
}
.option-card:hover {
    border-color: #a5b4fc;
}
.option-card.selected {
    border-color: #6366f1;
    background: #eef2ff;
    color: #4338ca;
}
.option-card input {
    accent-color: #6366f1;
}

/* Tabs dùng cho nguồn nội dung (lesson.html) và exam.html */
.source-tabs,
.result-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}
.source-tab,
.result-tab {
    padding: .5rem 1rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .15s ease;
}
.source-tab.active,
.result-tab.active {
    background: #4f46e5;
    color: #fff;
}

/* Khối kết quả có cấu trúc (giáo án / bài giảng) */
.structured-block {
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    background: #f8fafc;
}
.structured-block .structured-title {
    font-size: .75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: #4338ca;
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-bottom: .5rem;
}
.structured-block p,
.structured-block li {
    font-size: .8rem;
    color: #334155;
    line-height: 1.6;
}
.structured-block ul {
    padding-left: 1.1rem;
    list-style: disc;
}

/* Slide preview (slides.html) */
.slide-preview-main {
    aspect-ratio: 16 / 9;
    border-radius: 1rem;
    background: linear-gradient(135deg, #4338ca, #6366f1);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.5rem;
    position: relative;
}
.slide-thumb-strip {
    display: flex;
    gap: .6rem;
    overflow-x: auto;
    padding: .25rem 0 .5rem;
}
.slide-thumb {
    flex: 0 0 auto;
    width: 5.5rem;
    aspect-ratio: 16/9;
    border-radius: .5rem;
    border: 2px solid transparent;
    background: #e0e7ff;
    color: #4338ca;
    font-size: .65rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.slide-thumb.active {
    border-color: #4f46e5;
    background: #c7d2fe;
}

/* Question cards (questions.html) */
.question-card {
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.1rem 1.25rem;
    background: #fff;
}
.question-option {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .78rem;
    color: #475569;
    padding: .4rem .6rem;
    border-radius: .6rem;
}
.question-option.correct {
    background: #ecfdf5;
    color: #047857;
    font-weight: 700;
}
.question-explain {
    margin-top: .6rem;
    padding: .6rem .8rem;
    border-radius: .6rem;
    background: #fffbeb;
    border: 1px solid #fde68a;
    font-size: .75rem;
    color: #92400e;
}

/* Matrix table (exam.html) */
.matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .75rem;
}
.matrix-table th,
.matrix-table td {
    border: 1px solid #e2e8f0;
    padding: .55rem .7rem;
    text-align: center;
}
.matrix-table th {
    background: #f1f5f9;
    color: #334155;
    font-weight: 700;
}

/* Video workflow stepper (video.html) */
.video-steps {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}
.video-step-pill {
    flex: 1 1 auto;
    min-width: 6.5rem;
    text-align: center;
    padding: .6rem .5rem;
    border-radius: .8rem;
    background: #f1f5f9;
    color: #94a3b8;
    font-size: .68rem;
    font-weight: 700;
    border: 1px solid #e2e8f0;
    transition: all .2s ease;
}
.video-step-pill.active {
    background: #ede9fe;
    color: #6d28d9;
    border-color: #c4b5fd;
}
.video-step-pill.done {
    background: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}
.video-preview-frame {
    aspect-ratio: 16/9;
    border-radius: 1rem;
    background: #0f172a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .5rem;
}

/* ============================================
   BỔ SUNG DÙNG CHUNG TOÀN SITE — nối thêm cho việc đồng bộ
   CSS/JS (search box, filter bar, toast, modal, loading, empty
   state, course/teacher card, progress state...). Không sửa các
   rule phía trên.
   ============================================ */

/* ---------- Search box (courses.html...) ---------- */
.search-box {
    position: relative;
}
.search-box-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: .8rem;
}
.search-box-input {
    width: 100%;
    padding: .85rem 1rem .85rem 2.5rem;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    font-size: .875rem;
    background: #fff;
}
.search-box-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3b82f6;
}

/* ---------- Filter bar (courses.html, question-bank...) ---------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}
.filter-select {
    flex: 1 1 10rem;
    padding: .65rem 1rem;
    border-radius: .85rem;
    border: 1px solid #e2e8f0;
    font-size: .8rem;
    font-weight: 600;
    color: #475569;
    background: #fff;
}
.filter-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px #3b82f6;
}

/* ---------- Loading state (khối nội dung đang chờ dữ liệu) ---------- */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 2.5rem 1rem;
    color: #94a3b8;
    font-size: .8rem;
}
.loading-state i {
    font-size: 1.5rem;
    color: #6366f1;
}

/* Nút đang xử lý (setButtonLoading trong main.js gắn class này) */
.btn-loading {
    opacity: .75;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---------- Empty state (không tìm thấy kết quả) ---------- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: 3rem 1.5rem;
    text-align: center;
    color: #94a3b8;
    border: 1px dashed #e2e8f0;
    border-radius: 1.25rem;
    background: #f8fafc;
}
.empty-state i {
    font-size: 1.75rem;
    color: #cbd5e1;
}
.empty-state p {
    font-size: .8rem;
    max-width: 22rem;
}

/* ---------- Toast notification (main.js showToast) ---------- */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    max-width: 22rem;
    width: calc(100% - 2rem);
}
@media (min-width: 640px) {
    .toast-container {
        width: 22rem;
    }
}
.toast {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .85rem 1rem;
    border-radius: 1rem;
    background: #0f172a;
    color: #fff;
    font-size: .8rem;
    font-weight: 600;
    box-shadow: 0 10px 30px -8px rgba(15, 23, 42, 0.4);
    opacity: 0;
    transform: translateX(1rem);
    transition: opacity .2s ease, transform .2s ease;
}
.toast-show {
    opacity: 1;
    transform: translateX(0);
}
.toast-hide {
    opacity: 0;
    transform: translateX(1rem);
}
.toast span {
    flex: 1;
}
.toast-close {
    color: rgba(255,255,255,.6);
    flex-shrink: 0;
}
.toast-close:hover {
    color: #fff;
}
.toast-success i:first-child { color: #34d399; }
.toast-error i:first-child { color: #fb7185; }
.toast-info i:first-child { color: #60a5fa; }

/* ---------- Modal dùng chung (main.js openModal/closeModal) ---------- */
.app-modal.open {
    display: flex !important;
}
body.modal-open {
    overflow: hidden;
}

/* ---------- Chat interface (ai-tutor.html) ---------- */
.chat-bubble-user {
    background: #7c3aed;
    color: #fff;
    border-radius: 1rem 1rem .25rem 1rem;
}
.chat-bubble-ai {
    background: #fff;
    color: #334155;
    border: 1px solid #f1f5f9;
    border-radius: 1rem 1rem 1rem .25rem;
}

/* ---------- Course card (courses.js render động) ---------- */
.course-card {
    display: flex;
    flex-direction: column;
}

/* ---------- Teacher card / hàng danh sách học viên ---------- */
.teacher-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 1.25rem;
    background: #fff;
}

/* ---------- Progress state chung (thành công / lỗi / đang chờ) ---------- */
.state-success {
    border-color: #a7f3d0 !important;
    background: #ecfdf5 !important;
}
.state-error {
    border-color: #fecdd3 !important;
    background: #fff1f2 !important;
}
.state-pending {
    border-color: #fde68a !important;
    background: #fffbeb !important;
}
