/*
Theme Name:   DHGAMING Theme
Theme URI:    https://dhgaming.net
Description:  Theme tùy chỉnh mượt, nhẹ cho trang tải tài liệu
Author:       DHG Studio
Author URI:   https://dhgaming.net
Version:      1.0.9 (Thêm Widget Mạng Xã Hội)
License:      GNU General Public License v2 or later
License URI:  http://www.gnu.org/licenses/gpl-2.0.html
Tags:         lightweight, responsive, median-ui, custom-theme
Text Domain:  dhgaming-theme
*/

/* --- 0. RESET & CHUẨN HÓA CƠ BẢN --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    margin: 0;
    padding: 0;
    color: #333;
}
*, *:before, *:after {
    box-sizing: border-box;
}
img {
    max-width: 100%;
    height: auto;
}

/* --- 1. TỔNG QUAN & NỀN TRANG --- */
body {
    background-color: #f8f9fa; /* Màu nền xám RẤT NHẠT */
    line-height: 1.7; /* Giãn dòng, dễ đọc */
}
.site-content-container {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding: 20px;
}
@media (max-width: 768px) {
    .site-content-container {
        padding: 15px;
    }
}

/* --- (MỚI) 1.5 LAYOUT CONTENT + SIDEBAR --- */
.site-content-wrapper {
    display: flex;
    gap: 30px; /* Khoảng cách giữa nội dung và sidebar */
}
.site-main {
    flex: 1; /* Tự co giãn lấp đầy */
    min-width: 0; /* Fix lỗi flexbox */
}
.site-sidebar {
    flex-basis: 300px; /* Độ rộng cố định của sidebar */
    flex-shrink: 0;
}


/* --- 2. XỬ LÝ LINK (KHÔNG GẠCH CHÂN) --- */
a {
    text-decoration: none !important;
    border-bottom: none !important;
    transition: color 0.3s ease;
    color: #0073aa;
}
.entry-content a,
.comment-content a {
    color: #0073aa;
}
.entry-content a:hover,
.entry-content a:focus,
.comment-content a:hover,
.comment-content a:focus {
    color: #d9534f;
    text-decoration: none !important;
}

/* --- 3. BỐ CỤC THẺ (CARD LAYOUT) --- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}
@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
}

article.post-card {
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #f0f0f0;
    transition: all 0.3s ease;
    overflow: hidden;
}
article.post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}
.card-content {
    padding: 15px 20px; /* Giảm padding cho gọn */
}
.card-title {
    font-size: 1.2em; /* Giảm cỡ chữ tiêu đề 1 chút */
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0; /* Bỏ margin dưới */
    line-height: 1.4;
}
.card-title a {
    color: #333;
    text-decoration: none !important;
}
.card-title a:hover {
    color: #0073aa;
}


/* --- 4. HEADER (HEADER.PHP) - ĐÃ SỬA LỖI LAYOUT --- */
.site-header {
    background-color: #ffffff;
    border-bottom: 1px solid #f0f0f0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    position: relative; 
    z-index: 990; 
}
.site-logo a {
    font-size: 1.5em;
    font-weight: 700;
    color: #222;
    text-decoration: none;
    flex-shrink: 0; 
}
.main-navigation-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto; /* <- SỬA LỖI DESKTOP */
}
.main-navigation ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: 20px;
}
.main-navigation li a {
    font-weight: 500;
    color: #444;
    padding: 15px 0;
    display: block;
}
.main-navigation li a:hover {
    color: #0073aa;
}


/* --- 5. KHÓA ẢNH 16:9 --- */
.card-thumbnail img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}
.entry-content img,
.wp-block-image img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    margin: 20px 0;
}

