/* style.css */

/* Cấu hình font Inter cho toàn bộ body */
body {
    margin: 0; 
    font-family: 'Inter', sans-serif;
    background-color: #f3f4f6; /* Màu nền nhẹ */
}

/* CSS cho overlay của menu mobile */
.mobile-menu-overlay {
    display: none; /* Mặc định ẩn */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 40;
}

/* CSS cho menu mobile */
.mobile-menu {
    position: fixed;
    top: 0;
    right: -100%; /* Bắt đầu ẩn ngoài màn hình */
    width: 75%;
    max-width: 300px;
    height: 100%;
    background-color: #ffffff;
    transition: right 0.3s ease-in-out;
    z-index: 50;
    padding: 1rem;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
}

/* Class để hiển thị menu mobile */
.mobile-menu.open {
    right: 0; /* Hiện ra khi mở */
}


/* sidebar */
/* ========================= */
/* ===  Sidebar Styling  === */
/* ========================= */

/* Áp dụng cho từng ô nội dung (widget) trong sidebar */
.sidebar-widget {
    background-color: #f9fafb; /* Màu nền xám rất nhạt */
    padding: 1.25rem; /* Tăng padding bên trong */
    margin-bottom: 1.5rem; /* Khoảng cách giữa các widget */
    border-radius: 0.75rem; /* Bo góc mềm mại hơn */
    border: 1px solid #e5e7eb; /* Thêm viền mỏng */
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.sidebar-widget:hover {
    transform: translateY(-3px); /* Hiệu ứng nổi lên khi di chuột */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); /* Đổ bóng rõ hơn */
}

/* Loại bỏ khoảng cách dưới của widget cuối cùng */
.sidebar-widget:last-child {
    margin-bottom: 0;
}

/* Tiêu đề của widget (ví dụ: "Bài viết gần đây") */
.sidebar-widget h3 {
    font-size: 1.2rem;
    font-weight: 700; /* In đậm hơn */
    color: #111827; /* Màu chữ tối */
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #3b82f6; /* Đường gạch chân màu xanh */
}

/* Các mục trong danh sách (Bài viết, Danh mục) - ĐÃ CẬP NHẬT */
#recent-posts-list li a,
#category-list li a,
#sidebar-posts-list li a,
#sidebar-exams-list li a,
#sidebar-subjects-list li a {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease-in-out;
    font-weight: 500;
    color: #4b5563;
    position: relative;
    padding-left: 2rem;
    border-bottom: 1px solid #f3f4f6; /* Thêm đường kẻ mờ ngăn cách */
}

/* Thêm icon mũi tên phía trước mỗi mục - ĐÃ CẬP NHẬT */
#recent-posts-list li a::before,
#category-list li a::before,
#sidebar-posts-list li a::before,
#sidebar-exams-list li a::before,
#sidebar-subjects-list li a::before {
    content: '❯';
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    color: #3b82f6;
    transition: all 0.2s ease-in-out;
}

/* Hiệu ứng khi di chuột qua một mục trong danh sách - ĐÃ CẬP NHẬT */
#recent-posts-list li a:hover,
#category-list li a:hover,
#sidebar-posts-list li a:hover,
#sidebar-exams-list li a:hover,
#sidebar-subjects-list li a:hover {
    background-color: #3b82f6;
    color: #ffffff;
    transform: translateX(5px);
}

/* Thay đổi màu icon khi di chuột - ĐÃ CẬP NHẬT */
#recent-posts-list li a:hover::before,
#category-list li a:hover::before,
#sidebar-posts-list li a:hover::before,
#sidebar-exams-list li a:hover::before,
#sidebar-subjects-list li a:hover::before {
    color: #ffffff;
}

/* Widget thông báo/quảng cáo đặc biệt */
.widget-notification {
    background: linear-gradient(135deg, #60a5fa, #3b82f6); /* Nền gradient */
    color: white;
    border: none;
}

.widget-notification h3 {
    color: white;
    border-bottom-color: #93c5fd; /* Màu gạch chân nhạt hơn */
}

.widget-notification p {
    color: #dbeafe; /* Màu chữ nhạt */
}

/* === Skeleton Loader Styling === */
.skeleton {
    background-color: #e5e7eb; /* bg-gray-200 */
    position: relative;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    100% {
        transform: translateX(100%);
    }
}

.skeleton-img {
    height: 12rem; /* h-48 */
    border-radius: 0.375rem; /* rounded-md */
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem; /* rounded-sm */
}

/* Hiệu ứng cho nút bấm chung */
.btn {
  transition: all 0.3s ease-in-out;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Hiệu ứng cho các thẻ `<a>` có class tương tự nút */
a.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}



/* Đảm bảo bảng trong admin không làm vỡ layout trên màn hình nhỏ */
@media (max-width: 767px) {
    #questions-table, #users-table { /* Áp dụng cho bảng câu hỏi và thành viên */
        display: block;
        width: 100%;
        overflow-x: auto; /* Cho phép cuộn ngang */
        -webkit-overflow-scrolling: touch; /* Cuộn mượt hơn trên iOS */
    }
}


