/* ─── Product Category Shop Layout ───────────────────────────────────────────
 * Used for depth-2+ (cấp 3+) taxonomy archive pages.
 * Layout: hero banner → breadcrumb → sidebar (left) + product grid (right).
 * ─────────────────────────────────────────────────────────────────────────── */

/* ─── Hero Banner ─────────────────────────────────────────────────────────── */

#wrapper .pcat-shop-hero {
    position: relative;
    width: 100%;
    height: 300px;
    background: #0b183e;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#wrapper .pcat-shop-hero__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#wrapper .pcat-shop-hero__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

#wrapper .pcat-shop-hero__title {
    font-size: 40px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
    margin: 0;
    text-align: center;
    position: relative;
    z-index: 2;
    padding: 0 24px;
}

/* ─── Main Layout (sidebar + grid) ───────────────────────────────────────── */

#wrapper .pcat-shop-layout {
    display: flex;
    gap: 32px;
    padding: 48px 0;
    align-items: flex-start;
}

/* ─── Sidebar ─────────────────────────────────────────────────────────────── */

#wrapper .pcat-shop-sidebar {
    width: 240px;
    flex-shrink: 0;
}

#wrapper .pcat-shop-sidebar__title {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    background: #0b183e;
    padding: 13px 20px;
    margin: 0;
    border: 1px solid #e0e0e0;
    letter-spacing: 0.02em;
}

#wrapper .pcat-shop-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid #e0e0e0;
    border-top: none;
}

#wrapper .pcat-shop-nav__item {
    margin-left: 0;
    margin-bottom: 0;
    border-bottom: 1px solid #e0e0e0;
}

#wrapper .pcat-shop-nav__item:last-child {
    border-bottom: none;
}

#wrapper .pcat-shop-nav__link {
    display: block;
    padding: 11px 20px;
    font-size: 14px;
    color: #333333;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    cursor: pointer;
    line-height: 1.4;
}

#wrapper .pcat-shop-nav__link:hover {
    background: #f0f5ff;
    color: #0b183e;
    text-decoration: none;
}

#wrapper .pcat-shop-nav__link.is-active {
    background: #0b183e;
    color: #ffffff;
    font-weight: 600;
}

/* ─── Main Products Area ─────────────────────────────────────────────────── */

#wrapper .pcat-shop-main {
    flex: 1;
    min-width: 0;
    position: relative;
}

/* Loading overlay — shown while AJAX request is in flight */
#wrapper .pcat-shop-main.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.65);
    z-index: 10;
}

/* Spinner centered on the overlay */
#wrapper .pcat-shop-main.is-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border: 3px solid #e0e0e0;
    border-top-color: #0b183e;
    border-radius: 50%;
    animation: pcat-spin 0.7s linear infinite;
    z-index: 11;
}

@keyframes pcat-spin {
    to { transform: rotate(360deg); }
}

/* ─── Product Grid ────────────────────────────────────────────────────────── */

#wrapper .pcat-shop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    min-height: 200px;
}

/* ─── Product Card ────────────────────────────────────────────────────────── */

#wrapper .pcat-shop-card {
    border: 1px solid #e8e8e8;
    background: #ffffff;
    overflow: hidden;
    transition: box-shadow 0.25s ease;
}

#wrapper .pcat-shop-card:hover {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.09);
}

#wrapper .pcat-shop-card__inner {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

#wrapper .pcat-shop-card__image {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f4f8f6;
    display: flex;
    align-items: center;
    justify-content: center;
}

#wrapper .pcat-shop-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

#wrapper .pcat-shop-card:hover .pcat-shop-card__image img {
    transform: scale(1.05);
}

#wrapper .pcat-shop-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f4f8f6;
}

#wrapper .pcat-shop-card__body {
    padding: 14px 16px 18px;
    text-align: center;
}

#wrapper .pcat-shop-card__name {
    font-size: 18px;
    font-weight: 600;
    color: #0b183e;
    line-height: 1.4;
    margin: 0 0 10px 0;
}

#wrapper .pcat-shop-card__cta {
    display: inline-block;
    font-size: 14px;
    text-transform: none;
    margin: 0;
    color: #0b183e;
    font-weight: 600;
    background: transparent;
    border: 1px solid #0b183e;
    padding: 8px 20px;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

#wrapper .pcat-shop-card:hover .pcat-shop-card__cta {
    background: #0b183e;
    border-color: #0b183e;
    color: #ffffff;
    text-decoration: none;
}

/* ─── Empty State ─────────────────────────────────────────────────────────── */

#wrapper .pcat-shop-empty {
    font-size: 15px;
    color: #666666;
    text-align: center;
    padding: 48px 0;
    grid-column: 1 / -1;
}

/* ─── Pagination ──────────────────────────────────────────────────────────── */

#wrapper .pcat-shop-pagination {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

#wrapper .pcat-shop-pagination__item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid #dce8e2;
    color: #333333;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

#wrapper .pcat-shop-pagination__item:hover,
#wrapper .pcat-shop-pagination__item.is-active {
    background: #0b183e;
    color: #ffffff;
    border-color: #0b183e;
    text-decoration: none;
}

