/*
Theme Name: Portal Theme
Description: Giao diện cổng thông tin hành chính / giáo dục
Version: 1.0
Author: BNSOFT
*/

.site-header {
    background-size: cover;
    background-position: center;
    padding: 20px 0;
    position: relative;
}
.header-content {
    display: flex;
    align-items: center;
}
.site-logo img {
    max-width: 120px;
    margin-right: 20px;
}
.site-title {
    font-size: 28px;
    font-weight: bold;
    text-transform: uppercase;
    text-shadow: 1px 1px 2px #fff; /* Làm nổi chữ nếu nền phức tạp */
}

.main-content-wrapper { margin-top: 20px; }

/* Styling cho các Widget và Khối nội dung */
.widget-title, .block-header {
    background-color: var(--primary-color, #0056b3); /* Sử dụng biến màu từ Customizer */
    color: #fff;
    padding: 10px 15px;
    font-size: 16px;
    text-transform: uppercase;
    font-weight: bold;
    border-radius: 4px 4px 0 0;
}

.widget-item, .news-block {
    border: 1px solid #ddd;
    margin-bottom: 20px;
    background: #fff;
    border-radius: 4px;
}

.block-content { padding: 15px; }

/* CSS cho danh sách tin tức */
.news-item {
    display: flex;
    margin-bottom: 10px;
    border-bottom: 1px dotted #ccc;
    padding-bottom: 10px;
}
.news-item img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    margin-right: 10px;
}
.news-item h3 { font-size: 14px; line-height: 1.4; }

/* Khống chế toàn bộ ảnh không bị tràn khung */
img {
    max-width: 100%;
    height: auto;
}

/* Xử lý Header: Ép logo nhỏ lại và xếp ngang với Tên website */
.site-header {
    padding: 20px 0;
    border-bottom: 2px solid #0056b3;
}
.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}
.site-logo img {
    max-width: 120px; /* Khống chế kích thước logo */
    display: block;
}
.site-title-box {
    display: flex;
    flex-direction: column;
}
.site-title {
    margin: 0;
    font-size: 26px;
    font-weight: bold;
    text-transform: uppercase;
}
.site-description {
    margin: 0;
    font-size: 14px;
    color: #555;
}

/* Xử lý Thanh Menu xanh */
.main-navigation {
    background-color: #0056b3; /* Chỉnh lại màu trùng mẫu */
}
.nav-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
}
.nav-menu li a {
    color: #fff;
    padding: 12px 20px;
    text-decoration: none;
    display: block;
    font-weight: bold;
    text-transform: uppercase;
}
.nav-menu li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* --- TOPBAR --- */
.top-bar {
    background-color: #004b8f; /* Màu xanh đậm chuẩn hành chính */
    color: #fff;
    padding: 5px 0;
    font-size: 13px;
}
.top-bar .search-box input {
    border-radius: 0;
    border: none;
}
.top-bar .search-box button {
    border-radius: 0;
}

/* --- BANNER HEADER --- */
.site-header {
    background-color: #eef5f9; /* Màu nền dự phòng nếu không có ảnh */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 15px 0;
    min-height: 140px; /* Độ cao tối thiểu cho banner */
    border-bottom: none;
}
.site-title {
    text-shadow: 1px 1px 0px #fff, -1px -1px 0px #fff, 1px -1px 0px #fff, -1px 1px 0px #fff; /* Viền trắng mờ để chữ nổi bật trên nền ảnh */
}

/* ==========================================================================
   NÂNG CẤP MENU ĐA CẤP (MULTI-LEVEL DROPDOWN)
   ========================================================================== */
