/* ──────────────────────────────────────────────────────────────
   HK Senior Mall - Theme Styles (Bootstrap 5 Overrides)
   ────────────────────────────────────────────────────────────── */

:root {
    --hksm-primary: #6c37d3;
    --hksm-primary-dark: #5628ab;
    --hksm-accent: #f59e0b;
    --hksm-success: #10b981;
    --hksm-danger: #ef4444;
    --hksm-text: #1f2937;
    --hksm-text-muted: #6b7280;
    --hksm-border: #e5e7eb;
    --hksm-bg-light: #f9fafb;
    --hksm-radius: 0.5rem;
    --hksm-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --hksm-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --hksm-transition: 0.2s ease;

    --bs-primary: #6c37d3;
    --bs-primary-rgb: 108, 55, 211;
    --bs-link-color: #6c37d3;
    --bs-link-hover-color: #5628ab;
}

html {
    touch-action: manipulation;
    scroll-behavior: smooth;
}
body {
    color: var(--hksm-text);
    font-size: 0.9375rem;
}

a {
    color: var(--hksm-primary);
    text-decoration: none;
}
a:hover {
    color: var(--hksm-primary-dark);
}

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

/* ── Announce Bar ─────────────────────────────────────────── */
.hksm-announce-bar {
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
}

/* ── Header ───────────────────────────────────────────────── */
.hksm-header {
    z-index: 1030;
    box-shadow: var(--hksm-shadow);
}

.custom-logo,
.hksm-header .navbar-brand img {
    max-height: 48px;
    max-width: 200px;
    width: auto;
}

.hksm-currency-switcher .form-select {
    min-width: 88px;
    font-size: 0.8rem;
    border-color: var(--hksm-border);
    padding-top: 0.2rem;
    padding-bottom: 0.2rem;
}

.hksm-main-nav {
    position: relative;
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.hksm-main-nav > .menu-item {
    position: relative;
    display: inline-block;
}

.hksm-main-nav .menu-item > a {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    color: var(--hksm-text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color var(--hksm-transition);
}

.hksm-main-nav .menu-item > a:hover,
.hksm-main-nav .current-menu-item > a,
.hksm-main-nav .current-menu-ancestor > a {
    color: var(--hksm-primary);
}

.hksm-main-nav .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 240px;
    margin: 0;
    padding: 0.5rem 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--hksm-border);
    border-radius: 0.625rem;
    box-shadow: var(--hksm-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition:
        opacity var(--hksm-transition),
        transform var(--hksm-transition),
        visibility var(--hksm-transition);
    z-index: 40;
}

.hksm-main-nav .sub-menu .sub-menu {
    top: -0.5rem;
    left: calc(100% - 0.5rem);
}

.hksm-main-nav .menu-item:hover > .sub-menu,
.hksm-main-nav .menu-item:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.hksm-main-nav .sub-menu .menu-item {
    position: relative;
    display: block;
}

.hksm-main-nav .sub-menu .menu-item > a {
    display: block;
    width: 100%;
    padding: 0.55rem 1rem;
    font-size: 0.875rem;
}

.hksm-main-nav .menu-item-has-children > a {
    padding-right: 1.5rem;
}

.hksm-main-nav .hksm-nav-arrow {
    position: absolute;
    top: 50%;
    right: 0.55rem;
    width: 0.45rem;
    height: 0.45rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-60%) rotate(45deg);
    pointer-events: none;
}

.hksm-main-nav .sub-menu .hksm-nav-arrow {
    right: 0.9rem;
    transform: translateY(-50%) rotate(-45deg);
}

/* ── Search Dropdown ──────────────────────────────────────── */
.hksm-search-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 0 0 var(--hksm-radius) var(--hksm-radius);
    z-index: 1020;
}

.hksm-search-dropdown.show {
    display: block;
}

.hksm-search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--hksm-border);
    transition: background var(--hksm-transition);
}

.hksm-search-result-item:hover {
    background: var(--hksm-bg-light);
}

.hksm-search-result-item img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
}

.hksm-search-result-item .hksm-result-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--hksm-text);
}

.hksm-search-result-item .hksm-result-price {
    font-size: 0.8125rem;
    color: var(--hksm-danger);
}

/* ── PSA Thumbnail Display ───────────────────────────────── */
.psa-size-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 10px 0;
}

.psa-size-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    padding: 4px;
}

.psa-size-thumbnail-wrapper {
    position: relative;
    text-align: center;
    border-radius: 6px;
    background: #f5f5f5;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    overflow: hidden;
}

.psa-size-thumbnail {
    width: 90px;
    height: auto;
    display: block;
    border-radius: 0;
    border: 0;
}

.psa-size-label {
    font-weight: 600;
    font-size: 13px;
    margin-top: 6px;
    margin-bottom: 2px;
    display: block;
    text-align: center;
}

.psa-size-price {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    display: block;
    text-align: center;
}