.option-correct {
    background-color: #e6fffa; /* bg-green-50 */
    border-color: #38a169; /* border-green-500 */
    color: #2f855a; /* text-green-700 */
}
.option-incorrect {
    background-color: #fff5f5; /* bg-red-50 */
    border-color: #e53e3e; /* border-red-500 */
    color: #c53030; /* text-red-700 */
}

/* Hiệu ứng cho thông điệp cổ vũ */
@keyframes fadeInOut {
    0%, 100% { opacity: 0; transform: translateY(10px); }
    20%, 80% { opacity: 1; transform: translateY(0); }
}
.feedback-anim {
    animation: fadeInOut 2s ease-in-out;
}



@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

.quiz-fade-in {
  animation: fade-in 0.3s ease-out forwards;
}

.quiz-fade-out {
  animation: fade-out 0.3s ease-in forwards;
}


/* CSS cho Feature Cards */
.feature-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}
.feature-card .overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
}
.feature-card .card-content {
    position: relative;
    z-index: 10;
}

/* CSS cho Subject Cards */
.subject-card {
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease;
}
.subject-card:hover {
    transform: scale(1.05);
}
.subject-card .overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    transition: background-color 0.3s ease;
}
.subject-card:hover .overlay {
    background-color: rgba(0, 0, 0, 0.2);
}
.subject-card .card-title {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    color: white;
    font-size: 1.25rem;
    font-weight: bold;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
}

/* =================================== */
/* === STYLE CHO TRANG SINGLE POST === */
/* =================================== */

/* Tùy chỉnh cho plugin typography của Tailwind */
.prose {
    color: #374151; /* text-gray-700 */
}

/* Tăng kích thước font cho các tiêu đề trong bài viết */
.prose h2 {
    font-size: 1.875rem; /* text-3xl */
    margin-top: 2.5em;
    margin-bottom: 1.25em;
}

.prose h3 {
    font-size: 1.5rem; /* text-2xl */
    margin-top: 2em;
    margin-bottom: 1em;
}

/* Style cho các liên kết trong nội dung bài viết */
.prose a {
    color: #2563eb; /* text-blue-600 */
    text-decoration: underline;
    transition: color 0.2s ease-in-out;
}
.prose a:hover {
    color: #1d4ed8; /* text-blue-800 */
}

/* Style cho trích dẫn (blockquote) */
.prose blockquote {
    border-left-color: #3b82f6; /* border-blue-500 */
    color: #4b5563; /* text-gray-600 */
    font-style: italic;
    padding-left: 1.5rem;
}

/* Style cho hình ảnh trong nội dung bài viết */
.prose img {
    border-radius: 0.5rem; /* rounded-lg */
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* Style cho danh sách */
.prose ul > li::before {
    background-color: #6b7280; /* text-gray-500 */
}

/* === CSS CHO BẢNG ĐIỀU HƯỚNG CÂU HỎI MỚI === */
.question-palette-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 48px; /* Tăng chiều rộng */
    height: 60px; /* Tăng chiều cao */
    border: 2px solid #e5e7eb; /* border-gray-200 */
    border-radius: 0.5rem; /* rounded-lg */
    cursor: pointer;
    background-color: white;
    transition: all 0.2s ease-in-out;
    font-family: 'Inter', sans-serif;
}

.question-palette-item:hover {
    border-color: #93c5fd; /* border-blue-300 */
    background-color: #eff6ff; /* bg-blue-50 */
}

/* Style cho câu hỏi đang được chọn */
.question-palette-item.active {
    border-color: #2563eb; /* border-blue-600 */
    background-color: #dbeafe; /* bg-blue-100 */
    font-weight: 700;
}

.question-palette-number {
    font-size: 1rem; /* text-base */
    font-weight: 600; /* font-semibold */
    color: #374151; /* text-gray-700 */
}

/* Vùng chứa các chấm đáp án */
.question-palette-answers {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

/* Mỗi chấm đáp án */
.question-palette-answers span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #d1d5db; /* bg-gray-300 */
    transition: background-color 0.2s;
}

/* Chấm của đáp án đã được người dùng chọn */
.question-palette-answers span.selected-answer {
    background-color: #2563eb; /* bg-blue-600 */
}

/* Tối ưu cột sidebar dính trên màn hình lớn */
@media (min-width: 1024px) { /* Áp dụng cho màn hình lg trở lên */
    #question-palette-container.lg\:sticky {
        align-self: flex-start; /* Giúp cột không bị kéo dài theo cột nội dung */
        max-height: calc(100vh - 7rem); /* Giới hạn chiều cao để không bị tràn màn hình */
        overflow-y: auto; /* Thêm thanh cuộn nếu danh sách câu hỏi quá dài */
    }
}

/* ========================= */
/* ===  Daily Streak CSS === */
/* ========================= */

#streak-counter {
    padding: 4px 8px;
    border-radius: 9999px; /* bo tròn */
    background-color: #fff3e0; /* màu nền cam nhạt */
    border: 1px solid #ffe0b2;
    transition: all 0.3s ease;
    cursor: pointer;
}

