/* =============================================================
   HC Shop — WooCommerce Stylesheet  v1.0.0
   ============================================================= */

/* ── Product Card ─────────────────────────────────────────────────────── */
.hcs-product-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--gray-100);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    position: relative;
}
.hcs-product-card:hover {
    border-color: var(--gray-200);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}
.hcs-product-card--service { border-left: 3px solid var(--success); }
.hcs-product-card--out-of-stock { opacity: 0.72; }
.hcs-product-card--out-of-stock:hover { transform: none; }

/* Image */
.hcs-product-card__image-wrap {
    position: relative;
    overflow: hidden;
    aspect-ratio: 400 / 320;
    background: var(--gray-50);
}
.hcs-product-card__image {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.hcs-product-card:hover .hcs-product-card__image { transform: scale(1.06); }

.hcs-product-card__badges {
    position: absolute; top: 12px; left: 12px;
    display: flex; flex-direction: column; gap: 6px; z-index: 2;
}
.badge-vd { background: var(--primary); color: var(--white); }

.hcs-product-card__overlay {
    position: absolute; inset: 0;
    background: rgba(13, 27, 62, 0.55);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.25s; z-index: 3;
}
.hcs-product-card:hover .hcs-product-card__overlay { opacity: 1; }

.hcs-product-card__overlay-btn {
    background: var(--white); color: var(--navy);
    padding: 10px 20px; border-radius: var(--radius-full);
    font-size: 13px; font-weight: 600;
    display: flex; align-items: center; gap: 7px;
    transform: translateY(8px); transition: var(--transition);
}
.hcs-product-card:hover .hcs-product-card__overlay-btn { transform: translateY(0); }
.hcs-product-card__overlay-btn:hover { background: var(--primary); color: var(--white); }

/* Body */
.hcs-product-card__body {
    padding: 16px 18px 12px;
    flex: 1;
    display: flex; flex-direction: column; gap: 8px;
}
.hcs-product-card__category {
    font-size: 11px; font-weight: 700; color: var(--primary);
    text-transform: uppercase; letter-spacing: 0.8px;
}
.hcs-product-card__category:hover { color: var(--primary-dark); }
.hcs-product-card__title {
    font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--navy); margin: 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hcs-product-card__title-link { color: inherit; }
.hcs-product-card__title-link:hover { color: var(--primary); }

.hcs-product-card__specs {
    display: flex; flex-direction: column; gap: 4px;
    padding: 8px 10px;
    background: var(--gray-50); border-radius: var(--radius-sm); border: 1px solid var(--gray-100);
}
.hcs-product-card__spec { display: flex; justify-content: space-between; font-size: 12px; gap: 8px; }
.hcs-product-card__spec-label { color: var(--gray-500); flex-shrink: 0; }
.hcs-product-card__spec-value { color: var(--gray-800); font-weight: 500; text-align: right; }

/* Price */
.hcs-product-card__price-wrap { margin-top: auto; padding-top: 8px; }
.hcs-price { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; line-height: 1.3; }
.hcs-price__regular { font-size: 18px; font-weight: 700; color: var(--navy); }
.hcs-price__vd  { font-size: 20px; font-weight: 800; color: var(--primary-dark); }
.hcs-price__sale { font-size: 20px; font-weight: 800; color: var(--danger); }
.hcs-price__original { font-size: 13px; color: var(--gray-400); text-decoration: line-through; }
.hcs-price__badge--vd {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 10px; font-weight: 700; letter-spacing: 0.4px;
    background: var(--primary-light); color: var(--primary-dark);
    padding: 3px 8px; border-radius: var(--radius-full);
}
.hcs-price__badge--sale {
    font-size: 11px; font-weight: 700;
    background: var(--danger-light); color: var(--danger);
    padding: 3px 8px; border-radius: var(--radius-full);
}
.hcs-price__service { font-size: 15px; font-weight: 700; color: var(--success); }
.hcs-product-card__video-link {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; color: var(--info); font-weight: 500;
    margin-top: 6px; width: fit-content;
}
.hcs-product-card__video-link:hover { color: var(--navy); }

/* Footer */
.hcs-product-card__footer {
    padding: 12px 18px 16px;
    display: flex; align-items: center; gap: 10px;
    border-top: 1px solid var(--gray-100);
}
.hcs-product-card__btn { flex: 1; justify-content: center; font-size: 13px; padding: 10px 16px; }
.hcs-add-to-cart.is-loading { opacity: 0.75; pointer-events: none; }
.hcs-add-to-cart.is-added { background: var(--success) !important; border-color: var(--success) !important; }
.hcs-product-card__wishlist {
    width: 38px; height: 38px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
    color: var(--gray-400); font-size: 15px; background: transparent; cursor: pointer;
    transition: var(--transition);
}
.hcs-product-card__wishlist:hover,
.hcs-product-card__wishlist[aria-pressed="true"] {
    border-color: var(--danger); color: var(--danger); background: var(--danger-light);
}

/* ── Product Grid ──────────────────────────────────────────────────────── */
.hcs-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    align-items: start;
}
.hcs-product-grid.is-loading { opacity: 0.45; pointer-events: none; transition: opacity 0.2s; }
.hcs-no-products { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--gray-500); }
.hcs-no-products i { font-size: 48px; color: var(--gray-200); display: block; margin-bottom: 16px; }

