:root {
    --primary-green: #49b848;
    --light-green: #e8f5e8;
    --dark-green: #2d5a2d;
    --gray-light: #f8f9fa;
    --gradient-green: linear-gradient(135deg, #49b848, #2563eb);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Simple responsive fix for screens smaller than 14 inches */
@media screen and (max-width: 1366px) {
    /* Prevent dropdowns from going off-screen */
    .dropdown-menu > div,
    .side-menu > div,
    .nested-menu > div {
        max-width: calc(100vw - 60px) !important;
    }
    
    /* Ensure nested menus can be repositioned by JavaScript */
    .nested-menu {
        position: absolute !important;
    }
}

.dropdown-item-with-nested:hover .nested-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    display: block;
}

.nested-menu.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
    display: block !important;
}

/* Utility Classes */
.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1rem;
    line-height: 1.2;
}

@media (max-width: 1023px) {
    .section-title {
        font-size: 2rem;
    }
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Navigation Styles */
.nav-link {
    color: #374151;
    padding: 0.75rem 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 0.5rem;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: #4b5563; /* Gray instead of green */
    background-color: #f9fafb; /* Light gray background */
}

.nav-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 16rem;
    background: white;
    border-radius: 0;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
    padding: 0;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    display: none;
}

/* Show dropdown on hover */
.nav-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block;
}

/* JavaScript controlled states */
.dropdown-menu.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
    display: block !important;
}

.dropdown-menu.hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-10px) !important;
    display: none !important;
}

/* Side menu styles */
.side-menu {
    position: absolute;
    right: 100%;
    top: -1px; /* Align with parent dropdown */
    min-width: 12rem;
    background: white;
    border-radius: 0;
    /* box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); */
    border: 1px solid #e5e7eb;
    padding: 0;
    margin-right: 0.25rem;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.3s ease;
    display: none;
}

/* Responsive width adjustments for screens smaller than 14 inches ONLY */
@media (max-width: 1366px) {
    /* Make all menus flexible width instead of fixed */
    .dropdown-menu {
        min-width: 0;
        max-width: none;
        width: auto;
    }
    
    .dropdown-menu > div {
        min-width: 18rem;
        max-width: calc(100vw - 4rem);
        width: auto;
        white-space: normal;
        word-wrap: break-word;
    }
    
    /* Side menu - flexible and same as nested menu */
    .side-menu {
        min-width: 0;
        max-width: none;
        width: auto;
        right: auto;
        left: 100%;
        margin-right: 0;
        margin-left: 0.25rem;
        transform: translateX(10px);
    }
    
    .side-menu > div {
        min-width: 14rem;
        max-width: calc(100vw - 6rem);
        width: auto;
        white-space: normal;
        word-wrap: break-word;
    }
    
    /* Nested menu - same width as side menu */
    .nested-menu > div {
        min-width: 14rem;
        max-width: calc(100vw - 6rem);
        width: auto;
        white-space: normal;
        word-wrap: break-word;
    }
    
    .dropdown-item-with-side:hover .side-menu {
        transform: translateX(0);
    }
    
    .side-menu.show {
        transform: translateX(0) !important;
    }
}

.dropdown-item-with-side:hover .side-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    display: block;
}

.side-menu.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
    display: block !important;
}

/* Nested menu styles - content-responsive width */
.nested-menu {
    position: absolute;
    top: -1px; /* Align with parent side menu */
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
    padding: 0;
    margin-top: 0;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: none;
    
    /* Override Tailwind's right-full to prevent overlay */
    right: auto !important;
    left: 100% !important;
    margin-left: 0.25rem;
    margin-right: 0;
    transform: translateX(-10px);
}

/* Make the inner container responsive for all screen sizes */
.nested-menu > div {
    width: auto;
    min-width: 12rem;
    max-width: calc(100vw - 300px);
    white-space: normal;
    word-wrap: break-word;
    overflow: visible;
}

/* For medium screens - nested menu same as side menu */
@media screen and (max-width: 1366px) {
    .nested-menu > div {
        min-width: 14rem !important; /* Same as side menu */
        max-width: 16rem !important; /* Same as side menu */
    }
}

