/* ==========================================================================
   Kinh Phuc Dat Theme Custom Styles
   ========================================================================== */

/* --- Variables --- */
:root {
    --primary-color: #d1121d;
    /* Red primary */
    --secondary-color: #333333;
    --text-color: #4a4a4a;
    --bg-light: #f8f9fa;
    --bg-dark: #222222;
    --white: #ffffff;
    --border-color: #e2e2e2;
    --font-main: 'Inter', Arial, sans-serif;
    --container-width: 1200px;
}

/* --- Base --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    font-family: var(--font-main);
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--white);
    margin: 0;
    padding: 0;
    overflow-x: clip;
    /* Fix for horizontal scroll while keeping sticky position */
    overflow-wrap: break-word;
    word-wrap: break-word;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s;
    overflow-wrap: break-word;
    /* Prevent long URLs from breaking layout */
}

a:hover {
    color: #a00d15;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--secondary-color);
    margin-top: 0;
}

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

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 15px;
}

.section-padding {
    padding: 60px 0;
}

.bg-light {
    background-color: var(--bg-light);
}

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

.text-white {
    color: var(--white);
}

.text-white h2 {
    color: var(--white);
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
}

.btn-primary:hover {
    background-color: #a00d15;
    color: var(--white);
}

/* --- Header --- */
.site-header {
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-main {
    background-color: #0085c8;
    /* Blue brand color */
    padding: 15px 0;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.admin-bar .header-main {
    top: 32px;
}

.header-main .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.site-branding {
    flex: 0 0 220px;
}

.site-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.site-title a {
    color: var(--white);
}

.site-description {
    margin: 0;
    font-size: 13px;
    color: #e0e0e0;
}

.header-search {
    flex: 1 1 auto;
    max-width: 650px;
    /* Thicken max-width per request */
}

.search-form {
    display: flex;
    width: 100%;
}

.search-field {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 4px 0 0 4px;
    width: 100%;
    min-width: 0;
    outline: none;
    font-size: 15px;
}

.search-submit {
    background: #fff;
    color: #333;
    border: 1px solid #ccc;
    border-left: none;
    padding: 0 15px;
    cursor: pointer;
    border-radius: 0 4px 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.search-submit:hover {
    background: #f1f1f1;
}

.header-right-info {
    flex: 0 0 auto;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.working-hours {
    display: flex;
    align-items: center;
}

.header-nav-area {
    background-color: #f1f1f1;
    border-bottom: 1px solid #ddd;
}

.header-nav-area .container {
    display: flex;
    align-items: stretch;
    padding: 0 15px;
    /* Adjust if the main container already has padding */
}

.category-menu-toggle {
    background-color: #0c4d68;
    color: white;
    display: flex;
    align-items: center;
    padding: 15px 20px;
    font-weight: bold;
    cursor: pointer;
    font-size: 15px;
    min-width: 250px;
}

.category-menu-toggle span {
    flex-grow: 1;
}

.main-navigation {
    display: flex;
    align-items: center;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    height: 100%;
}

.main-navigation li {
    margin: 0;
    display: flex;
    align-items: center;
}

.main-navigation a {
    font-weight: 700;
    color: #111;
    text-transform: uppercase;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.main-navigation a:hover {
    color: var(--primary-color);
}

/* --- Mega Menu Styling --- */
.category-wrapper {
    position: relative;
    z-index: 100;
}

/* Dim overlay when menu is hovered */
body.menu-hovered::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 15;
    /* Below header, above most elements */
    pointer-events: none;
    transition: opacity 0.3s ease;
}

header.site-header {
    position: relative;
    z-index: 20;
    /* Keep header above overlay */
}

.category-mega-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 250px;
    background: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid #ddd;
    border-top: none;
}

.category-wrapper:hover .category-mega-menu {
    opacity: 1;
    visibility: visible;
}

/* Home Page specific: Menu is naturally opened on Desktop */
@media (min-width: 1025px) {
    body.home .category-mega-menu {
        opacity: 1 !important;
        visibility: visible !important;
    }
}

.hero-menu-placeholder {
    display: none;
}

@media (min-width: 1025px) {
    .hero-menu-placeholder {
        display: block;
        flex: 0 0 250px;
        width: 250px;
    }
}

/* Hero Carousel Hover Arrows */
.hero-slider-box .swiper-button-next,
.hero-slider-box .swiper-button-prev {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.hero-slider-box:hover .swiper-button-next,
.hero-slider-box:hover .swiper-button-prev {
    opacity: 1;
    visibility: visible;
}

.mega-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-menu-list>li {
    border-bottom: 1px solid #efefef;
    position: static;
    /* Important for full width mega panel relative to wrapper */
}

.mega-menu-list>li:last-child {
    border-bottom: none;
}

.mega-menu-list>li>a {
    display: block;
    padding: 12px 20px;
    color: #444;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    transition: background 0.2s, color 0.2s;
}

.mega-menu-list>li>a:hover {
    background: #f9f9f9;
    color: #0c4d68;
}

.arrow-right {
    float: right;
    font-size: 16px;
    color: #999;
}

/* Mega Panel Layout */
.mega-panel {
    position: absolute;
    left: 100%;
    top: 0;
    width: 900px;
    min-height: 100%;
    background: #fff;
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #ddd;
    border-left: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 101;
}

.has-mega-panel:hover .mega-panel {
    opacity: 1;
    visibility: visible;
}

.mega-panel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 20px;
    padding: 25px;
}

.mega-col h4 {
    font-size: 15px;
    color: #111;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 5px;
}

.mega-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mega-col ul li {
    margin-bottom: 8px;
}

.mega-col ul li a {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
    text-transform: none;
    font-weight: normal;
}

.mega-col ul li a:hover {
    color: #0c4d68;
}

@media (max-width: 1024px) {
    .category-mega-menu {
        display: none;
    }
}

.header-hotline .hotline-btn {
    background: var(--primary-color);
    color: var(--white);
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: bold;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

.mobile-menu-btn {
    display: none;
}

/* --- Hero Section --- */
.hero-section {
    background-color: var(--bg-dark);
    color: var(--white);
    padding: 100px 0;
    text-align: center;
    background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('../images/hero-bg.jpg');
    background-size: cover;
    background-position: center;
}

.hero-content h1 {
    color: var(--white);
    font-size: 40px;
    margin-bottom: 20px;
}

.hero-content p {
    font-size: 18px;
    margin-bottom: 30px;
}

/* --- Section Titles --- */
.section-title {
    text-align: center;
    font-size: 28px;
    margin-bottom: 40px;
    text-transform: uppercase;
    position: relative;
    padding-bottom: 15px;
    color: #111;
    font-weight: 800;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background-color: var(--primary-color);
}

.section-title.text-left {
    text-align: left;
    font-size: 24px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 10px;
    margin-bottom: 30px;
    position: relative;
}

.section-title.text-left::after {
    content: '';
    position: absolute;
    bottom: -2px;
    /* cover the border bottom */
    left: 0;
    transform: none;
    width: 60px;
    height: 2px;
    background-color: var(--primary-color);
    display: block;
}

/* --- Decorative Titles (Centered with Golden Lines/Icons) --- */
.decorative-title {
    text-align: center;
    position: relative;
    padding-bottom: 25px;
    margin-bottom: 40px;
    font-size: 28px;
    font-weight: 800;
    color: #111;
    text-transform: uppercase;
    border-bottom: none !important;
}

.decorative-title::after {
    content: '';
    position: absolute;
    bottom: 0px;
    left: 50%;
    transform: translateX(-50%);
    width: 250px;
    height: 12px;
    background-image: url('https://kinhphucdat.com/wp-content/uploads/2020/11/bgtitle.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    display: block;
}

/* --- Grids --- */
.category-grid,
.product-grid,
.project-list,
.testimonial-grid {
    display: grid;
    grid-gap: 30px;
}

.category-grid {
    grid-template-columns: repeat(4, 1fr);
}

.product-grid {
    grid-template-columns: repeat(4, 1fr);
}

/* --- Carousels --- */
.product-carousel,
.category-carousel {
    outline: none;
}

.product-carousel .product-card,
.category-carousel .cat-item {
    width: calc(25% - 22.5px);
    margin-right: 30px;
}

/* Style Flickity Buttons */
.flickity-prev-next-button {
    width: 40px;
    height: 40px;
    background: var(--primary-color) !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.flickity-enabled:hover .flickity-prev-next-button {
    opacity: 1;
    visibility: visible;
}

.flickity-prev-next-button .flickity-button-icon {
    fill: white !important;
}

.flickity-prev-next-button:hover {
    background: #a00d15 !important;
}

/* Responsive */
@media (max-width: 1024px) {

    .product-carousel .product-card,
    .category-carousel .cat-item {
        width: calc(33.333% - 20px);
    }
}

@media (max-width: 768px) {

    .product-carousel .product-card,
    .category-carousel .cat-item {
        width: calc(50% - 15px);
    }
}

@media (max-width: 480px) {

    .product-carousel .product-card,
    .category-carousel .cat-item {
        width: 100%;
        margin-right: 0;
    }
}

.project-list {
    grid-template-columns: repeat(3, 1fr);
}

.testimonial-grid {
    grid-template-columns: repeat(2, 1fr);
}

/* --- Cards --- */
.cat-item,
.product-card,
.project-item {
    background: var(--white);
    border: 1px solid var(--border-color);
    padding: 15px;
    text-align: center;
    border-radius: 4px;
    position: relative;
    top: 0;
    transition: top 0.3s, box-shadow 0.3s;
}

.cat-item:hover,
.product-card:hover,
.project-item:hover {
    top: -5px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.product-card h4,
.cat-item h3 {
    margin-top: 15px;
    margin-bottom: 15px;
    font-size: 16px;
    line-height: 1.5;
    height: 48px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-card img,
.cat-item img,
.cat-bg {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
    border-radius: 2px;
    margin-bottom: 15px;
}

/* --- Project Overlay Style --- */
.project-item.project-item-custom {
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    transition: box-shadow 0.3s, top 0.3s;
    overflow: hidden;
}

.project-item.project-item-custom:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    top: -5px;
}

.project-bg-img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.project-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(17, 54, 88, 0.85);
    padding: 15px;
    text-align: center;
    transition: background 0.3s;
}

.project-item-custom:hover .project-overlay {
    background: rgba(14, 45, 75, 0.95);
}

.project-title {
    color: var(--white);
    font-size: 16px;
    font-weight: bold;
    margin: 0;
    line-height: 1.4;
}

.decorative-title.text-white {
    color: var(--white);
}

/* --- Footer Styling --- */
.site-footer {
    background-color: rgb(0, 77, 101);
    color: #ffffff;
    font-size: 14px;
    line-height: 1.6;
}

.footer-main {
    padding: 60px 0 40px;
}

.footer-row {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.footer-col-1 {
    flex: 1 1 25%;
}

.footer-col-2 {
    flex: 1 1 30%;
}

.footer-col-3 {
    flex: 1 1 25%;
}

.footer-col-4 {
    flex: 0 1 10%;
}

.footer-logo {
    max-width: 150px;
    margin-bottom: 20px;
}

.footer-title {
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 15px;
    line-height: 1.4;
}

.footer-desc {
    color: #ffffff;
    font-size: 13px;
    margin-bottom: 0;
}

.footer-heading {
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.footer-contact-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-contact-list li {
    margin-bottom: 15px;
    font-size: 14px;
}

.footer-contact-list li strong {
    font-weight: 700;
}

.footer-menu-list {
    list-style: none;
    padding: 0;
    margin: 0 0 25px;
}

.footer-menu-list li {
    margin-bottom: 12px;
}

.footer-menu-list a {
    color: #ffffff;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-menu-list a:hover {
    color: #ffd000;
}

.footer-bct-img {
    max-width: 200px;
}

.social-icons {
    display: flex;
    gap: 15px;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #ffffff;
    border-radius: 4px;
    color: #ffffff;
    transition: all 0.3s;
}

.social-icon:hover {
    background-color: #ffffff;
    color: #0b506d;
}

.site-info-bottom {
    background-color: #00364a;
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
    color: #ffffff;
}

.site-info-bottom p {
    margin: 0;
    line-height: 1.6;
}

@media (max-width: 991px) {

    .footer-col-1,
    .footer-col-2,
    .footer-col-3 {
        flex: 1 1 45%;
    }

    .footer-col-4 {
        flex: 1 1 100%;
        justify-content: center;
        display: flex;
    }
}

@media (max-width: 768px) {

    .footer-col-1,
    .footer-col-2,
    .footer-col-3 {
        flex: 1 1 100%;
    }
}

/* --- Misc --- */
.testimonial-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 8px;
    font-style: italic;
}

/* --- Footer --- */
.footer-widget-area {
    display: grid;
    grid-template-columns: 2fr 1fr;
    grid-gap: 40px;
    padding: 50px 0;
}

.footer-widget h4 {
    color: var(--white);
    margin-bottom: 20px;
}

.footer-widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-widget ul li {
    margin-bottom: 10px;
}

.footer-widget ul li a {
    color: #ccc;
}

.footer-widget ul li a:hover {
    color: var(--primary-color);
}

.site-info {
    background-color: #1a1a1a;
    padding: 20px 0;
    text-align: center;
    font-size: 14px;
}

.site-info p {
    margin: 0;
}

/* --- Archive / Category Page Layout --- */
.page-layout-sidebar {
    display: flex;
    flex-wrap: nowrap;
    gap: 30px;
    margin-top: 20px;
}

.page-layout-sidebar .sidebar-left {
    flex: 0 0 250px;
    max-width: 250px;
}

.page-layout-sidebar .main-content-area {
    flex: 1;
    min-width: 0;
}

@media (max-width: 1024px) {
    .page-layout-sidebar {
        flex-direction: column;
    }

    .page-layout-sidebar .sidebar-left {
        flex: 1 1 auto;
        max-width: 100%;
    }
}

/* --- Single Product Page Layout --- */
.product-page-layout {
    display: grid;
    grid-template-columns: 3fr 1fr;
    grid-gap: 30px;
    margin-top: 20px;
    min-width: 0;
}

.product-page-layout>div,
.product-main-area {
    min-width: 0;
}

.product-main-area {
    background: var(--white);
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.05);
}

.product-top-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 20px;
    margin-bottom: 30px;
    min-width: 0;
}

.product-top-box>div {
    min-width: 0;
}

.product-gallery img {
    width: 100%;
    height: auto;
    border: 1px solid var(--border-color);
    padding: 5px;
}

.product-img-placeholder {
    width: 100%;
    height: 300px;
    background: #e2e2e2;
    border: 1px solid var(--border-color);
}

.breadcrumbs {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
    font-weight: bold;
    text-transform: uppercase;
}

.product-entry-title {
    font-size: 26px;
    margin-bottom: 20px;
}

.btn-quote {
    background-color: #1a73e8;
    /* Blue button like screenshot */
    color: white;
    display: block;
    width: 100%;
    box-sizing: border-box;
    /* Fix overflow */
    text-align: center;
    padding: 12px;
    font-size: 16px;
}

.btn-quote:hover {
    background-color: #1557b0;
    color: white;
}

.tab-title {
    font-size: 18px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.product-details-content {
    margin-top: 40px;
}

/* --- Custom Sidebar Widget --- */
.custom-widget {
    background: var(--white);
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
    border-radius: 2px;
}

.custom-widget .widget-title {
    background-color: #1a9bdc;
    /* Light Blue like screenshot */
    color: var(--white);
    margin: 0;
    padding: 15px;
    font-size: 16px;
    text-align: center;
    text-transform: uppercase;
}

.custom-widget .widget-content {
    padding: 15px;
}

.product-widget-list,
.post-widget-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.product-widget-list li {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.product-widget-list li:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.widget-item-link {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.widget-item-img {
    width: 70px;
    flex-shrink: 0;
}

.widget-item-img img {
    border: 1px solid #ddd;
    width: 100%;
    height: auto;
}

.placeholder-thumb {
    width: 70px;
    height: 70px;
    background: #eee;
}

.widget-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--secondary-color);
    line-height: 1.4;
}

.post-widget-list li {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #eee;
}

.post-widget-list li a {
    color: var(--text-color);
    font-weight: bold;
    font-size: 13px;
    text-transform: uppercase;
}

.post-widget-list li a:hover {
    color: #1a9bdc;
}

/* ==========================================================================
   Contact Page Layout (page-lien-he.php)
   ========================================================================== */
.lien-he-breadcrumb {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 40px;
    color: #666;
}

.lien-he-breadcrumb a {
    color: #000;
    text-decoration: none;
}

.lien-he-breadcrumb span {
    color: #666;
}

.contact-page-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 50px;
    margin-bottom: 60px;
}

.contact-info-col,
.contact-form-col {
    flex: 1;
    min-width: 320px;
}

.contact-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 25px;
    color: #000;
    text-transform: uppercase;
}

.contact-info-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.contact-info-list li {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #333;
    display: flex;
    align-items: flex-start;
    line-height: 1.5;
}

.contact-info-list li i {
    width: 25px;
    font-size: 18px;
    margin-top: 2px;
    margin-right: 5px;
    color: #333;
    text-align: center;
}

.contact-info-list li a {
    color: #008ac8;
    text-decoration: none;
}

.contact-map-full {
    margin-bottom: 40px;
}

/* ==========================================================================
   Contact Form Styles (Light Theme - Exact Match)
   ========================================================================== */
.contact-form-col {
    background-color: transparent;
    padding: 20px 0;
}

.wpcf7 .form-lien-he h2 {
    color: #000000;
    margin-bottom: 25px !important;
    text-transform: uppercase;
    font-size: 26px;
    font-weight: 800;
    font-family: Arial, Roboto, sans-serif;
    text-align: center;
    padding-top: 0;
}

.wpcf7 .form-lien-he p.wpcf7_des {
    display: none;
}

.row_1,
.row_2 {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

/* Fix thẻ p của CF7 */
.wpcf7 .form-lien-he .row_1 p,
.wpcf7 .form-lien-he .row_2 p {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin: 0;
}

/* Ẩn các thẻ br hoặc p rác do CF7 tự động sinh ra gây vỡ layout */
.wpcf7 .form-lien-he .row_1 br,
.wpcf7 .form-lien-he .row_2 br {
    display: none !important;
}

/* Đảm bảo khung ngoài cùng chia tỷ lệ 50%, khung wpcf7 bên trong full 100% để input bung ra hết cỡ */
.wpcf7 .form-lien-he .row_1>span,
.wpcf7 .form-lien-he .row_2>span,
.wpcf7 .form-lien-he .row_1 p>span,
.wpcf7 .form-lien-he .row_2 p>span {
    width: calc(50% - 10px) !important;
    display: inline-block;
    vertical-align: top;
}

.wpcf7 .form-lien-he .row_1 span.wpcf7-form-control-wrap,
.wpcf7 .form-lien-he .row_2 span.wpcf7-form-control-wrap {
    width: 100% !important;
    display: block;
}

.form-lien-he input[type="text"],
.form-lien-he input[type="email"],
.form-lien-he input[type="tel"],
.form-lien-he textarea {
    width: 100%;
    background: #f2f2f2;
    border: 1px solid #a3a3a3;
    color: #000;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 700;
    outline: none;
    box-sizing: border-box;
}

.form-lien-he input[type="text"]::placeholder,
.form-lien-he input[type="email"]::placeholder,
.form-lien-he input[type="tel"]::placeholder,
.form-lien-he textarea::placeholder {
    color: #000;
    font-weight: 700;
}

.form-lien-he input {
    height: 55px;
}

.form-lien-he textarea {
    min-height: 55px;
    height: 55px;
    resize: none;
    padding-top: 16px;
}

/* Hình dáng ô vuông vức và bo cong đặc biệt như ảnh gửi */
.form-lien-he .your-name input {
    border-radius: 0;
}

.form-lien-he .your-email input {
    border-radius: 0;
}

.form-lien-he .your-phone input {
    border-radius: 0;
}

.form-lien-he .your-message textarea {
    border-radius: 0 25px 25px 0;
    /* Chỉ bo cong viền bên phải */
}

.form-lien-he p:last-of-type {
    margin-top: 25px;
    text-align: left !important;
    /* Ép nút căn trái */
}

.form-lien-he input[type='submit'] {
    background-color: #d1a670 !important;
    color: #000;
    border: 1px solid #8e6c43;
    padding: 0;
    height: 50px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 800;
    font-size: 18px;
    transition: all 0.3s ease;
    display: inline-block;
    width: calc(50% - 10px);
    /* Bằng chính xác độ rộng của ô nhập liệu bên trái */
}

.form-lien-he input[type='submit']:hover {
    background-color: #bfa170 !important;
}

/* ==========================================================================
   Floating Contact Buttons (Zalo & Phone)
   ========================================================================== */
.floating-contact {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.f-btn {
    position: relative;
    width: 40px;
    height: 40px;
    text-decoration: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.f-icon {
    width: 100%;
    height: 100%;
    background-color: #0088FF;
    /* Zalo Blue */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.phone-btn .f-icon {
    background-color: #3b82f6;
}

.zalo-btn .f-icon {
    background-color: transparent !important;
    /* Zalo Png already has background */
    box-shadow: none;
}

.zalo-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    animation: icon-shake 1s infinite;
    filter: saturate(2) brightness(0.95) contrast(1.1);
    /* Tăng đậm màu Zalo lên rõ hơn */
}

.phone-btn img {
    width: 60%;
    height: 60%;
    object-fit: contain;
    animation: icon-shake 1s infinite;
}

.f-ring {
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 50%;
    background-color: rgba(33, 150, 243, 0.5);
    z-index: 1;
    animation: pulse-ring 1.5s infinite;
}

.phone-btn .f-ring {
    background-color: rgba(59, 130, 246, 0.4);
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    100% {
        transform: scale(1.3);
        opacity: 0;
    }
}

@keyframes icon-shake {

    0%,
    100% {
        transform: rotate(0) scale(1) skew(1deg);
    }

    10% {
        transform: rotate(-25deg) scale(1) skew(1deg);
    }

    20% {
        transform: rotate(25deg) scale(1) skew(1deg);
    }

    30% {
        transform: rotate(-25deg) scale(1) skew(1deg);
    }

    40% {
        transform: rotate(25deg) scale(1) skew(1deg);
    }

    50% {
        transform: rotate(0) scale(1) skew(1deg);
    }
}

/* ==========================================================================
   Home Intro Section (Giới thiệu)
   ========================================================================== */
.home-intro-section {
    background: url('https://kinhphucdat.com/wp-content/uploads/2020/11/bg-pattern.png');
}

.intro-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 40px;
}

.intro-left,
.intro-right {
    flex: 1 1 45%;
    min-width: 300px;
}

.intro-subtitle {
    font-family: serif;
    font-size: 32px;
    color: #555;
    margin-bottom: 5px;
    text-align: center;
}

.intro-main-title {
    font-size: 24px;
    font-weight: 800;
    color: #0f3d61;
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 25px;
}

.intro-desc {
    color: #444;
    font-size: 15px;
    line-height: 1.8;
    text-align: justify;
    margin-bottom: 25px;
}

.intro-btn {
    display: inline-block;
    padding: 10px 35px;
    border: 2px solid #0f3d61;
    color: #0f3d61;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 25px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.intro-btn:hover {
    background-color: #0f3d61;
    color: #ffffff;
}

/* Image Section Layout */
.intro-right {
    position: relative;
    padding: 20px 40px 40px 20px;
}

.intro-frame {
    position: absolute;
    top: 40px;
    right: 0;
    bottom: 0;
    left: 40px;
    border: 3px solid #0085c8;
    z-index: 1;
}

.intro-images {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: flex-start;
}

.intro-img-1 {
    width: 60%;
    z-index: 3;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 4px solid #fff;
}

.intro-img-2 {
    width: 55%;
    margin-left: -15%;
    margin-top: 15%;
    z-index: 2;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border: 4px solid #fff;
}

@media (max-width: 768px) {
    .intro-right {
        padding: 10px 20px 20px 10px;
    }

    .intro-frame {
        top: 20px;
        left: 20px;
        border-width: 2px;
    }

    .intro-img-2 {
        margin-top: 10%;
    }
}

/* ==========================================================================
   Table of Contents (Mục lục bài viết - Plugin: Easy TOC / TOC+)
   ========================================================================== */
#ez-toc-container,
#toc_container {
    background: #ffffff !important;
    border: 1px solid #1ca0e3 !important;
    border-radius: 0 !important;
    padding: 15px 20px !important;
    margin-bottom: 30px !important;
    width: auto !important;
    max-width: 100% !important;
    box-shadow: none !important;
    display: inline-block;
}

#ez-toc-container .ez-toc-title,
#toc_container .toc_title {
    font-size: 18px !important;
    font-weight: bold !important;
    color: #1ca0e3 !important;
}

.ez-toc-toggle a,
#toc_container .toc_toggle a {
    color: #1ca0e3 !important;
    font-size: 14px !important;
    font-weight: normal !important;
}

#ez-toc-container ul.ez-toc-list a,
#toc_container ul.toc_list a {
    color: #1ca0e3 !important;
    text-decoration: none !important;
    font-size: 15px !important;
    line-height: 1.8 !important;
    font-weight: bold !important;
    padding: 4px 0 !important;
}

#ez-toc-container ul.ez-toc-list a:hover,
#toc_container ul.toc_list a:hover {
    color: #0f3d61 !important;
    text-decoration: underline !important;
}

/* ==========================================================================
   Responsive Design (Mobile & Tablet)
   ========================================================================== */
@media (max-width: 1024px) {

    /* Header / Menu */
    .header-main .container {
        position: relative;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0;
    }

    .mobile-menu-btn {
        display: block;
        position: absolute;
        left: 15px;
        top: 15px;
        background: #0c4d68;
        color: white;
        border: none;
        padding: 8px 10px;
        border-radius: 4px;
        cursor: pointer;
        z-index: 10;
    }

    .mobile-menu-btn svg {
        display: block;
        width: 20px;
        height: 20px;
    }

    .site-branding {
        text-align: center;
        flex: 0 0 auto;
        height: auto;
        margin: 0 auto;
        padding-top: 5px;
    }

    .header-search {
        display: none !important;
    }

    .header-nav-area .container {
        flex-wrap: wrap;
    }

    .category-wrapper {
        display: none !important;
    }

    .main-navigation {
        display: none;
        width: 100%;
        margin-top: 15px;
    }

    .main-navigation ul {
        flex-direction: column;
    }

    .main-navigation li {
        margin: 10px 0;
        border-bottom: 1px solid #eee;
        padding-bottom: 10px;
    }

    .menu-toggle {
        display: block;
        margin: 10px 0;
    }

    .main-navigation.is-open {
        display: block;
    }

    /* Layout */
    .category-grid,
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .project-list {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Single Product - Collapse strictly at Tablet level */
    .product-page-layout {
        grid-template-columns: 1fr !important;
    }

    .product-top-box {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {

    /* Hide top elements */
    .top-bar-left {
        display: none;
    }

    .header-hotline {
        display: none;
    }

    /* Layout reductions */
    .category-grid,
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .project-list {
        grid-template-columns: repeat(2, 1fr);
    }

    .testimonial-grid {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .footer-widget-area {
        display: flex;
        flex-direction: column;
        gap: 30px;
    }

    /* Global Space */
    .hero-section {
        padding: 60px 0;
    }

    .hero-content h1 {
        font-size: 30px;
    }

    .hero-content p {
        font-size: 16px;
    }

    .section-padding {
        padding: 40px 0;
    }

    .section-title {
        font-size: 24px;
        margin-bottom: 30px;
    }
}

@media (max-width: 576px) {

    /* 1 Column for all grids on Phones */
    .category-grid,
    .product-grid,
    .project-list {
        grid-template-columns: 1fr;
    }

    /* Further font resizing */
    .hero-content h1 {
        font-size: 26px;
        margin-bottom: 15px;
    }

    .section-title {
        font-size: 20px;
    }
}

/* --- Mobile Off-Canvas Menu --- */
#phucdat-mobile-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 350px;
    height: 100vh;
    background: #eef8fc;
    z-index: 10000;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
}

#phucdat-mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: none;
}

#phucdat-mobile-close {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 10001;
    color: #fff;
    cursor: pointer;
    display: none;
}

.mobile-search-area {
    padding: 20px 15px;
    background: #fff;
}

.mobile-search-area form {
    display: flex;
}

.mobile-search-area input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 20px 0 0 20px;
    outline: none;
}

.mobile-search-area button {
    background: #0c4d68;
    color: white;
    border: none;
    padding: 0 15px;
    border-radius: 0 20px 20px 0;
    cursor: pointer;
}

.mobile-main-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #fff;
}

