/*
Final CSS Overrides - Xử lý các trường hợp xung đột cuối cùng
Priority: 9999 - Load cuối cùng để override tất cả
*/

/* ==========================================================================
   1. FORCE OVERRIDE HEADING SIZES - FINAL
   ========================================================================== */

/* H1 - Đảm bảo tất cả H1 đều 32px */
h1, .h1,
.entry-title, .post-title, .page-title,
.blog-main-title, .hero-title,
.single-post .post-title,
.single-post .entry-title,
.woocommerce-page .entry-title,
.woocommerce .entry-title {
    font-size: 32px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    margin-bottom: 20px !important;
}

/* H2 - Đảm bảo tất cả H2 đều 26px */
h2, .h2,
.section-title, .category-title, .widget-title,
.single-post .post-content h2,
.single-post .entry-content h2,
.woocommerce h2,
.elementor-heading-title[data-elementor-type="h2"] {
    font-size: 26px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
}

/* H3 - Đảm bảo tất cả H3 đều 22px */
h3, .h3,
.featured-post-content h3,
.single-post .related-posts h3,
.single-post .post-content h3,
.single-post .entry-content h3,
.secondary-post-card .post-title,
.main-post-card .post-title,
.woocommerce h3,
.elementor-heading-title[data-elementor-type="h3"] {
    font-size: 22px !important;
    font-weight: 600 !important;
    line-height: 1.4 !important;
}

/* H4, H5, H6 - Đảm bảo cascade đúng */
h4, .h4 { font-size: 20px !important; }
h5, .h5 { font-size: 18px !important; }
h6, .h6 { font-size: 16px !important; }

/* ==========================================================================
   2. FORCE OVERRIDE BODY TEXT - FINAL
   ========================================================================== */

/* Blog Post Content - 18px cho nội dung chính */
.single-post .post-content,
.single-post .entry-content,
.post-content,
.entry-content {
    font-size: 18px !important;
    line-height: 1.7 !important;
    color: #495057 !important;
}

.single-post .post-content p,
.single-post .entry-content p,
.post-content p,
.entry-content p {
    font-size: 18px !important;
    line-height: 1.7 !important;
    margin-bottom: 20px !important;
}

/* Website general body - 16px cho phần còn lại */
body,
.site-main,
.content-area,
.widget-area {
    font-size: 16px !important;
    line-height: 1.6 !important;
}

/* ==========================================================================
   3. FORCE OVERRIDE BUTTONS - FINAL BORDER-RADIUS
   ========================================================================== */

/* Tất cả buttons sử dụng 6px border-radius */
button, .button, .btn,
input[type="submit"], input[type="button"],
.wp-block-button__link,
.wc-forward, .added_to_cart,
.single_add_to_cart_button,
.checkout-button,
.woocommerce-Button,
.hero-read-more-btn,
.view-all-btn,
.newsletter-form button,
.woocommerce .button,
.woocommerce button.button,
a.button,
.elementor-button,
.elementor-button-link {
    border-radius: 6px !important;
}

/* Buttons lớn đặc biệt - 8px */
.hero-read-more-btn,
.newsletter-form button,
.single_add_to_cart_button,
.checkout-button,
.woocommerce-checkout .button {
    border-radius: 8px !important;
}

/* ==========================================================================
   4. FORM ELEMENTS CONSISTENCY
   ========================================================================== */

input[type="text"], input[type="email"],
input[type="password"], input[type="search"],
input[type="tel"], input[type="url"],
input[type="number"], textarea, select,
.form-control,
.woocommerce input,
.woocommerce select,
.woocommerce textarea {
    border-radius: 6px !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
}

/* ==========================================================================
   5. CARDS VÀ CONTAINERS CONSISTENCY
   ========================================================================== */

/* Small cards - 8px */
.post-card, .main-post-card,
.secondary-post-card,
.widget, .sidebar-widget {
    border-radius: 8px !important;
}

/* Large containers - 12px */
.content-area,
.single-post .content-area,
.related-posts,
.newsletter-cta-section,
.blog-hero,
.checkout-container,
.cart-container {
    border-radius: 12px !important;
}

/* ==========================================================================
   6. PAGINATION & NAVIGATION
   ========================================================================== */

.pagination .page-numbers,
.nav-links .page-numbers,
.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
    border-radius: 6px !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
}

/* ==========================================================================
   7. SPECIFIC BLOG OVERRIDES
   ========================================================================== */

/* Override hero section của blog */
.blog-hero .hero-title {
    font-size: 32px !important; /* Thay vì 42px */
}

/* Override post cards trong grid */
.main-posts-grid .main-post-card .post-title,
.secondary-featured-grid .secondary-post-card .post-title {
    font-size: 22px !important; /* H3 size */
}

/* ==========================================================================
   BLOG GRID LAYOUT FIX - FORCE PROPER RESPONSIVE GRID
   ========================================================================== */

/* Desktop - 3 cột luôn */
.main-posts-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 30px !important;
}

/* Tablet - 2 cột */
@media (max-width: 991px) and (min-width: 576px) {
    .main-posts-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px !important;
    }
}

/* Mobile - 1 cột chỉ khi thực sự nhỏ */
@media (max-width: 575px) {
    .main-posts-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
}

/* ==========================================================================
   8. WOOCOMMERCE SPECIFIC
   ========================================================================== */

/* Product titles */
.woocommerce .entry-title,
.woocommerce h1.product_title {
    font-size: 32px !important; /* H1 size */
}

.woocommerce .related h2,
.woocommerce .upsells h2,
.woocommerce .cross-sells h2 {
    font-size: 26px !important; /* H2 size */
}

/* Cart & Checkout buttons */
.woocommerce-cart .button,
.woocommerce-checkout .button,
.wc-proceed-to-checkout .button {
    border-radius: 8px !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
}

/* ==========================================================================
   9. RESPONSIVE FINAL OVERRIDES
   ========================================================================== */

@media (max-width: 768px) {
    h1, .h1, .entry-title, .post-title,
    .hero-title, .blog-main-title {
        font-size: 26px !important;
    }

    h2, .h2, .section-title {
        font-size: 22px !important;
    }

    h3, .h3,
    .main-post-card .post-title,
    .secondary-post-card .post-title {
        font-size: 20px !important;
    }

    .single-post .post-content,
    .single-post .entry-content {
        font-size: 17px !important;
        line-height: 1.6 !important;
    }
}

@media (max-width: 480px) {
    h1, .h1, .entry-title, .post-title {
        font-size: 24px !important;
    }

    h2, .h2 {
        font-size: 20px !important;
    }

    h3, .h3 {
        font-size: 18px !important;
    }

    .single-post .post-content,
    .single-post .entry-content {
        font-size: 16px !important;
    }
}

/* ==========================================================================
   10. FORCE COLOR CONSISTENCY
   ========================================================================== */

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.entry-title, .post-title,
.section-title, .widget-title {
    color: #212529 !important;
    font-family: inherit !important;
}

.single-post .post-content,
.single-post .entry-content,
.post-content, .entry-content {
    color: #495057 !important;
}

/* End Final Overrides */