/* --- 6. KHỐI DOWNLOAD ĐẾM NGƯỢC (SINGLE.PHP) --- */
.download-wrapper {
    background-color: #f4f7f6;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    margin: 30px 0;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}
#countdown-timer {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 15px;
    margin-top: 15px;
}
#countdown-timer #time-left {
    font-weight: bold;
    color: #d9534f;
    font-size: 1.2em;
}
.download-wrapper .button {
    display: inline-block; 
    text-decoration: none !important;
    background-color: #0073aa;
    color: #ffffff !important;
    padding: 12px 30px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.1em;
    transition: background-color 0.3s ease;
    border: none;
    cursor: pointer;
    font-family: inherit;
}
.download-wrapper .button:hover {
    background-color: #005a87;
    color: #ffffff !important;
}

/* --- 7. BÀI VIẾT CHI TIẾT & TRANG TĨNH (SINGLE.PHP, PAGE.PHP) --- */
.content-area {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #f0f0f0;
    padding: 30px 40px;
    margin-top: 25px;
}
@media (max-width: 600px) {
    .content-area {
        padding: 20px;
    }
}
.entry-header .entry-title {
    font-size: 2.2em;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 20px;
    line-height: 1.3;
}
.entry-content {
    font-size: 1.1em;
}

/* --- 8. FOOTER (FOOTER.PHP) --- */
.site-footer {
    text-align: center;
    margin-top: 30px;
    padding: 25px;
    border-top: 1px solid #e0e0e0;
    color: #777;
    font-size: 0.9em;
}

/* --- 9. MENU ĐA CẤP (DROPDOWN DESKTOP) --- */
.main-navigation .menu-item {
    position: relative;
}
.main-navigation .sub-menu {
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.25s ease;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 220px;
    background-color: #ffffff;
    border: 1px solid #f0f0f0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border-radius: 0 0 8px 8px;
    padding: 5px 0;
}
.main-navigation .menu-item:hover > .sub-menu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}
.main-navigation .sub-menu li {
    display: block;
    width: 100%;
}
.main-navigation .sub-menu li a {
    display: block;
    padding: 10px 15px;
    color: #444;
    font-weight: 400;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}
.main-navigation .sub-menu li:last-child a {
    border-bottom: none;
}
.main-navigation .sub-menu li a:hover {
    background-color: #f8f9fa;
    color: #0073aa;
}
.submenu-toggle {
    display: none;
}

/* --- 10. MENU MOBILE (CŨ) --- */
.mobile-menu-toggle-btn {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
}
.mobile-menu-toggle-btn .icon-bar {
    display: block;
    width: 22px;
    height: 3px;
    background-color: #333;
    border-radius: 1px;
    transition: all 0.3s ease;
}
.mobile-menu-toggle-btn .icon-bar + .icon-bar {
    margin-top: 4px;
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}
.mobile-menu-toggle-btn.is-active .icon-bar:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.mobile-menu-toggle-btn.is-active .icon-bar:nth-child(2) {
    opacity: 0;
}
.mobile-menu-toggle-btn.is-active .icon-bar:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}
body.mobile-menu-open {
    overflow: hidden;
}

/* --- 11. TÌM KIẾM --- */
.icon-search {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: currentColor;
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>');
    background-repeat: no-repeat;
    background-position: center;
}
.search-form {
    position: relative;
    display: flex;
}
.search-field {
    width: 100%;
    padding: 8px 40px 8px 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 0.9em;
}
.search-submit {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0 10px;
    color: #555;
}
.search-submit:hover {
    color: #0073aa;
}
.desktop-search {
    margin-left: 20px;
}
.mobile-search-toggle-btn,
.mobile-search-container,
.search-overlay {
    display: none; 
}
.header-icon-group {
    display: none; 
    gap: 5px;
}
.mobile-search-toggle-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
    color: #333;
}
.mobile-search-toggle-btn .icon-search {
    transition: all 0.3s ease;
}
body.search-open {
    overflow: hidden;
}
body.search-open .site-header {
    visibility: hidden;
}
.mobile-search-container {
    background: #fff;
    padding: 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transform: translateY(-100%);
    transition: transform 0.4s ease;
}
.mobile-search-container.is-open {
    transform: translateY(0);
}
.mobile-search-container .search-field {
    font-size: 1.1em;
    padding: 12px 45px 12px 15px;
}
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
.search-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