/* ─── Tablet (max-width: 1024px) ──────────────────────────────────────────── */

@media (max-width: 1024px) {
    #wrapper .pcat-shop-sidebar {
        width: 200px;
    }

    #wrapper .pcat-shop-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    #wrapper .pcat-shop-hero__title {
        font-size: 32px;
    }
}

/* ─── Mobile (max-width: 767px) ───────────────────────────────────────────── */

@media (max-width: 767px) {
    #wrapper .pcat-shop-hero {
        height: 200px;
    }

    #wrapper .pcat-shop-hero__title {
        font-size: 26px;
    }

    #wrapper .pcat-shop-layout {
        flex-direction: column;
        padding: 24px 0;
        gap: 0;
    }

    /* Horizontal scrollable pill-style nav on mobile */
    #wrapper .pcat-shop-sidebar {
        width: 100%;
        margin-bottom: 24px;
    }

    #wrapper .pcat-shop-sidebar__title {
        display: none;
    }

    #wrapper .pcat-shop-nav {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        border: none;
        gap: 8px;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }

    #wrapper .pcat-shop-nav__item {
        border-bottom: none;
        flex-shrink: 0;
    }

    #wrapper .pcat-shop-nav__link {
        border: 1px solid #e0e0e0;
        border-radius: 20px;
        padding: 8px 16px;
        font-size: 13px;
        white-space: nowrap;
    }

    #wrapper .pcat-shop-nav__link.is-active {
        border-color: #0b183e;
    }

    #wrapper .pcat-shop-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 480px) {
    #wrapper .pcat-shop-grid {
        grid-template-columns: 1fr;
    }
}

/* ─── Contact Popup ───────────────────────────────────────────────────────── */

#pcat-contact-popup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#pcat-contact-popup.is-open {
    display: flex;
}

.pcat-contact-popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    cursor: pointer;
}

.pcat-contact-popup__modal {
    position: relative;
    background: #ffffff;
    width: 100%;
    max-width: 480px;
    padding: 36px 32px 32px;
    z-index: 1;
    max-height: 90vh;
    overflow-y: auto;
}

.pcat-contact-popup__close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 20px;
    color: #666666;
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    transition: color 0.2s ease;
    font-family: inherit;
}

.pcat-contact-popup__close:hover {
    color: #0b183e;
}

.pcat-contact-popup__product {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e8e8e8;
    margin-bottom: 24px;
}

.pcat-contact-popup__thumb {
    width: 72px;
    height: 72px;
    flex-shrink: 0;
    overflow: hidden;
    background: #f4f8f6;
}

.pcat-contact-popup__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pcat-contact-popup__label {
    font-size: 12px;
    color: #888888;
    margin: 0 0 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pcat-contact-popup__product-name {
    font-size: 15px;
    font-weight: 700;
    color: #0b183e;
    display: block;
    line-height: 1.35;
}

/* ─── CF7 overrides inside the popup ─────────────────────────────────────── */
.pcat-contact-popup__cf7 .wpcf7 {
    background: transparent;
    padding: 0;
}
.pcat-contact-popup__cf7 .wpcf7-form p {
    margin-bottom: 14px;
}

.pcat-contact-popup__cf7 .wpcf7-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 5px;
}

.pcat-contact-popup__cf7 .wpcf7-form input:not([type=submit]),
.pcat-contact-popup__cf7 .wpcf7-form textarea,
.pcat-contact-popup__cf7 .wpcf7-form select {
    width: 100%;
    border: 1px solid #d0d0d0;
    padding: 10px 12px;
    font-size: 14px;
    color: #333333;
    background: #ffffff;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.2s ease;
    border-radius: 0;
    box-shadow: none;
}

.pcat-contact-popup__cf7 .wpcf7-form input:not([type=submit]):focus,
.pcat-contact-popup__cf7 .wpcf7-form textarea:focus {
    border-color: #0b183e;
}

.pcat-contact-popup__cf7 .wpcf7-form textarea {
    resize: vertical;
    min-height: 80px;
}

.pcat-contact-popup__cf7 .wpcf7-form input[type=submit] {
    background: #0b183e !important;
    color: #ffffff !important;
    border: none;
    padding: 11px 28px;
    margin: 0;
    width: 100%;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
    font-family: inherit;
    border-radius: 0;
    box-shadow: none;
}

.pcat-contact-popup__cf7 .wpcf7-form input[type=submit]:hover {
    background: #0b183e;
}

.pcat-contact-popup__cf7 .wpcf7-not-valid-tip {
    font-size: 12px;
    color: #c53030;
    margin-top: 4px;
    display: block;
}

.pcat-contact-popup__cf7 .wpcf7-response-output {
    font-size: 13px;
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 0;
}

body.pcat-popup-open {
    overflow: hidden;
}

@media (max-width: 767px) {
    .pcat-contact-popup__modal {
        padding: 28px 20px 24px;
        max-height: 95vh;
    }
}