#streak-counter:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 10px rgba(255, 152, 0, 0.3);
}

/* Style cho các mốc chuỗi */
#streak-counter.streak-bronze {
    background-color: #efebe9;
    border-color: #d7ccc8;
}
#streak-counter.streak-bronze span {
    color: #5d4037; /* màu đồng */
}

#streak-counter.streak-silver {
    background-color: #eceff1;
    border-color: #cfd8dc;
}
#streak-counter.streak-silver span {
    color: #546e7a; /* màu bạc */
}

#streak-counter.streak-gold {
    background-color: #fffde7;
    border-color: #fff59d;
    animation: pulse-gold 2s infinite;
}
#streak-counter.streak-gold span {
    color: #f57f17; /* màu vàng */
}

#streak-counter.streak-legendary {
    background: linear-gradient(45deg, #f3e5f5, #e1bee7);
    border-color: #ce93d8;
    animation: pulse-legendary 2s infinite;
}
#streak-counter.streak-legendary span {
    color: #6a1b9a; /* màu tím */
}

/* Hiệu ứng nhấp nháy cho các mốc cao */
@keyframes pulse-gold {
    0% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 193, 7, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
}

@keyframes pulse-legendary {
    0% { box-shadow: 0 0 0 0 rgba(171, 71, 188, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(171, 71, 188, 0); }
    100% { box-shadow: 0 0 0 0 rgba(171, 71, 188, 0); }
}

/* --- CSS cho câu hỏi Nối Cột (Matching) --- */
.matching-container {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
}
.matching-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.matching-item {
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb; /* border-gray-200 */
    border-radius: 0.5rem; /* rounded-lg */
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    background-color: white;
}
.matching-item:hover {
    border-color: #93c5fd; /* border-blue-300 */
    background-color: #eff6ff; /* bg-blue-50 */
}
/* Trạng thái khi một mục được chọn để bắt đầu nối */
.matching-item.selected {
    border-color: #2563eb; /* border-blue-600 */
    background-color: #dbeafe; /* bg-blue-100 */
    font-weight: 600;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);
}
/* Trạng thái khi một mục đã được nối thành công */
.matching-item.connected {
    background-color: #e5e7eb; /* bg-gray-200 */
    color: #6b7280; /* text-gray-500 */
    cursor: not-allowed;
    opacity: 0.7;
}

/* --- CSS cho các nút chức năng trên trang chủ --- */
.feature-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    border: 2px solid #e5e7eb; /* border-gray-200 */
    border-radius: 0.75rem; /* rounded-xl */
    background-color: white;
    text-align: center;
    font-weight: 600; /* font-semibold */
    color: #374151; /* text-gray-700 */
    transition: all 0.2s ease-in-out;
}
.feature-button:hover {
    border-color: #3b82f6; /* border-blue-500 */
    background-color: #eff6ff; /* bg-blue-50 */
    color: #1d4ed8; /* text-blue-800 */
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}
.feature-button svg {
    margin-bottom: 0.75rem;
    color: #3b82f6; /* text-blue-500 */
}

/* --- CSS cho các khối nội dung trên trang chủ --- */
.content-section {
    padding-top: 4rem; /* py-16 */
    padding-bottom: 4rem;
}

.content-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem; /* mb-8 */
    border-bottom: 1px solid #e5e7eb; /* border-b */
    padding-bottom: 1rem; /* pb-4 */
}

.content-section-title {
    font-size: 1.875rem; /* text-3xl */
    font-weight: 700; /* font-bold */
    color: #1f2937; /* text-gray-800 */
}

.content-item-link {
    display: block;
    padding: 1rem; /* p-4 */
    border: 2px solid #93c5fd; /* border-blue-300 */
    border-radius: 0.75rem; /* rounded-xl */
    text-align: center;
    font-weight: 600; /* font-semibold */
    color: #1d4ed8; /* text-blue-800 */
    background-color: #eff6ff; /* bg-blue-50 */
    transition: all 0.2s ease-in-out;
}

.content-item-link:hover {
    border-color: #2563eb; /* border-blue-600 */
    background-color: #dbeafe; /* bg-blue-100 */
    transform: translateY(-3px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

/* === CSS cho Flashcard === */
.flashcard-scene {
    perspective: 1000px;
}
.flashcard {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    cursor: pointer;
}
.flashcard.is-flipped {
    transform: rotateY(180deg);
}
.flashcard-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    border-radius: 1rem; /* rounded-2xl */
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); /* shadow-xl */
}
.flashcard-front {
    background-color: white;
}
.flashcard-back {
    background-color: #f3f4f6; /* bg-gray-100 */
    transform: rotateY(180deg);
}

@keyframes pulse-correct {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(4, 120, 87, 0.4); }
    50% { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(4, 120, 87, 0); }
}
.pulse-correct { animation: pulse-correct 0.5s ease-out; }

@keyframes shake-incorrect {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
.shake-incorrect { animation: shake-incorrect 0.3s ease-in-out; }