/* --- 12. KIỂU DÁNG WIDGET SIDEBAR --- */
.widget-area .widget {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    border: 1px solid #f0f0f0;
    padding: 20px;
    margin-bottom: 25px;
}
.widget-area .widget-title {
    font-size: 1.3em;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}
.widget-area .widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.widget-area .widget ul li {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f9f9f9;
}
.widget-area .widget ul li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.widget-area .widget ul li a {
    color: #444;
    font-weight: 500;
}
.widget-area .widget ul li a:hover {
    color: #0073aa;
}

/* --- (MỚI) 13. WIDGET MẠNG XÃ HỘI --- */

/* 13.1. Nhận diện widget menu "Social" */
.widget_nav_menu .menu-social-container ul {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Chia 2 cột */
    gap: 10px;
    border: none;
    padding: 0;
}
.widget_nav_menu .menu-social-container li {
    margin: 0;
    padding: 0;
    border: none;
    width: 100%;
}

/* 13.2. Tạo kiểu nút bấm */
.widget_nav_menu .menu-social-container li a {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    color: #fff !important; /* Ghi đè màu link mặc định */
    transition: opacity 0.3s ease;
}
.widget_nav_menu .menu-social-container li a:hover {
    opacity: 0.85;
}

/* 13.3. Thêm icon và màu sắc */
/* Icon (dùng SVG inline) */
.widget_nav_menu .menu-social-container li a::before {
    content: '';
    display: inline-block;
    width: 1.2em;
    height: 1.2em;
    margin-right: 8px;
    background-color: #fff; /* Màu của icon */
    background-repeat: no-repeat;
    background-position: center;
}

/* 13.4. Tự động nhận diện tên (Link Text) và gán màu + icon */

/* YouTube */
.widget_nav_menu .menu-social-container li a[href*="youtube.com"] {
    background-color: #FF0000;
}
.widget_nav_menu .menu-social-container li a[href*="youtube.com"]::before {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22.54 6.42c-.28-1.07-.86-1.94-1.94-2.22C18.96 3.5 12 3.5 12 3.5s-6.96 0-8.6.7c-1.08.28-1.66 1.15-1.94 2.22C1.5 8.1 1.5 12 1.5 12s0 3.9.46 5.58c.28 1.07.86 1.94 1.94 2.22C5.04 20.5 12 20.5 12 20.5s6.96 0 8.6-.7c1.08-.28 1.66-1.15 1.94-2.22C22.5 15.9 22.5 12 22.5 12s0-3.9-.46-5.58z"></path><polygon points="9.5 15.5 15.5 12 9.5 8.5 9.5 15.5"></polygon></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22.54 6.42c-.28-1.07-.86-1.94-1.94-2.22C18.96 3.5 12 3.5 12 3.5s-6.96 0-8.6.7c-1.08.28-1.66 1.15-1.94 2.22C1.5 8.1 1.5 12 1.5 12s0 3.9.46 5.58c.28 1.07.86 1.94 1.94 2.22C5.04 20.5 12 20.5 12 20.5s6.96 0 8.6-.7c1.08-.28 1.66-1.15 1.94-2.22C22.5 15.9 22.5 12 22.5 12s0-3.9-.46-5.58z"></path><polygon points="9.5 15.5 15.5 12 9.5 8.5 9.5 15.5"></polygon></svg>');
}

/* Facebook */
.widget_nav_menu .menu-social-container li a[href*="facebook.com"] {
    background-color: #1877F2;
}
.widget_nav_menu .menu-social-container li a[href*="facebook.com"]::before {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z"></path></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z"></path></svg>');
}