.psa-size-price ins {
    text-decoration: none;
    color: var(--hksm-primary);
}

.psa-size-item:hover .psa-size-thumbnail-wrapper {
    border-color: #ccc;
}

.psa-size-item:hover .psa-size-label {
    color: var(--hksm-primary);
}

.psa-size-item.active .psa-size-thumbnail-wrapper,
.psa-size-item.psa-size-active .psa-size-thumbnail-wrapper {
    border-color: var(--hksm-primary);
    background: #fff;
    box-shadow: 0 0 0 1px rgba(108, 55, 211, 0.12);
}

.psa-size-item.active .psa-size-label,
.psa-size-item.psa-size-active .psa-size-label,
.psa-size-item.active .psa-size-price,
.psa-size-item.psa-size-active .psa-size-price,
.psa-size-item.active .psa-size-price ins,
.psa-size-item.psa-size-active .psa-size-price ins {
    color: var(--hksm-primary) !important;
    font-weight: 700;
}

/* ── Hero Slider ──────────────────────────────────────────── */
.hksm-hero-slider {
    width: 100%;
    overflow: hidden;
}

.hksm-hero-slider img {
    width: 100%;
    height: auto;
    display: block;
}

.hksm-hero-slider .swiper-pagination-bullet-active {
    background: var(--hksm-primary);
}

/* ── Categories Grid ──────────────────────────────────────── */
.hksm-cat-card {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        transform var(--hksm-transition),
        box-shadow var(--hksm-transition);
}

.hksm-cat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--hksm-shadow-lg);
}

.hksm-cat-card img {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

/* ── Product Carousel ─────────────────────────────────────── */
.hksm-product-carousel .swiper-button-next,
.hksm-product-carousel .swiper-button-prev {
    width: 36px;
    height: 36px;
    background: #fff;
    border-radius: 50%;
    box-shadow: var(--hksm-shadow);
}

.hksm-product-carousel .swiper-button-next::after,
.hksm-product-carousel .swiper-button-prev::after {
    font-size: 14px;
    color: var(--hksm-text);
}

/* ── CTA Section ──────────────────────────────────────────── */
.hksm-cta {
    background: linear-gradient(
        135deg,
        var(--hksm-primary),
        var(--hksm-primary-dark)
    );
}

/* ── Features Strip ───────────────────────────────────────── */
.hksm-features i {
    flex-shrink: 0;
}

/* ── Footer ───────────────────────────────────────────────── */
.hksm-footer a.text-white-50:hover {
    color: #fff !important;
}

.hksm-payment-icons-footer img,
.hksm-footer .hksm-payment-icons-footer img {
    display: inline-block;
    width: auto !important;
    max-width: 60px !important;
    height: 34px !important;
    max-height: 34px !important;
    object-fit: contain;
    flex: 0 0 auto;
}

/* ── Single Article Reading Experience ────────────────────── */
.single-post article.post {
    max-width: 100%;
}

.single-post .hksm-article-header {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.single-post .hksm-article-title {
    width: 100%;
    max-width: 100%;
    font-size: clamp(2rem, 3.5vw, 3rem);
    line-height: 1.16;
    letter-spacing: 0;
    color: #182230;
}

.single-post .hksm-entry-content {
    color: #243044;
    font-size: 1.08rem;
    line-height: 2;
    letter-spacing: 0;
}

.single-post .hksm-entry-content > * {
    margin-bottom: 1.35rem;
}

.single-post .hksm-entry-content p {
    margin-bottom: 1.35rem;
}

.single-post .hksm-entry-content strong {
    color: #111827;
    font-weight: 700;
}

.single-post .hksm-entry-content h2,
.single-post .hksm-entry-content h3 {
    color: #162033;
    line-height: 1.28;
    letter-spacing: 0;
    scroll-margin-top: 96px;
}

.single-post .hksm-entry-content h2 {
    margin-top: 3rem;
    margin-bottom: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e7edf4;
    font-size: clamp(1.55rem, 2.2vw, 2rem);
}

.single-post .hksm-entry-content h3 {
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    font-size: clamp(1.2rem, 1.5vw, 1.4rem);
}

.single-post .hksm-entry-content a {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

.single-post .hksm-entry-content .wp-block-table {
    margin: 2rem 0;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e4eaf2;
}

.single-post .hksm-entry-content table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    font-size: 0.98rem;
    line-height: 1.65;
}

.single-post .hksm-entry-content th,
.single-post .hksm-entry-content td {
    padding: 0.9rem 1rem;
    border: 1px solid #e4eaf2;
    vertical-align: top;
}

.single-post .hksm-entry-content th {
    background: #f5f8fb;
    color: #182230;
    font-weight: 700;
}

.single-post .hksm-entry-content ol,
.single-post .hksm-entry-content ul {
    padding-left: 1.4rem;
    margin-bottom: 1.5rem;
}

.single-post .hksm-entry-content li {
    margin-bottom: 0.55rem;
}

@media (max-width: 575.98px) {
    .single-post .hksm-article-title {
        max-width: none;
        font-size: 1.85rem;
    }

    .single-post .hksm-entry-content {
        font-size: 1.02rem;
        line-height: 1.9;
    }

    .single-post .hksm-entry-content th,
    .single-post .hksm-entry-content td {
        padding: 0.75rem;
    }
}

@media (max-width: 991.98px) {
    .hksm-mobile-account-footer-section,
    body.hksm-mobile-no-footer .hksm-cta,
    body.hksm-mobile-no-footer .hksm-features,
    body.hksm-mobile-no-footer .hksm-footer,
    body.hksm-mobile-no-footer footer.hksm-footer {
        display: none !important;
    }
}

/* ── WhatsApp Float ───────────────────────────────────────── */
.hksm-float-wa {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 56px;
    height: 56px;
    background: #25d366;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    z-index: 1040;
    transition: transform var(--hksm-transition);
}

.hksm-float-wa:hover {
    transform: scale(1.1);
    color: #fff;
}

/* ── Bootstrap color overrides ────────────────────────────── */
.bg-primary {
    background-color: #6c37d3 !important;
}
.text-primary {
    color: #6c37d3 !important;
}
.border-primary {
    border-color: #6c37d3 !important;
}

.btn-primary {
    background-color: #6c37d3;
    border-color: #6c37d3;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: #5628ab;
    border-color: #5628ab;
}

.btn-outline-primary {
    color: #6c37d3;
    border-color: #6c37d3;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    background-color: #6c37d3;
    border-color: #6c37d3;
    color: #fff;
}

.badge.bg-primary {
    background-color: #6c37d3 !important;
}

/* ── Offcanvas Cart ───────────────────────────────────────── */
#hksmCartOffcanvas {
    width: 380px;
}

@media (max-width: 575.98px) {
    #hksmCartOffcanvas {
        width: 100%;
    }
}

