/*
Theme Name: Khoa Tin Hoc Theme
Theme URI: https://example.com/
Author: Your Name
Author URI: https://example.com/
Description: Theme dành cho website Khoa Tin Học, dựa trên thiết kế cung cấp.
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: khoatinhoctheme
*/

/* ==========================================================================
   1. CSS Variables (Biến màu và font chữ để dễ dàng tùy chỉnh)
   ========================================================================== */
   :root {
    --color-primary: #1a3a6e;
    --color-primary-dark: #122a4e;
    --color-primary-light: #f0f9ff;
    --color-secondary: #e0f2fe;
    --color-footer-bg: #0d2447;
    --color-text-dark: #1f2937; /* Tương đương text-gray-800 */
    --color-text-medium: #4b5563; /* Tương đương text-gray-600 */
    --color-text-light: #d1d5db; /* Tương đương text-gray-300 */
    --color-white: #ffffff;
    --color-black: #000000;
    --font-primary: 'Inter', sans-serif;
}


/* ==========================================================================
   2. Global Resets & Body Styles (Thiết lập chung)
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: #f3f4f6; /* Tương đương bg-gray-100 */
    color: var(--color-text-medium);
    line-height: 1.6;
    margin: 0;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--color-primary-dark);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}


/* ==========================================================================
   3. Layout & Helper Classes (Bố cục & Lớp hỗ trợ)
   ========================================================================== */
.container {
    width: 100%;
    max-width: 1280px; /* Tương đương container của Tailwind */
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

.section-title {
    font-size: 2.25rem; /* 36px */
    font-weight: 700;
    margin-bottom: 1.5rem; /* 24px */
    text-align: center;
    color: var(--color-primary);
}

/* ==========================================================================
   4. Header & Navigation (Phần đầu trang & Menu) - THEO PHONG CÁCH 1
   ========================================================================== */
   .site-header {
    background-color: var(--color-white); /* Giữ nguyên nền trắng */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 50;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 5rem; /* 80px */
}

.site-branding a {
    display: flex;
    align-items: center;
}

.site-branding img {
    height: 3rem; /* 48px */
    width: auto;
}

.site-branding .site-title {
    margin-left: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary); /* Giữ nguyên màu xanh đậm cho chữ logo */
}

.main-navigation ul {
    display: none; /* Ẩn trên mobile */
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.25rem; 
}

.main-navigation ul li {
    position: relative;
}

.main-navigation ul a {
    color: var(--color-text-dark);
    padding: 0.75rem 1rem; /* Có thể tăng padding để cân đối với font-size lớn hơn */
    border-radius: 0.375rem;
    font-size: 1rem; /* Giữ nguyên cỡ chữ bạn đã tăng */
    font-weight: 500;
    display: flex;
    align-items: center;
    transition: all 0.2s ease-in-out; /* THÊM MỚI: Hiệu ứng chuyển động mượt mà */
}

/* THAY ĐỔI: Hiệu ứng hover cho menu */
.main-navigation ul a:hover {
    background-color: var(--color-primary-light); /* Thêm nền màu xanh rất nhạt */
    color: var(--color-primary-dark); /* Chữ đậm hơn khi hover */
}

/* THÊM MỚI: Style cho mục menu đang active */
.main-navigation .current-menu-item > a,
.main-navigation .current-page-ancestor > a {
    background-color: var(--color-primary-light); /* Nền xanh nhạt giống hover */
    color: var(--color-primary); /* Màu chữ là màu xanh đậm chính */
    font-weight: 600; /* Chữ đậm hơn để nổi bật */
}


/* Dropdown Menu - Giữ nguyên không thay đổi */
.main-navigation .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--color-white);
    box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
    z-index: 10;
    min-width: 200px;
    border-radius: 0.375rem; 
    padding: 0.5rem 0;
}

.main-navigation li:hover > .sub-menu {
    display: block;
}

.main-navigation .sub-menu a {
    padding: 0.75rem 1rem;
    color: var(--color-black);
}

.main-navigation .sub-menu a:hover {
    background-color: #f1f1f1;
    color: var(--color-primary);
}

/* Mobile Menu Button */
#mobile-menu-button {
    display: block; 
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-dark); /* Đảm bảo icon có màu tối trên nền trắng */
}

/* ==========================================================================
   5. Component Styles (Các thành phần dùng chung)
   ========================================================================== */

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: background-color 0.3s ease, color 0.3s ease;
    cursor: pointer;
    border: 1px solid transparent;
    text-align: center;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    color: var(--color-white);
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-secondary:hover {
    background-color: #cce7ff;
    color: var(--color-primary-dark);
}