/* ── Shop Layout ───────────────────────────────────────────────────────── */
.hcs-shop-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: start;
    padding: 32px 0 80px;
}
.hcs-shop-sidebar {
    position: sticky;
    top: calc(var(--header-h) + 20px);
    max-height: calc(100vh - var(--header-h) - 40px);
    overflow-y: auto;
    scrollbar-width: thin; scrollbar-color: var(--gray-200) transparent;
}

/* ── Filter ────────────────────────────────────────────────────────────── */
.hcs-filter { background: var(--white); border: 1.5px solid var(--gray-100); border-radius: var(--radius-lg); overflow: hidden; }
.hcs-filter__header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--gray-100); }
.hcs-filter__title { font-size: 15px; font-weight: 700; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.hcs-filter__clear { font-size: 12px; color: var(--primary); cursor: pointer; font-weight: 500; background: none; border: none; padding: 0; }
.hcs-filter__clear:hover { color: var(--primary-dark); }
.hcs-filter__section { padding: 18px 20px; border-bottom: 1px solid var(--gray-100); }
.hcs-filter__section:last-child { border-bottom: none; }
.hcs-filter__section-title { font-size: 12px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
.hcs-filter__section-title i { font-size: 11px; transition: transform 0.2s; }
.hcs-filter__section.is-collapsed .hcs-filter__section-title i { transform: rotate(-90deg); }
.hcs-filter__section.is-collapsed .hcs-filter__options { display: none; }
.hcs-filter__options { display: flex; flex-direction: column; gap: 10px; }
.hcs-filter__option { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; color: var(--gray-700); }
.hcs-filter__option:hover { color: var(--primary); }
.hcs-filter__option input[type="checkbox"] { width: 16px; height: 16px; border-radius: 4px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.hcs-filter__option-count { margin-left: auto; font-size: 11px; color: var(--gray-400); background: var(--gray-100); padding: 1px 7px; border-radius: var(--radius-full); }
.hcs-filter__price-inputs { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.hcs-filter__price-input { flex: 1; height: 36px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); padding: 0 10px; font-size: 13px; text-align: center; }
.hcs-filter__price-input:focus { outline: none; border-color: var(--primary); }
.hcs-filter__price-sep { color: var(--gray-400); font-size: 13px; flex-shrink: 0; }
.hcs-filter__apply { width: 100%; margin-top: 14px; }

/* ── Shop Toolbar ──────────────────────────────────────────────────────── */
.hcs-shop-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.hcs-shop-toolbar__count { font-size: 14px; color: var(--gray-500); }
.hcs-shop-toolbar__count strong { color: var(--navy); }
.hcs-shop-toolbar__sort { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--gray-600); }
.hcs-shop-toolbar__sort select {
    height: 36px; padding: 0 30px 0 12px;
    border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
    font-size: 13px; font-family: var(--font); color: var(--gray-900); background: var(--white);
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
.hcs-shop-toolbar__sort select:focus { outline: none; border-color: var(--primary); }
.hcs-filter-toggle { display: none; }

/* ── WooCommerce Overrides ─────────────────────────────────────────────── */
.woocommerce-breadcrumb,
.woocommerce-result-count,
.woocommerce-ordering { display: none; }
.woocommerce button.button, .woocommerce input.button, .woocommerce a.button {
    background: var(--primary) !important; color: var(--white) !important;
    border-radius: var(--radius) !important; font-family: var(--font) !important;
    font-weight: 600 !important; font-size: 14px !important;
    padding: 12px 24px !important; border: none !important; transition: var(--transition) !important;
}
.woocommerce button.button:hover, .woocommerce a.button:hover {
    background: var(--primary-dark) !important; transform: translateY(-1px) !important;
}
.woocommerce-message, .woocommerce-info {
    border-top-color: var(--primary) !important; background: var(--primary-light) !important; color: var(--navy) !important;
}
.woocommerce-error { border-top-color: var(--danger) !important; background: var(--danger-light) !important; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .hcs-shop-layout { grid-template-columns: 240px 1fr; gap: 24px; }
}
@media (max-width: 768px) {
    .hcs-shop-layout { grid-template-columns: 1fr; }
    .hcs-shop-sidebar {
        position: fixed; top: 0; left: -100%;
        width: min(320px, 90vw); height: 100vh; max-height: 100vh;
        background: var(--white); z-index: 1200; padding: 20px;
        box-shadow: var(--shadow-xl);
        transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }
    .hcs-shop-sidebar.is-open { left: 0; }
    .hcs-filter-toggle { display: flex !important; }
    .hcs-product-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
}
@media (max-width: 480px) {
    .hcs-product-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .hcs-product-card__body { padding: 12px 14px 10px; }
    .hcs-product-card__footer { padding: 10px 14px 12px; }
    .hcs-product-card__specs { display: none; }
}

/* ── Skeleton loading cards (replaces faint overlay) ─────────────────────── */
.hcs-product-card--skeleton {
    pointer-events: none;
    cursor: default;
}
.hcs-product-card--skeleton:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--gray-100);
}
.hcs-product-card--skeleton .hcs-product-card__image-wrap {
    background: var(--gray-100);
}

/* "Show more" link in filter */
.hcs-filter__show-more {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
    margin-top: 8px;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: color 0.15s;
}
.hcs-filter__show-more:hover { color: var(--primary-dark); }

/* Filter section title keyboard focus */
.hcs-filter__section-title:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ── EQUAL CARD HEIGHTS FIX ──────────────────────────────────────────────────
   The grid must use align-items:stretch so all cards in a row are the same height.
   The card uses flex-column so image stays on top, footer stays at bottom.
   This fixes the "card body/footer above image" bug too.
   ─────────────────────────────────────────────────────────────────────────── */
.hcs-product-grid {
    align-items: stretch; /* overrides the earlier align-items:start */
}

.hcs-product-card {
    height: 100%; /* fill the grid cell fully */
}

/* Brand + Model row on card */
.hcs-product-card__meta-row {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 6px 0 2px;
}

.hcs-product-card__meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    line-height: 1.4;
}