/* ── Mobile Menu ──────────────────────────────────────────── */
.hksm-mobile-menu,
.hksm-mobile-menu .sub-menu {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.hksm-mobile-menu .menu-item > a {
    display: block;
    padding: 0.5rem 0;
    color: var(--hksm-text);
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--hksm-border);
}

.hksm-mobile-menu .sub-menu {
    padding-left: 1rem;
}

.hksm-mobile-menu .sub-menu a {
    font-size: 0.875rem;
    color: var(--hksm-text-muted);
}

.hksm-mobile-menu .hksm-nav-arrow {
    display: none;
}

/* ── FAQ Accordion ────────────────────────────────────────── */
.hksm-faq-item .accordion-button:not(.collapsed) {
    background-color: var(--hksm-bg-light);
    color: var(--hksm-primary);
    box-shadow: none;
}

/* ── Sale Badge ───────────────────────────────────────────── */
.hksm-sale-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2;
}

/* ── Page Content ─────────────────────────────────────────── */
.hksm-page-content img {
    border-radius: var(--hksm-radius);
}

.hksm-page-content h2 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.hksm-page-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.hksm-page-content table th,
.hksm-page-content table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--hksm-border);
}

/* ── Policy Pages ───────────────────────────────────────── */
.hksm-policy-page {
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.hksm-policy-card {
    max-width: 960px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--hksm-border);
    border-radius: 1rem;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
    padding: 1.5rem;
}

.hksm-policy-header {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--hksm-border);
}

.hksm-policy-title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 800;
    line-height: 1.2;
    color: #0f172a;
}

.hksm-policy-body {
    line-height: 1.85;
    color: #334155;
}

.hksm-policy-body h2,
.hksm-policy-body h3 {
    margin-top: 1.6rem;
    margin-bottom: 0.8rem;
    font-weight: 800;
    color: #111827;
}

.hksm-policy-body p,
.hksm-policy-body li {
    color: #334155;
}

.hksm-policy-body a {
    word-break: break-word;
}

.hksm-policy-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--hksm-border);
}

.hksm-policy-footer a {
    color: var(--hksm-primary);
}

@media (max-width: 767.98px) {
    .hksm-policy-card {
        padding: 1rem;
        border-radius: 0.875rem;
    }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (min-width: 1200px) {
    .container,
    .container-lg,
    .container-md,
    .container-sm,
    .container-xl,
    .container-xxl {
        max-width: 1520px;
    }

    .h1,
    h1 {
        font-size: 1.5rem;
    }
}

@media (min-width: 1400px) {
    .container,
    .container-lg,
    .container-md,
    .container-sm,
    .container-xl,
    .container-xxl {
        max-width: 1500px;
    }
}

@media (max-width: 991.98px) {
    .hksm-header .navbar-brand img {
        max-height: 36px;
    }
}

@media (max-width: 767.98px) {
    .hksm-product-section {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
}