/* For smaller screens - maintain proportions */
@media screen and (max-width: 1024px) {
    /* Dropdown menu - still largest */
    .dropdown-menu {
        min-width: 16rem;
        max-width: 18rem;
    }
    
    /* Side menu - medium size */
    .side-menu {
        min-width: 12rem;
        max-width: 14rem;
    }
    
    /* Nested menu - same as side menu */
    .nested-menu > div {
        min-width: 12rem !important;
        max-width: 14rem !important;
        font-size: 0.9rem;
    }
    
    .nested-menu a {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

/* For very small screens - compact but proportional */
@media screen and (max-width: 768px) {
    /* Dropdown menu - largest but compact */
    .dropdown-menu {
        min-width: 14rem;
        max-width: 16rem;
    }
    
    /* Side menu - medium compact */
    .side-menu {
        min-width: 10rem;
        max-width: 12rem;
    }
    
    /* Nested menu - same as side menu */
    .nested-menu > div {
        min-width: 10rem !important;
        max-width: 12rem !important;
        font-size: 0.85rem;
    }
    
    .nested-menu a {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        height: 2.5rem !important;
    }
}

/* For screens smaller than 14 inches - adjust width, not position */
@media screen and (max-width: 1366px) {
    .nested-menu {
        /* Keep to the right but make narrower to fit */
        min-width: 10rem;
        max-width: calc(100vw - 100% - 4rem); /* Available space to the right with buffer */
        
        /* If calculated max-width is too small, use a minimum viable width */
        max-width: max(10rem, calc(100vw - 100% - 4rem));
    }
}

/* For very small screens - even more compact */
@media screen and (max-width: 1024px) {
    .nested-menu {
        min-width: 8rem;
        max-width: max(8rem, calc(100vw - 100% - 2rem));
        font-size: 0.875rem; /* Slightly smaller text */
    }
}

/* For mobile-sized screens */
@media screen and (max-width: 768px) {
    .nested-menu {
        /* On mobile, position relative to viewport edge instead */
        position: fixed;
        left: 1rem;
        right: 1rem;
        max-width: none;
        width: auto;
        margin: 0;
        transform: translateY(-10px);
    }
    
    .dropdown-item-with-nested:hover .nested-menu {
        transform: translateY(0);
    }
}

.dropdown-item-with-nested:hover .nested-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0) !important;
    display: block;
}

.nested-menu.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
    display: block !important;
}

/* Force right positioning class for JavaScript override */
.nested-menu.force-right {
    right: auto !important;
    left: 100% !important;
    margin-left: 0.25rem !important;
    margin-right: 0 !important;
    transform: translateX(-10px) !important;
}

.nested-menu.force-right.show {
    transform: translateX(0) !important;
}

.nested-menu.show {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateX(0) !important;
    display: block !important;
}

/* Remove borders from nested menu items to prevent internal lines */
.nested-menu a {
    border: none !important;
    border-left: 2px solid transparent !important;
    background: white !important;
}

.nested-menu a:hover {
    border-left: 2px solid #10b981 !important;
    background: #f0fdf4 !important;
}

/* Remove alternating background colors from nested menu groups */
.nested-menu .bg-gray-50 {
    background: white !important;
    border: none !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    border-bottom: none !important;
}

.nested-menu .bg-gray-50 a {
    background: white !important;
}

.nested-menu .bg-gray-50 a:hover {
    background: #f0fdf4 !important;
}

/* Target specific Tailwind classes that are causing border issues */
.nested-menu .border-gray-200 {
    border-top: none !important;
    border-bottom: none !important;
}

.nested-menu .border-l-4 {
    border-left: none !important;
}

.nested-menu .border-green-200 {
    border: none !important;
}

/* Remove all borders from nested menu container and items */
.nested-menu > div > *:first-child {
    border-top: none !important;
}

.nested-menu > div > *:last-child {
    border-bottom: none !important;
}

/* Add consistent spacing between nested menu groups */
.nested-menu > div > div.bg-gray-50 {
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
}

