/*
Theme Name: ModViet Theme
Theme URI: https://modviet.com
Author: ModViet Team
Author URI: https://modviet.com
Description: Theme WordPress/WooCommerce chuyên nghiệp cho game PC & Mobile Việt Hóa
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: modviet-theme
Tags: woocommerce, ecommerce, dark-mode, responsive
*/

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Tránh nháy màn hình: ẩn search modal & mobile menu ngay từ đầu (Tailwind load ở footer) */
#search-modal,
#mobile-menu {
    display: none;
}
#search-modal.is-open,
#mobile-menu.is-open {
    display: block;
}

/* Cấu hình khuyến nghị: xuống dòng theo Enter, không tạo khoảng trống thừa (chỉ dùng pre-line, không dùng br) */
.cau-hinh-khuyen-nghi-content {
    white-space: pre-line;
    line-height: 1.5;
    word-break: break-word;
}
.cau-hinh-khuyen-nghi-content br { display: none; }

/* Lưu ý: vàng, cỡ chữ lớn hơn Danh mục, nhỏ hơn nút DONATE, text viết liền sau "Lưu ý:" */
.luu-y-san-pham {
    color: #eab308;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.5;
}
.luu-y-san-pham .luu-y-label { font-weight: 700; }
.luu-y-san-pham .luu-y-text { font-weight: 500; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark Mode Variables */
:root {
    --color-bg-light: #ffffff;
    --color-text-light: #1f2937;
    --color-bg-dark: #111827;
    --color-text-dark: #f9fafb;
}

html.dark body {
    background-color: var(--color-bg-dark);
    color: var(--color-text-dark);
}

html:not(.dark) body {
    background-color: var(--color-bg-light);
    color: var(--color-text-light);
}

/* Header menu: chữ trắng nổi bật trên nền tối (cả chế độ sáng & tối) */
#main-header nav ul.flex a {
    color: #fff;
    font-weight: 500;
}
#main-header nav ul.flex a:hover {
    color: #4ade80; /* primary */
}

/* Smooth transitions */
a {
    transition: all 0.3s ease;
}

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

/* ========================================
   WOOCOMMERCE SINGLE PRODUCT IMAGE STYLES
   ======================================== */

/* Container ảnh chính */
.woocommerce-product-gallery__wrapper {
    margin-bottom: 1rem !important;
}

/* ẢNH CHÍNH - Hiển thị THEO TỶ LỆ GỐC, chiếm đầy container */
.woocommerce-product-gallery__image:first-child img,
.woocommerce-product-gallery__image--placeholder img {
    width: 100% !important;
    height: auto !important; /* Tự động theo tỷ lệ ảnh gốc */
    max-width: 100% !important;
    object-fit: contain !important; /* Giữ nguyên tỷ lệ, không crop */
    border-radius: 12px !important;
}

/* TABLET & PC: Layout ngang kích hoạt từ 768px (md breakpoint) */
/* Ảnh sẽ tự động to lên vì chiếm 60% chiều rộng màn hình (3/5 grid) */

/* ========================================
   ẢNH PHỤ - Thanh cuộn ngang (horizontal scroll) + nút trái/phải
   ======================================== */

/* Wrap: nút mũi tên cùng hàng với thumbnail, chồng lên 2 mép (như @1) */
.woocommerce-product-gallery__thumbs-wrap {
    position: relative;
    margin-top: 1rem;
    min-height: 60px;
}

.flex-control-thumbs {
    margin: 0 !important;
    padding: 8px 40px !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-behavior: smooth !important;
    scroll-snap-type: x mandatory !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.flex-control-thumbs::-webkit-scrollbar {
    display: none !important;
}

.flex-control-thumbs li {
    flex: 0 0 auto !important;
    width: 100px !important;
    list-style: none !important;
    margin: 0 !important;
    cursor: pointer !important;
    scroll-snap-align: start !important;
}

.flex-control-thumbs img {
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    border: 2px solid transparent !important;
    transition: all 0.3s ease !important;
}

.flex-control-thumbs img:hover,
.flex-control-thumbs .flex-active img {
    border-color: #10b981 !important;
}

/* Nút mũi tên: nhỏ, trong suốt */
.modviet-gallery-thumbs-btn {
    background: rgba(30, 58, 95, 0.5) !important;
    color: rgba(229, 231, 235, 0.95) !important;
}
.modviet-gallery-thumbs-btn:hover:not(:disabled) {
    background: rgba(37, 99, 235, 0.65) !important;
}

@media (min-width: 768px) {
    .flex-control-thumbs li { width: 120px !important; }
    .flex-control-thumbs { padding-left: 40px !important; padding-right: 40px !important; }
}

@media (min-width: 1024px) {
    .flex-control-thumbs li { width: 140px !important; }
    .flex-control-thumbs { padding-left: 44px !important; padding-right: 44px !important; }
}

/* ========================================
   WOOCOMMERCE MY ACCOUNT - Ẩn sidebar thừa, chỉ dùng Điểm danh + Lịch sử đơn
   ======================================== */
.woocommerce-account .woocommerce-MyAccount-navigation {
    display: none !important;
}

.woocommerce-account .woocommerce-MyAccount-content,
.woocommerce-account .woocommerce-MyAccount-content-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin-right: 0 !important;
}


