/**
 * TechHub Main CSS - Vanilla Styling Foundations
 * 
 * Cung cấp các tinh chỉnh giao diện, vi hiệu ứng tương tác (Micro-interactions)
 * và định kiểu cho các thành phần UI của Hybrid AI Learning Hub.
 */

:root {
    --th-transition-fast: 150ms ease;
    --th-transition-base: 250ms ease;
    --th-transition-slow: 350ms ease;
}

/* ==========================================================================
   Loại bỏ hoàn toàn Padding mặc định của WordPress Core cho Group có Background
   ========================================================================== */
:where(.wp-block-group.has-background),
.wp-block-group.has-background,
:where(.th-post-card.has-background),
.th-post-card.has-background,
:where(.th-post-card),
.th-post-card {
    padding: 0 !important;
}

/* Chống tràn ngang tuyệt đối toàn trang mà không phá vỡ position: sticky */
html,
body {
    overflow-x: clip;
    max-width: 100%;
}

/* Thống nhất căn lề các section trang chủ */
.th-home-section {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}

.th-home-section > *,
.th-home-section > .th-section-header,
.th-home-section > .th-topics-grid,
.th-home-section > .th-tools-grid,
.th-home-section > .th-services-grid,
.th-home-section > .th-newsletter-banner,
.th-home-section > .wp-block-query,
.th-home-section > .th-query-4col,
.th-home-section > .alignwide,
.th-home-section > :where(:not(.alignfull)),
.th-category-grid-section > *,
.wp-block-group.th-home-section > :not(.alignfull),
.th-single-main,
.th-page-main,
.th-archive-main,
.th-main-content,
.th-single-review-layout,
.th-single-tool-main,
.th-single-resource-main,
.th-footer-inner,
.th-site-footer > .alignwide,
.th-site-footer > .wp-block-group,
.th-site-footer > * {
    max-width: 1360px !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
    box-sizing: border-box !important;
}

/* Base Body & Layout */
body {
    font-family: var(--wp--preset--font-family--sans);
    background-color: var(--wp--preset--color--surface-white);
    color: var(--wp--preset--color--text-main);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Focus Visible Accessibility */
:focus-visible {
    outline: 2px solid var(--wp--preset--color--blue-electric);
    outline-offset: 2px;
}

/* Header & Sticky Styling */
.th-site-header {
    transition: background-color var(--th-transition-base), border-color var(--th-transition-base);
}

.th-site-logo img {
    border-radius: 8px;
    display: block;
}

/* Theme Toggle Button */
.th-theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--wp--preset--color--surface-light);
    border: 1px solid var(--wp--preset--color--border-light);
    color: var(--wp--preset--color--navy-primary);
    cursor: pointer;
    transition: all var(--th-transition-fast);
    padding: 0;
}

.th-theme-toggle-btn:hover {
    background: var(--wp--preset--color--blue-light);
    color: var(--wp--preset--color--blue-electric);
    border-color: var(--wp--preset--color--blue-electric);
    transform: translateY(-1px);
}

.th-theme-toggle-btn .th-icon-moon {
    display: block;
}

.th-theme-toggle-btn .th-icon-sun {
    display: none;
}

html.dark-mode .th-theme-toggle-btn .th-icon-moon {
    display: none;
}

html.dark-mode .th-theme-toggle-btn .th-icon-sun {
    display: block;
}

/* Search Action Button */
.th-header-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--wp--preset--color--surface-light);
    border: 1px solid var(--wp--preset--color--border-light);
    color: var(--wp--preset--color--navy-primary);
    text-decoration: none;
    transition: all var(--th-transition-fast);
}

.th-header-search-btn:hover {
    background: var(--wp--preset--color--blue-light);
    color: var(--wp--preset--color--blue-electric);
    border-color: var(--wp--preset--color--blue-electric);
    transform: translateY(-1px);
}

/* Content Cards Hover Physics */
.th-post-card, .th-tool-card, .th-resource-card {
    transition: transform var(--th-transition-base), box-shadow var(--th-transition-base), border-color var(--th-transition-base);
}