.nested-menu > div > a {
    margin-bottom: 0.25rem !important;
}

/* Ensure nested menu container has clean styling */
.nested-menu > div {
    background: white !important;
    border: 1px solid #e5e7eb !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    padding: 0.5rem 0 !important;
}

/* Override Tailwind border classes specifically */
.nested-menu .border {
    border: none !important;
}

.nested-menu .border-gray-200 {
    border: none !important;
}

/* Ensure navbar has high z-index */
nav {
    z-index: 1000;
    position: relative;
}

/* Remove borders and use gray colors for dropdowns */
.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    position: relative;
}

.dropdown-item:hover {
    background-color: #f3f4f6; /* Light gray instead of green */
    color: #1f2937; /* Darker gray instead of green */
}

/* Remove green borders and use subtle gray effects */
.dropdown-item:hover {
    border-left: none; /* Remove border */
    background-color: #f3f4f6;
}


/* Button Styles */
.btn-primary {
    background: var(--gradient-green);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px 0 rgba(73, 184, 72, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px 0 rgba(73, 184, 72, 0.4);
}

.btn-secondary {
    background: #f8fafc;
    color: #374151;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 2px solid #e2e8f0;
    cursor: pointer;
}

.btn-secondary:hover {
    background: white;
    border-color: var(--primary-green);
    color: var(--primary-green);
    transform: translateY(-1px);
}

.btn-secondary-outline {
    background: transparent;
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 2px solid white;
    cursor: pointer;
}

.btn-secondary-outline:hover {
    background: white;
    color: var(--primary-green);
}


/* Feature Cards */
.feature-card {
    padding: 1.5rem;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #f1f5f9;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.feature-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

/* Program Cards */
.program-card {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 1px solid #f1f5f9;
    height: 100%;
}

.program-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.program-icon {
    width: 4rem;
    height: 4rem;
    background: var(--primary-green);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.program-card:hover .program-icon {
    transform: scale(1.1);
}

/* News Cards */
.news-card-large {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.news-card-large:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.news-card-small {
    background: white;
    padding: 1rem;
    border-radius: 1rem;
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.news-card-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.badge-featured {
    background: #ef4444;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

  
/* Hover Effects */
.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.02);
}

.play-button {
    transition: all 0.3s ease;
}

.play-button:hover {
    transform: scale(1.1);
}

/* Social Links */
.social-link {
    transition: all 0.3s ease;
}

.social-link:hover {
    transform: translateY(-2px);
}

/* Footer Links */
.footer-link {
    color: #d1d5db;
    text-decoration: none;
    transition: all 0.3s ease;
}

.footer-link:hover {
    color: var(--primary-green);
}

/* Back to Top Button */
#back-to-top {
    transition: all 0.3s ease;
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

/* Counter Animation */
.counter {
    font-variant-numeric: tabular-nums;
}

/* Loading States */
.loading-text {
    display: none;
}

.loading .submit-text {
    display: none;
}

.loading .loading-text {
    display: inline-flex;
    align-items: center;
}

/* Responsive Design */
@media (max-width: 1023px) {
    .mobile-menu {
        transition: all 0.3s ease;
    }

    .mobile-menu.show {
        display: block;
    }

    .btn-primary,
    .btn-secondary {
        padding: 0.875rem 1.5rem;
        font-size: 0.875rem;
    }

    .program-card {
        padding: 1.5rem;
    }

    .feature-card {
        padding: 1rem;
    }

    .dropdown-menu,
    .side-menu,
    .nested-menu {
        position: static;
        transform: none;
        box-shadow: none;
        border-radius: 0.5rem;
        margin: 0.5rem 0;
        padding: 0.5rem;
        background-color: #f8fafc;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.counter-animate {
    animation: countUp 0.6s ease-out;
}


/* Search functionality styles */
#search-container {
    transition: width 0.5s ease-in-out;
    max-width: calc(100vw - 120px); /* Ensure it never exceeds viewport minus some padding */
}

/* Search results container responsive styling */
#search-results-container {
    transition: width 0.3s ease;
}

/* Responsive search container */
@media (max-width: 480px) {
    #search-container {
        max-width: calc(100vw - 80px); /* Tighter constraint on small mobile */
    }
    
    #search-results-container {
        width: calc(100vw - 40px) !important; /* Almost full width on small mobile */
        right: -15px !important; /* Adjust position slightly */
        left: auto !important;
    }
}

@media (max-width: 768px) {
    #search-results-container {
        width: calc(100vw - 60px) !important; /* Almost full width on mobile */
        right: -30px !important;
    }
}