.mobile-main-nav li {
    border-bottom: 1px solid #eee;
}

.mobile-main-nav a {
    display: block;
    padding: 15px 20px;
    color: #111;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 13px;
    text-decoration: none;
}

.mobile-cat-title {
    background: #0c4d68;
    color: white;
    font-weight: bold;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-transform: uppercase;
}

.mobile-cat-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f9f9f9;
}

.mobile-cat-nav li {
    border-bottom: 1px solid #eee;
}

.mobile-cat-nav a {
    display: block;
    padding: 12px 20px;
    color: #444;
    font-size: 14px;
    text-decoration: none;
}

.mobile-cat-nav .mega-panel {
    position: static;
    width: 100%;
    opacity: 1;
    visibility: visible;
    box-shadow: none;
    border: none;
    padding: 0;
    display: none;
    transition: none;
    background: #f1f1f1;
}

.mobile-cat-nav .mega-panel-grid {
    grid-template-columns: 1fr;
    padding: 15px 20px;
    grid-gap: 15px;
}

.mobile-cat-nav .mega-col {
    margin-bottom: 5px;
}

.mobile-cat-nav .has-mega-panel > a {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-search-area .search-submit {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================================
   7. Quote Popup Modal & CF7 Form
   ========================================================================= */
.quote-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    display: none;
}

.quote-modal-overlay.is-visible {
    display: flex;
}

.quote-modal-content {
    background: var(--white);
    width: 90%;
    max-width: 750px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    animation: quoteModalSlideIn 0.3s ease-out forwards;
}

.quote-modal-overlay.is-hiding .quote-modal-content {
    animation: quoteModalSlideOut 0.3s ease-in forwards;
}

@keyframes quoteModalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes quoteModalSlideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(50px);
        opacity: 0;
    }
}