/* Cards */
.card {
    background-color: var(--color-white);
    border-radius: 0.75rem; /* 12px */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden; /* Để bo góc hình ảnh */
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card img,
.card .post-thumbnail img {
    height: 200px;
    object-fit: cover;
    width: 100%;
}

.card-content {
    padding: 1.5rem; /* p-6 */
    flex-grow: 1; /* Giúp footer của card luôn ở dưới */
    display: flex;
    flex-direction: column;
}
.card-content h3 {
    font-size: 1.25rem; /* text-xl */
    font-weight: 600; /* font-semibold */
    color: var(--color-text-dark);
    margin-top: 0;
    margin-bottom: 0.5rem;
}
.card-content .card-excerpt {
    color: var(--color-text-medium);
    margin-bottom: 1rem;
    font-size: 0.875rem; /* text-sm */
    flex-grow: 1;
}
.card-content .card-link {
    color: var(--color-primary);
    font-weight: 500;
}
.card-content .card-link:hover {
    text-decoration: underline;
}


/* ==========================================================================
   6. Homepage Section Styles (Các khu vực trang chủ)
   ========================================================================== */

/* General Section Padding */
.homepage-section {
    padding-top: 4rem; /* py-16 */
    padding-bottom: 4rem;
}

/* Hero Section */
.hero-section {
    color: var(--color-white);
    text-align: center;
    /* Dòng background đã được xóa, các style chung khác vẫn giữ nguyên */
    background-color: var(--color-primary); /* Có thể thêm màu nền dự phòng */
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}
.hero-section h1 {
    font-size: 2.5rem; /* text-4xl */
    font-weight: 700;
    margin-bottom: 1.5rem;
}
.hero-section p {
    font-size: 1.125rem; /* text-lg */
    margin-bottom: 2rem;
    max-width: 56rem; /* max-w-3xl */
    margin-left: auto;
    margin-right: auto;
}

/* Key Features Section */
.key-features-grid {
    display: grid;
    gap: 2rem; /* gap-8 */
    text-align: center;
}
.key-features-grid .feature-item .icon {
    font-size: 3rem; /* text-5xl */
    color: var(--color-primary);
    margin-bottom: 1rem;
}
.key-features-grid .feature-item h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text-dark);
    margin-bottom: 0.5rem;
}

/* Grid for Programs, News, Jobs */
.card-grid {
    display: grid;
    gap: 2rem; /* gap-8 */
}

