/*
Theme Name: TrungTu
Theme URI: https://trungtu.net
Author: TrungTu Team
Author URI: https://trungtu.net
Description: Theme tối giản, tích hợp Quiz và AutoGen, sử dụng TailwindCSS. Màu chủ đạo: Đỏ.
Version: 1.0.1
License: GNU General Public License v2 or later
Text Domain: trungtu-theme
*/

.content-fade {
    mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 50%, transparent 100%);
}

/* Update màu check radio sang đỏ */
.quiz-option:checked+label {
    border-color: #dc2626;
    /* red-600 */
    background-color: #fef2f2;
    /* red-50 */
    color: #991b1b;
    /* red-800 */
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* =========================================
   MENU & SUBMENU STYLES
   ========================================= */

/* Parent Menu Item */
.menu-item {
    position: relative;
    display: flex;
    align-items: center;
}

/* Top Level Menu Links */
.menu-1-container>.menu-item>a,
nav .menu-item>a {
    display: block;
    padding: 0.5rem 1rem;
    color: #4b5563;
    /* gray-600 */
    border-radius: 0.5rem;
    transition: all 0.2s;
}

/* Top Level Hover */
nav .menu-item>a:hover {
    color: #dc2626;
    /* red-600 */
    background-color: #fef2f2;
    /* red-50 */
}

/* Dark Mode Top Level */
.dark nav .menu-item>a {
    color: #d1d5db;
    /* gray-300 */
}

.dark nav .menu-item>a:hover {
    color: #f87171;
    /* red-400 */
    background-color: #1e293b;
    /* slate-800 */
}

/* Submenu container */
.sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background-color: #ffffff;
    border: 1px solid #f3f4f6;
    /* gray-100 */
    border-radius: 0.75rem;
    /* rounded-xl */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    /* shadow-xl */
    padding: 0.5rem;
    z-index: 50;
    flex-direction: column;
    margin-top: 0.5rem;
    /* Giữ khoảng cách đẹp */
}

/* Pseudo-element to bridge the gap between parent and submenu */
.sub-menu::before {
    content: "";
    display: block;
    position: absolute;
    top: -0.5rem;
    /* Chiều cao của margin-top */
    left: 0;
    width: 100%;
    height: 0.5rem;
    background: transparent;
}