.quote-modal-header {
    background: linear-gradient(to bottom, #c69a39 0%, #c19a4b 100%);
    padding: 10px 15px;
    min-height: 42px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
    gap: 10px;
}

.quote-modal-header h3 {
    margin: 0;
    font-size: 15px;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.4;
    flex: 1;
    /* Allow stretching while leaving room for the close button */
}

.quote-modal-header h3 span {
    font-weight: normal;
}

.quote-modal-close {
    background: #fff;
    border: none;
    color: #c69a39;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    padding: 0;
    transition: transform 0.3s ease;
}

.quote-modal-close:hover {
    transform: rotate(90deg);
}

.quote-modal-body {
    padding: 15px 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.quote-product-top {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    margin-bottom: 15px;
}

.quote-col-left .quote-product-img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 4px;
    flex-shrink: 0;
}

.quote-col-left h4 {
    font-size: 16px;
    margin: 0;
    color: #333;
    line-height: 1.4;
    font-weight: bold;
}

.quote-col-left p {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

.cf7-quick-buy-form h4 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #222;
}

.cf7-quick-buy-form br {
    display: none !important;
}

.cf7-quick-buy-form p {
    margin: 0 !important;
    padding: 0 !important;
}

.cf7-quick-buy-form .wpcf7-form-control-wrap {
    margin: 0 !important;
    display: block;
}

.cf7-qb-row {
    margin-bottom: 6px;
}

.cf7-qb-row.radio-row {
    margin-bottom: 10px;
}

.cf7-qb-row.radio-row .wpcf7-list-item {
    margin-right: 20px;
    display: inline-flex;
    align-items: center;
}

.cf7-qb-row.radio-row .wpcf7-list-item input {
    margin-right: 5px;
    margin-bottom: 0 !important;
}

.quote-placeholder-img {
    display: none;
}

.cf7-qb-row.cols-2 {
    width: 100%;
}

.cf7-qb-row.cols-2>p,
.cf7-qb-row.cols-2:not(:has(p)) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 0;
}