/* Twitter */
.widget_nav_menu .menu-social-container li a[href*="twitter.com"] {
    background-color: #1DA1F2;
}
.widget_nav_menu .menu-social-container li a[href*="twitter.com"]::before {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M23 3a10.9 10.9 0 0 1-3.14 1.53 4.48 4.48 0 0 0-7.86 3v1A10.66 10.66 0 0 1 3 4s-4 9 5 13a11.64 11.64 0 0 1-7 2c9 5 20 0 20-11.5a4.5 4.5 0 0 0-.08-.83A7.72 7.72 0 0 0 23 3z"></path></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M23 3a10.9 10.9 0 0 1-3.14 1.53 4.48 4.48 0 0 0-7.86 3v1A10.66 10.66 0 0 1 3 4s-4 9 5 13a11.64 11.64 0 0 1-7 2c9 5 20 0 20-11.5a4.5 4.5 0 0 0-.08-.83A7.72 7.72 0 0 0 23 3z"></path></svg>');
}

/* Instagram */
.widget_nav_menu .menu-social-container li a[href*="instagram.com"] {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}
.widget_nav_menu .menu-social-container li a[href*="instagram.com"]::before {
    -webkit-mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="20" height="20" rx="5" ry="5"></rect><path d="M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z"></path><line x1="17.5" y1="6.5" x2="17.51" y2="6.5"></line></svg>');
    mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="2" width="20" height="20" rx="5" ry="5"></rect><path d="M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z"></path><line x1="17.5" y1="6.5" x2="17.51" y2="6.5"></line></svg>');
}

/* --- 14. RESPONSIVE CUỐI CÙNG --- */
@media (max-width: 991px) {
    /* Responsive cho Sidebar */
    .site-content-wrapper {
        flex-direction: column; /* Xếp dọc */
    }
    .site-sidebar {
        flex-basis: auto; /* Bỏ độ rộng cố định */
        width: 100%;
        margin-top: 30px;
    }
}
@media (max-width: 768px) {
    /* Sửa lỗi card grid */
    .card-grid {
        grid-template-columns: 1fr;
    }
    
    .desktop-search {
        display: none;
    }
    .site-header {
        flex-wrap: wrap;
        padding: 10px 15px;
        justify-content: space-between; 
    }
    .mobile-menu-toggle-btn {
        display: block;
    }
    .main-navigation-container {
        display: block; 
        visibility: hidden;
        opacity: 0;
        transform: translateY(-100%);
        transition: all 0.4s ease;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: #ffffff;
        z-index: 1000;
        overflow-y: auto;
        padding: 80px 20px 20px 20px;
    }
    .main-navigation-container.is-open {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
    }
    .main-navigation ul,
    .main-navigation .sub-menu {
        display: block;
        position: static;
        background: none;
        box-shadow: none;
        border: none;
        padding: 0;
        width: 100%;
        opacity: 1;
        visibility: visible;
        transform: none;
        min-width: 0;
    }
    .main-navigation li {
        display: block;
        border-bottom: 1px solid #f0f0f0;
    }
    .main-navigation li a {
        display: block;
        padding: 15px 10px; 
        font-size: 1.2em;
        font-weight: 500;
        width: 100%;
        text-align: left; 
    }
    .main-navigation .sub-menu {
        padding-left: 20px;
        display: none; 
    }
    .main-navigation .sub-menu.is-open {
        display: block; 
    }
    .submenu-toggle {
        display: block;
        position: absolute;
        top: 0;
        right: 0;
        width: 50px;
        height: 50px; 
        background: transparent;
        border: none;
        cursor: pointer;
        z-index: 10;
        padding: 15px;
    }
    .submenu-toggle::before {
        content: '';
        display: block;
        width: 8px;
        height: 8px;
        border-right: 2px solid #aaa;
        border-bottom: 2px solid #aaa;
        transform: rotate(45deg);
        transition: transform 0.3s ease;
    }
    .submenu-toggle[aria-expanded="true"]::before {
        transform: rotate(-135deg);
        margin-top: 5px;
    }
    .main-navigation .menu-item-has-children {
        position: relative;
    }
    .main-navigation .menu-item-has-children > a {
        padding-right: 60px;
    }
    
    .header-icon-group {
        display: flex; 
    }
    
    .mobile-search-toggle-btn,
    .mobile-search-container,
    .search-overlay {
        display: block;
    }
    
    body.mobile-menu-open .mobile-search-toggle-btn {
        visibility: hidden;
    }
}