/* Dark Mode Submenu */
.dark .sub-menu {
    background-color: #1e293b;
    /* slate-800 */
    border-color: #334155;
    /* slate-700 */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

/* Show Submenu on Hover */
.menu-item:hover>.sub-menu {
    display: flex;
    animation: slideUpFade 0.2s ease-out forwards;
}

/* Submenu Items */
.sub-menu .menu-item {
    width: 100%;
    padding: 0;
    margin: 0;
    display: block;
}

/* Submenu Links */
.sub-menu .menu-item>a {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    font-size: 0.95rem;
    color: #4b5563;
    /* gray-600 */
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.sub-menu .menu-item>a:hover {
    background-color: #fef2f2;
    /* red-50 */
    color: #dc2626;
    /* red-600 */
    transform: translateX(4px);
}

/* Dark Mode Submenu Links */
.dark .sub-menu .menu-item>a {
    color: #cbd5e1;
    /* slate-300 */
}

.dark .sub-menu .menu-item>a:hover {
    background-color: #334155;
    /* slate-700 */
    color: #f87171;
    /* red-400 */
}

/* Arrow indicator for items with children (optional) */
.menu-item-has-children>a::after {
    content: '\f107';
    /* FontAwesome angle-down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: 0.4rem;
    font-size: 0.8rem;
    opacity: 0.5;
    transition: transform 0.2s;
}

.menu-item-has-children:hover>a::after {
    transform: rotate(180deg);
    opacity: 1;
}

/* Nested Submenu (Level 3+) */
.sub-menu .sub-menu {
    top: -0.5rem;
    left: 100%;
    margin-left: 0.5rem;
    margin-top: 0;
}

/* =========================================
   QUIZ STYLES (Advanced)
   ========================================= */
.tt-quiz-correct {
    background-color: #d1fae5 !important;
    /* bg-green-100 */
    border-color: #10b981 !important;
    /* border-green-500 */
    color: #065f46 !important;
    /* text-green-800 */
}

.tt-quiz-incorrect {
    background-color: #fee2e2 !important;
    /* bg-red-100 */
    border-color: #ef4444 !important;
    /* border-red-500 */
    color: #991b1b !important;
    /* text-red-800 */
}

.tt-quiz-result-text {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.tt-quiz-result-text.correct {
    color: #10b981;
}

.tt-quiz-result-text.incorrect {
    color: #ef4444;
}

/* Ẩn hiện giải thích (nếu có sau này) */
.tt-explanation {
    display: none;
    margin-top: 10px;
    padding: 10px;
    background: #f8fafc;
    border-left: 3px solid #3b82f6;
    font-size: 0.9em;
}

.tt-show-explanation .tt-explanation {
    display: block;
}

/* Animation */
@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Menu Adjustments */
/* Mobile menu is handled separately in header.php with distinct structure,
   so these styles strictly apply to the Desktop menu which uses .sub-menu structure from wp_nav_menu */

/* Active State Highlight */
.current-menu-item>a,
.current-menu-ancestor>a {
    color: #dc2626 !important;
    /* red-600 */
    font-weight: 700 !important;
}

/* =========================================
   TYPOGRAPHY (PROSE) STYLES
   ========================================= */
.prose {
    font-size: 1rem;
    line-height: 1.75;
    color: #374151;
    /* gray-700 */
}

.dark .prose {
    color: #d1d5db;
    /* gray-300 */
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
    color: #111827;
    /* gray-900 */
    font-weight: 700;
    margin-top: 1.2em;
    /* Reduced from 2em */
    margin-bottom: 0.8em;
    line-height: 1.3;
}

.dark .prose h1,
.dark .prose h2,
.dark .prose h3,
.dark .prose h4,
.dark .prose h5,
.dark .prose h6 {
    color: #f9fafb;
    /* gray-50 */
}

.prose h1 {
    font-size: 2.25em;
}

.prose h2 {
    font-size: 1.75em;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 0.3em;
}

.dark .prose h2 {
    border-color: #374151;
}

.prose h3 {
    font-size: 1.5em;
}

.prose h4 {
    font-size: 1.25em;
}

.prose p {
    margin-bottom: 1.25em;
    text-align: justify;
}

.prose ul,
.prose ol {
    margin-top: 1.25em;
    margin-bottom: 1.25em;
    padding-left: 1.625em;
}

.prose ul {
    list-style-type: disc;
}

.prose ol {
    list-style-type: decimal;
}

.prose li {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.prose blockquote {
    font-style: italic;
    border-left: 4px solid #dc2626;
    /* red-600 */
    background-color: #fef2f2;
    /* red-50 */
    padding: 1em;
    margin-top: 1.6em;
    margin-bottom: 1.6em;
    border-radius: 0 0.5rem 0.5rem 0;
    color: #4b5563;
}

.dark .prose blockquote {
    background-color: #1f2937;
    /* gray-900 */
    border-left-color: #ef4444;
    /* red-500 */
    color: #9ca3af;
}

.prose img {
    margin-top: 2em;
    margin-bottom: 2em;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    max-width: 100%;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.prose table {
    width: 100%;
    table-layout: auto;
    text-align: left;
    margin-top: 2em;
    margin-bottom: 2em;
    font-size: 0.875em;
    border-collapse: collapse;
}

.prose thead {
    background-color: #f9fafb;
    /* gray-50 */
    border-bottom: 1px solid #e5e7eb;
    /* gray-200 */
}

.dark .prose thead {
    background-color: #1f2937;
    /* gray-800 */
    border-color: #374151;
}

.prose th {
    font-weight: 600;
    padding: 0.75rem;
}

.prose td {
    padding: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
    /* gray-200 */
}

.dark .prose td {
    border-color: #374151;
}

.prose a {
    color: #dc2626;
    /* red-600 */
    text-decoration: underline;
    font-weight: 500;
}

.prose strong {
    font-weight: 700;
    color: #111827;
    /* gray-900 */
}

.dark .prose strong {
    color: #f9fafb;
}