.main-navigation {
    background: linear-gradient(to bottom, #0066cc, #004b8f);
    border-bottom: 3px solid #cc0000;
    position: relative;
    z-index: 9999; /* Đảm bảo menu luôn đè lên các thành phần khác */
}

/* Reset cấu trúc danh sách mặc định của WordPress */
.nav-menu, .nav-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* --------------------------------------------------
   GIAO DIỆN DESKTOP (Màn hình lớn)
-------------------------------------------------- */
@media (min-width: 768px) {
    .nav-menu { 
        display: flex; 
        flex-wrap: wrap; 
    }
    .nav-menu > li { 
        position: relative; /* Quan trọng để định vị menu con */
    }
    .nav-menu a {
        display: block;
        padding: 12px 20px;
        color: #fff;
        text-decoration: none;
        font-weight: bold;
        text-transform: uppercase;
        font-size: 14px;
        transition: all 0.3s;
    }
    /* Đổi nền khi trỏ chuột vào menu cha */
    .nav-menu > li:hover > a {
        background-color: rgba(255, 255, 255, 0.15);
    }

    /* --- MENU CON CẤP 1 (Xổ thẳng xuống) --- */
    .nav-menu ul.sub-menu {
        position: absolute;
        top: 100%;
        left: 0;
        background-color: #0056b3; /* Nền xanh cho menu con */
        min-width: 260px;
        visibility: hidden;
        opacity: 0;
        transform: translateY(10px); /* Hiệu ứng trượt nhẹ */
        transition: all 0.3s ease;
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
        border-top: 3px solid #cc0000;
    }
    /* Kích hoạt hiển thị menu con khi Hover */
    .nav-menu li:hover > ul.sub-menu {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
    }

    /* Style cho các thẻ a trong menu con */
    .nav-menu ul.sub-menu li {
        position: relative;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    .nav-menu ul.sub-menu a {
        padding: 12px 15px;
        text-transform: none; /* Bỏ viết hoa cho menu con để dễ đọc */
        font-weight: 500;
    }
    .nav-menu ul.sub-menu a:hover {
        background-color: #004b8f;
        padding-left: 25px; /* Hiệu ứng chữ thụt vào khi hover */
        color: #ffdd00; /* Chữ đổi màu vàng */
    }

    /* --- MENU CON CẤP 2, 3... (Bay ngang sang phải) --- */
    .nav-menu ul.sub-menu ul.sub-menu {
        top: 0;
        left: 100%; /* Đẩy menu cấp 2 sang sát mép phải của menu cấp 1 */
        border-top: none;
        border-left: 3px solid #cc0000; /* Viền đỏ chuyển sang bên trái */
        transform: translateX(10px);
    }
    .nav-menu li:hover > ul.sub-menu ul.sub-menu {
        transform: translateX(0); /* Sửa lại hiệu ứng trượt cho cấp 2 */
    }

    /* --- Tự động thêm Icon Mũi Tên Chỉ Báo --- */
    /* Mũi tên trỏ xuống cho menu cha có menu con */
    .nav-menu li.menu-item-has-children > a::after {
        content: " \25BC"; /* Icon ▼ */
        font-size: 10px;
        margin-left: 5px;
        color: rgba(255,255,255,0.7);
    }
    /* Mũi tên trỏ ngang cho menu con có chứa menu cháu */
    .nav-menu ul.sub-menu li.menu-item-has-children > a::after {
        content: " \25B6"; /* Icon ▶ */
        float: right;
        margin-top: 3px;
    }
}

/* --------------------------------------------------
   GIAO DIỆN MOBILE (Màn hình nhỏ)
-------------------------------------------------- */
.mobile-menu-toggle {
    background: transparent;
    border: none;
    color: #fff;
    padding: 12px 15px;
    font-weight: bold;
    font-size: 16px;
    width: 100%;
    text-align: left;
    outline: none;
}
@media (max-width: 767px) {
    .nav-menu { 
        display: block; 
        background: #004b8f;
    }
    .nav-menu a {
        display: block;
        padding: 12px 15px;
        color: #fff;
        text-decoration: none;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        font-weight: 500;
    }
    .nav-menu ul.sub-menu {
        background-color: rgba(0,0,0,0.15); /* Làm tối nền để phân biệt menu con */
        padding-left: 15px; /* Thụt lề tạo phân cấp trên điện thoại */
        display: block; /* Mặc định xổ sẵn trên mobile khi mở toggle */
        visibility: visible;
        opacity: 1;
        position: relative;
        box-shadow: none;
        border: none;
    }
    .nav-menu li.menu-item-has-children > a::after {
        content: " \25BC";
        float: right;
    }
}

/* --- PORTAL BLOCKS (Khối Nội Dung) --- */
.portal-block {
    border: 1px solid #dcdcdc;
    background: #fff;
    margin-bottom: 20px;
}
.portal-block .block-header {
    padding: 8px 15px;
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    display: flex;
    align-items: center;
}
.portal-block .block-header i { /* Icon trước tiêu đề */
    margin-right: 8px;
}
.portal-block .block-content {
    padding: 15px;
}

/* Theme màu cho Block */
.block-blue .block-header { background-color: #0066cc; }
.block-red .block-header { background-color: #cc0000; }

/* --- CSS CHO DANH SÁCH BÀI VIẾT DẠNG ĐƠN GIẢN (VĂN BẢN) --- */
.post-list-simple ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.post-list-simple li {
    padding: 8px 0;
    border-bottom: 1px dashed #ccc;
}
.post-list-simple li:last-child { border-bottom: none; }
.post-list-simple a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
}
.post-list-simple a:hover { color: #cc0000; }
.post-list-simple .post-date {
    font-size: 12px;
    color: #888;
    margin-left: 5px;
}

/* --- CSS CHO DANH SÁCH CÓ ẢNH ĐẠI DIỆN --- */
.featured-post { margin-bottom: 15px; }
.featured-post img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 10px;
}
.featured-post h4 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 5px;
}
.featured-post a { color: #0056b3; text-decoration: none; }
.featured-post .post-meta {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}
.featured-post .post-excerpt {
    font-size: 14px;
    color: #444;
}
.other-posts {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 2px solid #eee;
    padding-top: 10px;
}
.other-posts li {
    padding: 5px 0;
}
.other-posts a {
    color: #333;
    text-decoration: none;
    font-size: 14px;
}
.other-posts a:hover { color: #0056b3; }

/* --- CSS MENU DỌC (CỘT TRÁI) --- */
.left-menu-container { padding: 0 !important; }
.left-vertical-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}
.left-vertical-menu li { border-bottom: 1px solid #eee; }
.left-vertical-menu li a {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    font-weight: 500;
    background: #f9f9f9;
}
.left-vertical-menu li a:hover {
    background: #0056b3;
    color: #fff;
}

/* --- KHỐI TIN TỨC SỰ KIỆN --- */
.block-blue .block-header {
    background-color: #0056b3; 
    color: #fff;
    padding: 10px 15px;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
}
.header-icon {
    font-size: 18px;
    margin-right: 8px;
    vertical-align: middle;
}

/* Tin nổi bật (Cột trái) */
.featured-news .featured-img {
    border: 1px solid #ddd;
    padding: 3px; /* Tạo viền trắng bao quanh ảnh giống mẫu */
    background: #fff;
    height: 320px; 
    object-fit: cover;
}
.featured-news .featured-title {
    font-size: 18px;
    line-height: 1.4;
    text-transform: uppercase; /* Viết hoa tiêu đề giống mẫu */
}
.featured-news .featured-title a {
    color: #0056b3; /* Màu chữ xanh */
    text-decoration: none;
}
.featured-news .featured-title a:hover {
    color: #cc0000;
}
.featured-news .news-meta {
    font-size: 13px;
    font-weight: 500;
}
.featured-news .news-excerpt {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

/* Danh sách tin nhỏ (Cột phải) */
.news-list-right {
    height: 100%;
}
.border-bottom-dotted {
    border-bottom: 1px dotted #ccc;
}
.news-item-small:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}
.news-item-small .news-thumb img {
    width: 120px;
    height: 80px;
    object-fit: cover;
    border: 1px solid #ddd;
    padding: 2px;
    background: #fff;
}
.news-item-small .news-title-small {
    font-size: 14px;
    line-height: 1.4;
    margin-top: -3px;
}
.news-item-small .news-title-small a {
    color: #0056b3;
    text-decoration: none;
}
.news-item-small .news-title-small a:hover {
    color: #cc0000;
}
.news-item-small .news-meta-small {
    font-size: 12px;
    margin-top: 5px;
}

/* --- DANH SÁCH BÀI VIẾT (CÓ ICON MŨI TÊN/CHẤM) --- */
.post-list-icon ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.post-list-icon li {
    padding: 8px 0 8px 20px;
    border-bottom: 1px dashed #ddd;
    position: relative;
}
.post-list-icon li:last-child { border-bottom: none; }
.post-list-icon li::before {
    content: "►"; /* Hoặc dùng mã hex của icon khác */
    color: #cc0000;
    font-size: 10px;
    position: absolute;
    left: 0;
    top: 12px;
}
.post-list-icon a {
    color: #333;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.4;
    display: block;
}
.post-list-icon a:hover { color: #0056b3; }

/* --- KHỐI TABS BÊN PHẢI --- */
.portal-tabs-widget .nav-tabs {
    border-bottom: 2px solid #0056b3;
    background: #f5f5f5;
}
.portal-tabs-widget .nav-link {
    border: none;
    border-radius: 0;
    color: #333;
    font-weight: bold;
    font-size: 12px;
    padding: 10px 8px;
    text-transform: uppercase;
}
.portal-tabs-widget .nav-link.active {
    background: #fff;
    color: #0056b3;
    border-top: 2px solid #0056b3;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    margin-bottom: -2px; /* Đè lên viền xanh ở dưới */
}

/* Các nút bấm (Quick Links) trong Tab */
.quick-links {
    list-style: none;
    padding: 10px;
    margin: 0;
    border: 1px solid #ddd;
    border-top: none;
    background: #fff;
}
.quick-links li { margin-bottom: 8px; }
.quick-links li:last-child { margin-bottom: 0; }
.quick-links a {
    display: block;
    background: linear-gradient(to bottom, #42b2f5, #0081d6); /* Nền xanh gradient giống ảnh */
    color: #fff;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 4px;
    border: 1px solid #005c99;
    font-weight: bold;
    font-size: 13px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}
.quick-links a:hover {
    background: linear-gradient(to bottom, #0081d6, #005c99);
}
.quick-links .link-icon {
    display: inline-block;
    background: #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    margin-right: 10px;
}

/* --- TRANG CHI TIẾT BÀI VIẾT (SINGLE POST) --- */
.single-post-title {
    font-size: 24px;
    font-weight: bold;
    line-height: 1.4;
    color: #0056b3 !important; /* Chỉnh màu trùng với tone chung */
}
.post-content {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    text-align: justify; /* Căn đều 2 bên cho văn bản chuẩn hành chính */
}
/* Khống chế ảnh và iframe (YouTube, Google Maps) không bị tràn */
.post-content img, 
.post-content iframe {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 15px auto; /* Canh giữa hình ảnh */
}
/* Style cho bảng biểu (table) nếu admin chèn vào bài viết */
.post-content table {
    width: 100% !important;
    border-collapse: collapse;
    margin-bottom: 20px;
}
.post-content table th, 
.post-content table td {
    border: 1px solid #ddd;
    padding: 8px;
}
.breadcrumb { background-color: #e9ecef; }
.breadcrumb a { text-decoration: none; color: #0056b3; }

/* --- TRANG DANH SÁCH CHUYÊN MỤC (CATEGORY ARCHIVE) --- */
.archive-item:last-child {
    border-bottom: none !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}
.archive-title a {
    transition: all 0.3s ease;
}
.archive-title a:hover {
    color: #cc0000 !important; /* Đổi sang màu đỏ khi di chuột qua */
}

/* --- PHÂN TRANG (PAGINATION) --- */
.portal-pagination .nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.portal-pagination h2.screen-reader-text {
    display: none; /* Ẩn dòng chữ "Posts navigation" mặc định của WordPress */
}
.portal-pagination .page-numbers {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    background: #fff;
    border: 1px solid #ddd;
    color: #0056b3;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease-in-out;
}
/* Trạng thái trang hiện tại đang đứng */
.portal-pagination .page-numbers.current {
    background: #0056b3;
    color: #fff;
    border-color: #0056b3;
    box-shadow: 0 2px 4px rgba(0,86,179,0.3);
}
/* Hiệu ứng khi hover vào các số khác */
.portal-pagination .page-numbers:hover:not(.current) {
    background: #f8f9fa;
    color: #cc0000;
    border-color: #cc0000;
}

/* ==========================================================================
   NÂNG CẤP FOOTER XỊN XÒ
   ========================================================================== */
.site-footer {
    background-color: #003366; /* Màu xanh Navy đậm chuẩn khối Hành chính */
    color: #e0e0e0; /* Chữ xám nhạt để dễ đọc trên nền tối */
    font-size: 14px;
    border-top: 4px solid #cc0000; /* Viền đỏ tạo điểm nhấn dứt khoát */
}

/* --- FOOTER TOP --- */
.footer-title {
    color: #ffffff;
    font-size: 20px;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}
.footer-desc {
    font-size: 13px;
    color: #b3c6d6;
}
.contact-list li {
    padding-bottom: 8px;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
}
.contact-list li:last-child {
    border-bottom: none;
}
.contact-list i {
    color: #4da6ff; /* Highlight các icon liên hệ bằng màu xanh sáng */
}

/* --- LIÊN KẾT NHANH (Cột 2) --- */
.footer-heading {
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    position: relative;
    padding-bottom: 10px;
}
/* Tạo gạch chân nhỏ trang trí dưới tiêu đề */
.footer-heading::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 40px;
    height: 2px;
    background-color: #cc0000; 
}
.footer-links a {
    color: #b3c6d6;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-block;
}
.footer-links a:hover {
    color: #ffdd00; /* Đổi sang màu vàng kim khi trỏ chuột */
    transform: translateX(5px); /* Hiệu ứng thụt lề nhẹ */
}

/* --- BẢN ĐỒ (Cột 3) --- */
.map-container {
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    overflow: hidden;
}

/* --- FOOTER BOTTOM --- */
.footer-bottom {
    background-color: #002244; /* Màu nền tối hơn Footer Top một tông */
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 13px;
}
.developer-text a {
    color: #ffdd00;
    text-decoration: none;
    letter-spacing: 1px;
}
.developer-text a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* --- NÚT BACK TO TOP --- */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background-color: #cc0000;
    color: #ffffff;
    font-size: 24px;
    border-radius: 5px; /* Bo góc vuông vắn */
    text-decoration: none;
    display: none; /* Ẩn mặc định, JS sẽ lo việc hiển thị */
    z-index: 999;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transition: background-color 0.3s;
}
.back-to-top:hover {
    background-color: #0056b3;
    color: #fff;
}