/* Job Tags */
.job-tags span {
    display: inline-block;
    font-size: 0.75rem; /* text-xs */
    font-weight: 600;
    margin-right: 0.5rem;
    padding: 0.125rem 0.625rem;
    border-radius: 0.25rem;
}
.job-tags .type-full-time { background-color: #d1fae5; color: #065f46; }
.job-tags .type-internship { background-color: #fef3c7; color: #92400e; }
.job-tags .location { background-color: #dbeafe; color: #1e40af; }


/* Scientific Research Section */
.research-grid {
    display: grid;
    gap: 2rem;
    align-items: center;
}
.research-grid ul {
    list-style: disc;
    padding-left: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.research-grid img {
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Announcements & Quick Links */
.announcements-and-links-section {
    background-color: #f0f8ff; /* Gần giống bg-sky-50 */
}
.announcements-and-links-grid {
    display: grid;
    gap: 3rem;
}
.announcements-list .announcement-item {
    background-color: var(--color-white);
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
    margin-bottom: 1rem;
}
.announcements-list .announcement-item:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
}
.announcements-list .tag {
    font-size: 0.75rem;
    font-weight: 600;
}
.announcements-list .tag.urgent { color: #dc2626; }
.announcements-list .tag.event { color: #2563eb; }

/* Xóa quy tắc .quick-links-list a cũ và thay bằng các quy tắc sau */

.quick-links-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Tạo khoảng cách giữa các mục */
}

.quick-links-list li a {
    display: block;
    padding: 1rem;
    background-color: var(--color-primary-light);
    border-radius: 0.375rem;
    border-left: 4px solid var(--color-primary);
    color: var(--color-text-dark);
    transition: background-color 0.3s ease;
    font-weight: 500;
}

.quick-links-list li a:hover {
    background-color: #e0f2fe;
}
/* ==========================================================================
   9. Single & Page Styles (Trang con & Bài viết chi tiết)
   ========================================================================== */

/* Khu vực tiêu đề trang */
.page-title-section {
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: 2rem 0;
}
.page-title-heading {
    font-size: 2.25rem;
    font-weight: 700;
}

/* Breadcrumb */
.breadcrumb {
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
}
.breadcrumb a {
    color: #e0f2fe; /* Màu xanh nhạt hơn cho link */
}
.breadcrumb a:hover {
    text-decoration: underline;
}

/* Khu vực nền chính cho nội dung */
.main-content-area {
    background-color: #f9fafb; /* Màu nền xám rất nhạt */
    padding: 3rem 0;
}

/* Style cho thẻ <article> có class .content-card */
.content-card {
    background-color: var(--color-white);
    border-radius: 0.75rem; /* Bo góc 12px */
    padding: 2rem; /* Khoảng đệm bên trong 32px */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); /* Bóng đổ */
}

/* Style cho nội dung bên trong .content-card (bài viết/trang) */
.content-card h2, 
.content-card h3 {
    color: var(--color-primary);
    margin-bottom: 1rem;
    font-weight: 600;
}
.content-card h2 {
    font-size: 1.875rem;
    border-bottom: 2px solid var(--color-secondary);
    padding-bottom: 0.5rem;
}
.content-card h3 {
    font-size: 1.5rem;
}
.content-card p, 
.content-card ul li,
.content-card ol li {
    line-height: 1.75;
    margin-bottom: 1rem;
    color: var(--color-text-medium);
}
.content-card ul {
    list-style-type: disc;
    padding-left: 1.5rem;
}
.content-card ol {
    list-style-type: decimal;
    padding-left: 1.5rem;
}

/* Style cho bảng biểu */
.content-card table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}
.content-card th, 
.content-card td {
    border: 1px solid #e5e7eb;
    padding: 0.75rem;
    text-align: left;
}
.content-card th {
    background-color: #f3f4f6;
    font-weight: 600;
    color: var(--color-primary);
}


/* Bố cục 2 cột và Sidebar */
.single-page-layout {
    display: flex;
    flex-wrap: wrap;
}
.main-content-column {
    width: 100%;
}
.sidebar-column {
    width: 100%;
    margin-top: 2rem;
}

/* Sidebar và Widgets */
.sidebar .widget {
    background-color: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.sidebar .widget h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-top: 0;
    margin-bottom: 1rem;
}
.sidebar .widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar .widget ul li {
    padding: 0.25rem 0;
}
.sidebar .widget ul li a {
    color: var(--color-text-dark);
}
.sidebar .widget ul li a:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* Responsive cho bố cục 2 cột */
@media (min-width: 1024px) { /* lg: */
    .main-content-column {
        width: 75%;
        padding-right: 1.5rem;
    }
    .sidebar-column {
        width: 25%;
        padding-left: 1.5rem;
        margin-top: 0;
    }
}


/* ==========================================================================
   7. Footer Styles (Phần chân trang)
   ========================================================================== */
.site-footer {
    background-color: var(--color-footer-bg);
    color: var(--color-text-light);
    padding-top: 3rem;
    padding-bottom: 3rem;
}
.footer-grid {
    display: grid;
    gap: 2rem;
    margin-bottom: 2rem;
}
.site-footer h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-white);
    margin-bottom: 1rem;
}
.site-footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.site-footer .footer-contact p {
    font-size: 0.875rem;
    margin: 0.25rem 0;
}
.footer-socials {
    display: flex;
    gap: 1rem;
}
.footer-bottom {
    border-top: 1px solid #4b5563; /* Tương đương border-gray-700 */
    padding-top: 2rem;
    text-align: center;
    font-size: 0.875rem;
}

.site-footer a {
    color: var(--color-text-light); /* Màu chữ liên kết mặc định trong footer (#d1d5db) */
    transition: color 0.3s ease, text-decoration 0.3s ease;
}

.site-footer a:hover {
    color: var(--color-white); /* Chuyển thành màu trắng tinh khi di chuột */
    text-decoration: underline; /* Thêm gạch chân khi di chuột */
}

/* ==========================================================================
   11. Archive & Category Page Styles
   ========================================================================== */

   .archive-post-item {
    display: flex;
    flex-wrap: wrap;
    background-color: var(--color-white);
    margin-bottom: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    overflow: hidden; /* Đảm bảo ảnh bo góc theo thẻ article */
}

.archive-post-item .post-thumbnail-archive {
    width: 100%;
}

.archive-post-item .post-thumbnail-archive img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.archive-post-item .post-content-archive {
    padding: 1.5rem;
    width: 100%;
}

.archive-post-item .entry-title {
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.archive-post-item .entry-title a {
    color: var(--color-text-dark);
    text-decoration: none;
}

.archive-post-item .entry-title a:hover {
    color: var(--color-primary);
}

.archive-post-item .entry-meta {
    font-size: 0.875rem;
    color: var(--color-text-medium);
    margin-bottom: 1rem;
}

.archive-post-item .entry-summary {
    margin-bottom: 1.5rem;
}

.archive-post-item .btn-read-more {
    font-weight: 600;
    color: var(--color-primary);
}
.archive-post-item .btn-read-more:hover {
    text-decoration: underline;
}

/* Responsive cho danh sách bài viết */
@media (min-width: 768px) { /* md: */
    .archive-post-item {
        flex-wrap: nowrap;
    }
    .archive-post-item .post-thumbnail-archive {
        width: 40%; /* Ảnh chiếm 40% chiều rộng */
        flex-shrink: 0;
    }
    .archive-post-item .post-thumbnail-archive img {
        height: 100%;
    }
    .archive-post-item .post-content-archive {
        width: 60%;
    }
}

/* --- Xử lý cho bài viết KHÔNG có ảnh đại diện (Cách 2) --- */

/* 1. Nếu không có class .has-post-thumbnail, ẩn khối chứa ảnh */
.archive-post-item:not(.has-post-thumbnail) .post-thumbnail-archive {
    display: none;
}

/* 2. Ép phần nội dung chiếm 100% chiều ngang */
.archive-post-item:not(.has-post-thumbnail) .post-content-archive {
    width: 100% !important;
    flex: 0 0 100%;
}

/* 3. Đảm bảo trên màn hình lớn (PC) chữ cũng tràn hết 100% */
@media (min-width: 768px) {
    .archive-post-item:not(.has-post-thumbnail) .post-content-archive {
        width: 100% !important;
    }
}


/* ==========================================================================
   8. Responsive Design (Thiết kế đáp ứng) - ĐÃ ĐƯỢC SẮP XẾP LẠI
   ========================================================================== */

/* Cho màn hình từ Tablet trở lên (>= 768px) */
@media (min-width: 768px) { /* md: */
    
    /* Hiển thị menu chính và ẩn nút mobile */
    .main-navigation ul {
        display: flex;
    }
    #mobile-menu-button {
        display: none;
    }

    /* Bố cục cho các section */
    .hero-section h1 {
        font-size: 3.75rem; /* md:text-6xl */
    }
    .hero-section p {
        font-size: 1.25rem; /* md:text-xl */
    }
    .key-features-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .research-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Bố cục cho danh sách bài viết lưu trữ */
    .archive-post-item {
        flex-wrap: nowrap;
    }
    .archive-post-item .post-thumbnail-archive {
        width: 40%;
        flex-shrink: 0;
    }
    .archive-post-item .post-thumbnail-archive img {
        height: 100%;
    }
    .archive-post-item .post-content-archive {
        width: 60%;
    }
}

/* Cho màn hình từ Desktop trở lên (>= 1024px) */
@media (min-width: 1024px) { /* lg: */

    /* Bố cục cho các section */
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .announcements-and-links-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .announcements-list {
        grid-column: span 2 / span 2;
    }
    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    /* Bố cục cho trang single/page */
    .main-content-column {
        width: 75%;
        padding-right: 1.5rem;
    }
    .sidebar-column {
        width: 25%;
        padding-left: 1.5rem;
        margin-top: 0;
    }
}

/* ==========================================================================
   13. Mobile Menu Styles
   ========================================================================== */

/* Khi menu được bật (có class .toggled), hiển thị danh sách ul */
.main-navigation.toggled ul.desktop-menu {
    display: block; /* Hiển thị menu */
    position: absolute;
    top: 100%; /* Vị trí ngay dưới header */
    left: 0;
    background-color: var(--color-white);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    padding: 0;
    margin: 0;
    border-top: 1px solid #f3f4f6; /* Thêm đường kẻ mỏng phân cách với header */
}

/* Style cho từng mục li trong menu mobile */
.main-navigation.toggled li {
    width: 100%;
    text-align: left;
    margin: 0;
}

/* Style cho từng link a trong menu mobile */
.main-navigation.toggled a {
    display: block;
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
}

/* --- Style cho menu con (sub-menu) trên mobile --- */

.main-navigation.toggled .sub-menu {
    display: block; /* Luôn hiển thị sub-menu khi menu chính được bật */
    position: static; /* Bỏ position absolute của sub-menu trên desktop */
    box-shadow: none; /* Bỏ bóng đổ riêng */
    min-width: unset; /* Bỏ chiều rộng tối thiểu */
    padding-left: 1rem; /* Tạo thụt đầu dòng cho toàn bộ menu con */
    background-color: #f9fafb; /* Nền màu xám rất nhẹ để phân biệt */
    border-top: 1px solid #f3f4f6;
    margin: 0;
}

.main-navigation.toggled .sub-menu li {
    border: none; /* Bỏ border nếu có kế thừa từ li cha */
}

.main-navigation.toggled .sub-menu a {
    font-size: 0.9rem; /* Làm chữ nhỏ hơn một chút so với menu cha */
    padding-left: 2rem; /* Thêm padding để thẳng hàng đẹp hơn */
    color: var(--color-text-medium);
}

.main-navigation.toggled .sub-menu a:hover {
    color: var(--color-primary); /* Giữ lại hiệu ứng hover */
}

/* Bỏ đường gạch chân ở mục con cuối cùng của mỗi sub-menu */
.main-navigation.toggled .sub-menu li:last-child a {
     border-bottom: none;
}