.th-post-card:hover, .th-tool-card:hover, .th-resource-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--wp--preset--shadow--lg) !important;
    border-color: var(--wp--preset--color--border-focus) !important;
}

.th-post-card img {
    transition: transform 0.4s ease;
}

.th-post-card:hover img {
    transform: scale(1.02);
}

/* Post Categories & Term Badges */
.wp-block-post-terms a {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    background: var(--wp--preset--color--blue-light);
    color: var(--wp--preset--color--blue-electric);
    font-size: var(--wp--preset--font-size--xs);
    font-weight: 600;
    text-decoration: none;
    transition: opacity var(--th-transition-fast);
}

.wp-block-post-terms a:hover {
    opacity: 0.85;
}

/* Pagination Buttons */
.wp-block-query-pagination-numbers a,
.wp-block-query-pagination-numbers span,
.wp-block-query-pagination-previous,
.wp-block-query-pagination-next {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--wp--preset--color--border-light);
    color: var(--wp--preset--color--navy-primary);
    font-size: var(--wp--preset--font-size--sm);
    font-weight: 600;
    text-decoration: none;
    margin: 0 0.25rem;
    transition: all var(--th-transition-fast);
}

.wp-block-query-pagination-numbers span.current {
    background: var(--wp--preset--color--blue-electric);
    color: #ffffff;
    border-color: var(--wp--preset--color--blue-electric);
}

.wp-block-query-pagination-numbers a:hover,
.wp-block-query-pagination-previous:hover,
.wp-block-query-pagination-next:hover {
    border-color: var(--wp--preset--color--blue-electric);
    color: var(--wp--preset--color--blue-electric);
}

/* Footer Layout & Styling */
.th-site-footer {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    box-sizing: border-box !important;
}

.th-footer-inner,
.th-site-footer > .alignwide,
.th-site-footer > .wp-block-group,
.th-site-footer > * {
    padding-top: 3.5rem !important;
    padding-bottom: 2rem !important;
}

.th-footer-list {
    list-style: none !important;
    padding-left: 0 !important;
    margin: 0 !important;
    line-height: 2.1 !important;
}

.th-footer-list li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.th-footer-list a {
    color: var(--wp--preset--color--text-muted);
    text-decoration: none;
    transition: color var(--th-transition-fast);
}

.th-footer-list a:hover {
    color: var(--wp--preset--color--blue-electric);
}

.th-footer-bottom-list {
    list-style: none !important;
    display: flex !important;
    gap: 1.5rem !important;
    padding-left: 0 !important;
    margin: 0 !important;
    font-size: var(--wp--preset--font-size--xs) !important;
    flex-wrap: wrap !important;
}

.th-footer-bottom-list a {
    color: var(--wp--preset--color--text-muted);
    text-decoration: none;
    transition: color var(--th-transition-fast);
}

.th-footer-bottom-list a:hover {
    color: var(--wp--preset--color--blue-electric);
}

/* Dynamic Resource Format Filter Pills */
.th-format-filter-wrap {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 2.5rem;
}

.th-format-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1.15rem;
    background: var(--wp--preset--color--surface-light);
    border: 1px solid var(--wp--preset--color--border-light);
    color: var(--wp--preset--color--navy-primary);
    border-radius: 9999px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--th-transition-fast);
}

.th-format-filter-btn:hover {
    border-color: var(--wp--preset--color--blue-electric);
    color: var(--wp--preset--color--blue-electric);
    transform: translateY(-1px);
}

.th-format-filter-btn.is-active {
    background: var(--wp--preset--color--blue-electric) !important;
    border-color: var(--wp--preset--color--blue-electric) !important;
    color: #ffffff !important;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* Responsive Rules */
@media (max-width: 768px) {
    .th-site-header {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .th-header-cta-btn {
        display: none !important;
    }

    .th-footer-inner,
    .th-site-footer > .alignwide,
    .th-site-footer > .wp-block-group,
    .th-site-footer > * {
        padding-top: 2.5rem !important;
        padding-bottom: 1.5rem !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}