@media (max-width: 1023px) {
    #search-container {
        max-width: calc(100vw - 100px); /* Medium mobile constraint */
    }
}

#toggle-search {
    transition: opacity 0.3s ease;
}

#search-input-container {
    transition: opacity 0.3s ease;
}

#desktop-menu {
    transition: opacity 0.3s ease;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.4;
    }

    .section-title {
        font-size: 18pt;
    }
}

/* Touch-friendly dropdown improvements */
@media (hover: none) and (pointer: coarse) {
    /* Styles for touch devices */
    .dropdown-item-with-side > a,
    .dropdown-item-with-nested > a {
        position: relative;
        padding-right: 2.5rem !important; /* Extra space for touch target */
    }
    
    /* .dropdown-item-with-side > a::after,
    .dropdown-item-with-nested > a::after {
        content: '';
        position: absolute;
        right: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        width: 1rem;
        height: 1rem;
        background: rgba(34, 197, 94, 0.1);
        border-radius: 50%;
        border: 1px solid rgba(34, 197, 94, 0.3);
    } */
    
    .dropdown-item-with-side > a:active,
    .dropdown-item-with-nested > a:active {
        background-color: rgba(34, 197, 94, 0.1) !important;
        transform: scale(0.98);
        transition: all 0.1s ease;
    }
    
    /* Make side and nested menus more touch-friendly */
    .side-menu,
    .nested-menu {
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1) !important;
    }
}

nav button:focus,
nav button:focus-visible,
nav a:focus,
nav a:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    border-color: transparent !important;

    /* Xóa ring của Tailwind */
    --tw-ring-shadow: 0 0 #0000 !important;
    --tw-ring-color: transparent !important;
}

nav button[class*="focus:"],
nav a[class*="focus:"] {
    outline: none !important;
    box-shadow: none !important;
    --tw-ring-shadow: 0 0 #0000 !important;
}

/* Table Container - Simple & Clean */
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: white;
    border: 1px solid #e5e7eb;
    font-size: 0.95rem;
}

/* Hide duplicate header rows - keep only the FIRST header */
.prose thead tr:nth-child(n+2) {
    display: none !important;
}
/* If duplicate header appears in tbody, hide it */
.prose tbody tr:first-child th {
    display: none !important;
}

.prose tbody tr:has(th) {
    display: none !important;
}

.prose th,
.prose td {
    padding: 1rem 1.25rem;
    text-align: left;
    vertical-align: top;
    border: 1px solid #e5e7eb;
    word-wrap: break-word;
    line-height: 1.6;
    background: white !important;
    color: #374151 !important;
    font-weight: 400 !important;
}

.prose tr:hover td,
.prose tr:hover th {
    background: #f0fdf4 !important;
}

@media (max-width: 768px) {
    .prose table {
        font-size: 0.875rem;
    }
    
    .prose th,
    .prose td {
        padding: 0.75rem 1rem;
    }
    
    .prose th {
        font-size: 0.75rem;
    }
}

.prose-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.prose-wrapper::-webkit-scrollbar {
    height: 8px;
}

.prose-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.prose-wrapper::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.prose-wrapper::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.prose td.highlight,
.prose th.highlight {
    background-color: #fef3c7;
    font-weight: 600;
}

.prose td.success {
    color: #15803d;
    font-weight: 600;
}

.prose td.danger {
    color: #dc2626;
    font-weight: 600;
}

.prose caption {
    padding: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    text-align: left;
    caption-side: top;
}