.hcs-product-card__meta-label {
    color: var(--gray-400);
    font-weight: 500;
    flex-shrink: 0;
    min-width: 38px;
}

.hcs-product-card__meta-value {
    color: var(--gray-700);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Remove any WooCommerce ::before content arrows that may still appear */
.woocommerce ul.products li.product .button::before,
.woocommerce ul.products li.product .button::after,
.woocommerce a.button::before,
.woocommerce button.button::before {
    content: none !important;
    display: none !important;
}

/* Fix mobile card layout - ensure flex column order is correct */
@media (max-width: 640px) {
    .hcs-product-card {
        display: flex;
        flex-direction: column;
    }

    .hcs-product-card__image-wrap {
        order: 0; /* image always first */
        flex-shrink: 0;
    }

    .hcs-product-card__body {
        order: 1;
    }

    .hcs-product-card__footer {
        order: 2;
        margin-top: auto;
    }

    /* Smaller grid on mobile */
    .hcs-product-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    /* Hide specs and meta on very small cards */
    .hcs-product-card__specs,
    .hcs-product-card__meta-row {
        display: none;
    }

    .hcs-product-card__body {
        padding: 10px 12px 8px;
        gap: 5px;
    }

    .hcs-product-card__footer {
        padding: 8px 12px 10px;
    }

    .hcs-product-card__btn {
        font-size: 12px;
        padding: 8px 10px;
    }

    .hcs-product-card__wishlist {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }
}

@media (max-width: 380px) {
    .hcs-product-grid {
        grid-template-columns: 1fr; /* single column on tiny screens */
    }
}