/* Nút Đăng xuất ở cuối trang */
.modviet-logout-wrap {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(75, 85, 99, 0.5);
    text-align: center;
}
.modviet-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-radius: 0.75rem;
    color: #fca5a5;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}
.modviet-logout-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.7);
    color: #fee2e2;
}

/* Lịch điểm danh: ô ngày luôn hiện số */
.modviet-account-dashboard .modviet-day .modviet-day-num {
    display: inline;
    font-size: 0.875rem;
}
.modviet-account-dashboard .modviet-day .modviet-check-icon {
    font-size: 0.65rem;
    margin-left: 2px;
}

/* ========================================
   POPUP THÔNG BÁO HỆ THỐNG - Welcome Mod Việt
   Bo tròn 4 góc, responsive, nhẹ không ảnh hưởng load
   ======================================== */
.modviet-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.modviet-popup-overlay.modviet-popup-visible {
    opacity: 1;
    visibility: visible;
}
.modviet-popup-box {
    width: 100%;
    max-width: 520px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.modviet-popup-header {
    background: linear-gradient(180deg, #ec4899 0%, #be185d 100%);
    color: #fff;
    padding: 1.25rem 1rem 1rem;
    text-align: center;
    position: relative;
}
.modviet-popup-heart {
    display: block;
    font-size: 1.75rem;
    margin-bottom: 0.35rem;
}
.modviet-popup-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: 0.02em;
}
.modviet-popup-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s ease;
}
.modviet-popup-close:hover {
    background: rgba(255, 255, 255, 0.35);
}
.modviet-popup-footer {
    background: #333;
    padding: 0.5rem 1.25rem 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 2.5rem;
    box-sizing: border-box;
}
.modviet-popup-hide-1h {
    font-size: 0.85rem;
    color: #9ca3af;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.modviet-popup-hide-1h:hover {
    color: #e5e7eb;
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.06);
}
.modviet-popup-body {
    background: #333;
    color: #e5e7eb;
    padding: 1.25rem 1.25rem 1.5rem;
    padding-top: 1.5rem;
    font-size: 0.95rem;
    line-height: 1.65;
    text-align: left;
}
/* Khối chào mừng - căn giữa, cách 1 dòng dưới header hồng */
.modviet-popup-welcome {
    margin-top: 1em;
    margin-bottom: 1.25rem;
    text-align: center;
}
.modviet-popup-line1,
.modviet-popup-line2 {
    margin: 0 0 0.2rem 0;
    font-size: 1.35rem;
    line-height: 1.35;
}
/* Cách 1 dòng từ "Thiên đường game Việt Hoá" xuống đường kẻ xanh, rồi cách 1 dòng tới "1. Để biết cách" */
.modviet-popup-line2.modviet-line2-with-underline {
    display: block;
    padding-bottom: 1em;
    margin-bottom: 1em;
    border-bottom: 2px solid #007bff;
}
.modviet-italic { font-style: italic; }
.modviet-txt-green { color: #28a745; }
.modviet-txt-purple { color: #800080; }
.modviet-txt-pink { color: #ec4899; }
.modviet-txt-red { color: #dc3545; }
.modviet-txt-yellow { color: #ffc107; }
/* Donate / Tải game / Hướng Dẫn / Bình luận / Liên Hệ - chữ to hơn một chút cho nổi bật */
.modviet-popup-list .modviet-popup-highlight { font-size: 1.12em; }
/* Phần hướng dẫn - chữ NHỎ hơn, từng đoạn đúng màu/nghiêng */
.modviet-popup-list {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.95rem;
}
.modviet-popup-list li {
    margin-bottom: 0.6rem;
    font-style: normal;
}
.modviet-list-default { color: #e5e7eb; font-style: normal; }
.modviet-list-italic { color: #e5e7eb; font-style: italic; }
.modviet-popup-list .modviet-link {
    text-decoration: none;
    font-weight: 700;
    font-style: normal;
}
.modviet-popup-list .modviet-link:hover {
    text-decoration: underline;
}
/* Ô viền đứt đoạn cho "Hướng Dẫn" và "Liên Hệ" trong popup */
.modviet-popup-list .modviet-popup-link-box {
    display: inline-block;
    padding: 0.15em 0.5em;
    border: 1px dashed currentColor;
    border-radius: 4px;
}
.modviet-popup-list .modviet-popup-link-box:hover {
    border-style: solid;
}
.modviet-link-bold { font-weight: 700; }
/* Dòng kẻ đỏ riêng, cách 1 dòng dưới chữ "giải đáp" (chữ "Liên Hệ để được giải đáp" vẫn viết liền trên một dòng) */
.modviet-red-line {
    display: block;
    margin-top: 1em;
    border-bottom: 2px solid #dc3545;
}
@media (min-width: 640px) {
    .modviet-popup-box { max-width: 560px; }
    .modviet-popup-header { padding: 1.5rem 1.25rem 1.25rem; }
    .modviet-popup-heart { font-size: 2rem; margin-bottom: 0.5rem; }
    .modviet-popup-title { font-size: 1.35rem; }
    .modviet-popup-body { padding: 1.5rem 1.5rem 1.75rem; }
    .modviet-popup-line1, .modviet-popup-line2 { font-size: 1.4rem; }
    .modviet-popup-list { font-size: 1rem; }
}
@media (max-width: 479px) {
    .modviet-popup-overlay { padding: 0.75rem; }
    .modviet-popup-body { padding: 1rem 1rem 1.25rem; }
    .modviet-popup-footer { padding: 0.5rem 1rem 0.75rem; }
    .modviet-popup-line1, .modviet-popup-line2 { font-size: 1.2rem; }
    .modviet-popup-list { font-size: 0.9rem; padding-left: 1rem; }
}

/* Hai nút DONATE + Thuê/Mua acc: cùng chiều cao cố định để trông giống nhau */
.modviet-product-cta-btn {
    box-sizing: border-box;
    height: 2.75rem;
    min-height: 2.75rem;
}
@media (min-width: 768px) {
    .modviet-product-cta-btn {
        height: 3.25rem;
        min-height: 3.25rem;
    }
}

/* Nút phụ hai dòng: chữ gọn, sát mép, vừa trong cùng chiều cao với nút Donate */
.modviet-extra-btn-two-lines {
    min-height: 0;
    gap: 0;
}
.modviet-extra-btn-two-lines .modviet-extra-btn-line1,
.modviet-extra-btn-two-lines .modviet-extra-btn-line2 {
    display: block;
    line-height: 1.1;
    white-space: nowrap;
    margin: 0;
    padding: 0;
    font-size: 0.95rem;
}
.modviet-extra-btn-two-lines .modviet-extra-btn-sep {
    display: block;
    width: 70%;
    max-width: 80px;
    height: 1px;
    background: rgba(255, 255, 255, 0.9);
    margin: 0.08rem 0;
    flex-shrink: 0;
}
@media (min-width: 768px) {
    .modviet-extra-btn-two-lines .modviet-extra-btn-line1,
    .modviet-extra-btn-two-lines .modviet-extra-btn-line2 {
        font-size: 1.05rem;
    }
    .modviet-extra-btn-two-lines .modviet-extra-btn-sep {
        max-width: 96px;
        margin: 0.1rem 0;
    }
}

/* ========================================
   POPUP "Game Android Tàu bản quyền" (nút phụ cạnh Donate)
   Nền đen, chữ trắng, 3 mục có icon xanh/cam/xanh dương
   ======================================== */
.modviet-android-tau-popup {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modviet-android-tau-popup.modviet-android-tau-popup--visible {
    display: flex;
}
.modviet-android-tau-popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    cursor: pointer;
}
.modviet-android-tau-popup-box {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: #000;
    color: #fff;
    border-radius: 12px;
    padding: 1.5rem 1.5rem 1.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.modviet-android-tau-popup-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s ease;
}
.modviet-android-tau-popup-close:hover {
    background: rgba(255, 255, 255, 0.25);
}
.modviet-android-tau-popup-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    text-align: left;
    letter-spacing: 0.02em;
    color: #fff;
}
.modviet-android-tau-popup-list {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
}
.modviet-android-tau-popup-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    font-size: 0.95rem;
    color: #fff;
}
.modviet-android-tau-popup-list li:last-child {
    margin-bottom: 0;
}
.modviet-android-tau-popup-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.modviet-popup-btn {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.1rem;
    font-size: 1.08rem;
    font-weight: 700;
    text-decoration: none;
    color: #fff;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.modviet-popup-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}
.modviet-popup-btn--chat {
    flex: 3 1 0;
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
}
.modviet-popup-btn--discord {
    flex: 4 1 0;
    background: linear-gradient(180deg, #5865f2 0%, #4752c4 100%);
}
.modviet-android-tau-icon {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #fff;
}
.modviet-android-tau-icon--green {
    background: #22c55e;
}
.modviet-android-tau-icon--orange {
    background: #f97316;
}
.modviet-android-tau-icon--blue {
    background: #3b82f6;
}
@media (min-width: 480px) {
    .modviet-android-tau-popup-box { padding: 1.75rem 2rem 2rem; }
    .modviet-android-tau-popup-title { font-size: 1.25rem; margin-bottom: 1.25rem; }
    .modviet-android-tau-popup-list li { font-size: 1rem; }
}