.cf7-qb-row.cols-2 br {
    display: none;
}

.cf7-qb-row input[type="text"],
.cf7-qb-row input[type="tel"],
.cf7-qb-row input[type="email"],
.cf7-qb-row textarea {
    width: 100%;
    height: 30px;
    padding: 2px 8px;
    border: 1px solid #ccc;
    border-radius: 2px;
    font-size: 12px;
    transition: border-color 0.3s;
    color: #333;
    margin-bottom: 0 !important;
    box-shadow: none !important;
}

.cf7-qb-row input:focus,
.cf7-qb-row textarea:focus {
    border-color: #c69a39;
    outline: none;
}

.cf7-qb-row textarea {
    height: 60px;
    resize: vertical;
}

.cf7-qb-total {
    font-size: 13px;
    color: #333;
    margin-top: 10px;
    margin-bottom: 10px;
}

.cf7-qb-total strong {
    font-size: 14px;
}

.btn-submit-quick-buy {
    background-color: #c69a39;
    color: #fff;
    border: none;
    width: 100%;
    height: 36px;
    line-height: 36px;
    padding: 0;
    font-size: 14px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-submit-quick-buy:hover {
    background-color: #b08730;
}

.wpcf7-spinner {
    display: none !important;
    /* Hide CF7 spinner to keep it clean */
}

.wpcf7-not-valid-tip {
    font-size: 12px;
    color: red;
    margin-top: 5px;
    display: block;
}

@media (max-width: 767px) {
    .quote-modal-body {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: 15px;
    }

    .quote-col-left {
        border-bottom: 1px solid #ddd;
        padding-bottom: 15px;
    }
}

@media (max-width: 1024px) {
    .header-right-info {
        display: none !important;
    }
}

/* ==========================================================================
   Home Hero Section (Decoupled & Modernized)
   ========================================================================== */
.home-top-section {
    padding-top: 15px;
}

.hero-container {
    display: flex;
    gap: 15px;
}

.hero-slider-box {
    flex: 1;
    min-width: 0;
    border-radius: 8px;
    overflow: hidden;
    background: transparent;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.hero-banner-img {
    width: 100%;
    height: 390px;
    object-fit: cover;
    display: block;
}

@media (max-width: 768px) {
    .hero-slider-box {
        margin-bottom: 20px;
    }
    .hero-banner-img {
        height: auto;  /* Allows the image to scale proportionally without cropping */
        object-fit: contain;
    }
}

.hero-slide {
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
    text-align: left;
}

.hero-content {
    max-width: 600px;
}

.hero-title {
    color: var(--white);
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 15px;
    line-height: 1.3;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.hero-desc {
    color: var(--white);
    font-size: 16px;
    margin-bottom: 25px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.btn-hero {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 12px 30px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 16px;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    display: inline-block;
    transition: background 0.3s, transform 0.3s;
}

.btn-hero:hover {
    background-color: #a00d15;
    color: var(--white);
    transform: translateY(-2px);
}

/* ==========================================================================
   Utility Blocks & Placeholders
   ========================================================================== */
.cat-placeholder-bg {
    background-color: #eee;
    margin-bottom: 15px;
}

.placeholder-product-img {
    background-color: #ccc;
    height: 200px;
}

.placeholder-project-img {
    background: #ccc;
}

/* --- Featured Projects --- */
.featured-projects {
    background: linear-gradient(rgba(30, 60, 90, 0.6), rgba(30, 60, 90, 0.6)), url('https://kinhphucdat.com/wp-content/uploads/2020/11/bg2.jpg') center/cover no-repeat;
    background-attachment: fixed;
}

.border-bottom-none {
    border-bottom: none !important;
}

.testi-author {
    margin-top: 20px;
    color: var(--primary-color);
}

.bg-transparent {
    background: transparent !important;
}

.post-card-link {
    display: block;
    margin-bottom: 20px;
}

.post-card-img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    border-radius: 4px;
    /* Slight rounding for cohesion */
}

.post-card-content {
    padding: 0 10px;
}

.post-card-title {
    font-size: 15px;
    margin: 0;
    line-height: 1.5;
    text-transform: uppercase;
    font-weight: bold;
}

.post-card-title a {
    color: #0f3d61;
    text-decoration: none;
    transition: color 0.3s;
}

.post-card-title a:hover {
    color: var(--primary-color);
}

/* ==========================================================================
   WordPress Core Image & Gallery Fallbacks
   ========================================================================== */
.alignnone {
    margin: 5px 20px 20px 0;
    display: inline-block;
}

.alignright {
    float: right;
    margin: 5px 0 20px 20px;
}

.alignleft {
    float: left;
    margin: 5px 20px 20px 0;
}

.aligncenter,
div.aligncenter,
img.aligncenter,
figure.aligncenter {
    display: block;
    margin: 10px auto;
    text-align: center;
    clear: both;
}

a img.alignright {
    float: right;
    margin: 5px 0 20px 20px;
}

a img.alignnone {
    margin: 5px 20px 20px 0;
}

a img.alignleft {
    float: left;
    margin: 5px 20px 20px 0;
}

a img.aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Clear floats after WP alignments */
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6,
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6,
h1,
h2,
h3,
h4,
h5,
h6 {
    clear: both;
}

/* Classic Editor Gallery */
.gallery {
    margin-bottom: 1.5em;
    display: grid;
    grid-template-columns: repeat(var(--gallery-columns, 3), 1fr);
    grid-gap: 15px;
    clear: both;
    /* Prevent text floating next to gallery */
}

.gallery br {
    display: none !important;
    /* Hide old WP br clears that break CSS grid */
}

.gallery::after {
    content: "";
    display: table;
    clear: both;
}

.gallery .gallery-item {
    display: block !important;
    text-align: center;
    width: 100% !important;
    margin-top: 0 !important;
    /* override inline wp float margin */
    float: none !important;
    /* override inline wp float */
}

.gallery .gallery-icon img {
    border: none !important;
    max-width: 100%;
    height: auto;
    object-fit: cover;
}

.gallery .gallery-caption {
    font-size: 0.9em;
    color: #777;
    margin-top: 5px;
}

/* Gutenberg Editor Gallery */
.wp-block-gallery {
    display: flex;
    flex-wrap: wrap;
    list-style-type: none;
    padding: 0;
    gap: 15px;
    clear: both;
}

.wp-block-gallery .wp-block-image {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    margin: 0;
}

.wp-block-gallery .wp-block-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* WP Captions */
.wp-caption {
    max-width: 100%;
    clear: both;
}

.wp-caption-text {
    text-align: center;
    font-size: 14px;
    font-style: italic;
    color: #666;
    margin: 5px 0 15px;
}

/* --- Page Layouts & Sidebar --- */
.page-layout-sidebar {
    display: flex;
    gap: 30px;
}

.sidebar-left {
    flex: 0 0 280px;
}

.main-content-area {
    flex: 1 1 auto;
    min-width: 0;
}

.sidebar-widget {
    margin-bottom: 30px;
    border-radius: 4px;
    overflow: hidden;
}

.widget-title {
    background: var(--primary-color);
    padding: 12px 15px;
    color: var(--white);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 16px;
}

.widget-content {
    background: #fff;
    padding: 15px;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-top: none;
}

.category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-list li {
    border-bottom: 1px solid #333;
}

.category-list li:last-child {
    border-bottom: none;
}

.category-list a {
    display: block;
    padding: 10px 0;
    color: #ddd;
    text-decoration: none;
    transition: color 0.3s;
}

.category-list a:hover {
    color: var(--primary-color);
}

.page-header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--primary-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.page-title {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0;
    text-transform: uppercase;
}

.product-count {
    font-size: 14px;
    color: #666;
}

/* --- Breadcrumb --- */
.lien-he-breadcrumb,
.site-breadcrumb {
    padding: 15px 0;
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
}

.site-breadcrumb a,
.lien-he-breadcrumb a {
    color: var(--secondary-color);
    font-weight: 500;
}

.site-breadcrumb a:hover,
.lien-he-breadcrumb a:hover {
    color: var(--primary-color);
}

/* --- Entry Content (Pages & Posts) --- */
.entry-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.entry-title {
    font-size: 32px;
    color: var(--secondary-color);
    margin: 0;
}

.entry-content {
    line-height: 1.8;
    color: var(--text-color);
    font-size: 16px;
}

.entry-content img {
    border-radius: 4px;
}

.empty-results {
    padding: 20px;
    background: #fff;
    border: 1px solid #eee;
}

/* --- Post Grid --- */
.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 30px;
}

.post-grid .project-item {
    padding: 15px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.post-grid .entry-header {
    margin-top: 15px;
    text-align: left;
    border: none;
    padding: 0;
}

.post-grid .entry-title {
    font-size: 18px;
    margin-bottom: 10px;
}

.post-grid .entry-title a {
    color: var(--secondary-color);
}

.post-grid .entry-content {
    text-align: left;
    font-size: 14px;
    line-height: 1.5;
}

@media (max-width: 992px) {
    .post-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-layout-sidebar {
        flex-direction: column;
    }

    .sidebar-left {
        flex: none;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .post-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Search and Generic Layouts --- */
.search-item-page {
    grid-column: 1 / -1;
    border: 1px solid var(--primary-color);
    padding: 40px 30px;
    margin-bottom: 10px;
    background: var(--bg-light);
}

.search-item-page h2 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
}

.search-item-page h2 a {
    color: var(--secondary-color);
}

.sidebar-right {
    flex: 0 0 280px;
}

.widget-title-blue {
    background: #0a82c4;
    padding: 12px 15px;
    color: var(--white);
    font-weight: bold;
    text-transform: uppercase;
    text-align: center;
    font-size: 15px;
}

.widget-content-bordered {
    border: 1px solid var(--border-color);
    border-top: none;
    padding: 0;
}

.widget-content-bordered ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.widget-content-bordered li {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding: 10px;
}

.featured-thumb {
    flex: 0 0 60px;
    max-width: 60px;
    margin-right: 12px;
}

.featured-thumb img {
    border-radius: 4px;
}

.featured-info h4 {
    margin: 0;
    font-size: 13px;
    font-weight: bold;
}

.featured-info h4 a {
    color: var(--secondary-color);
}

.post-list-widget li {
    display: block;
    padding: 15px;
}

.post-list-widget h4 {
    margin: 0;
    font-size: 14px;
    font-weight: bold;
    line-height: 1.5;
    text-transform: uppercase;
}
.post-list-widget h4 a {
    color: #111;
    text-decoration: none;
    transition: color 0.3s;
}
.post-list-widget h4 a:hover {
    color: var(--primary-color);
}