/* ==========================================================
   BC Header — Styles v1.0.2
   All colors / sizes driven by CSS variables set from PHP.
   ========================================================== */

/* ── Base icon button reset ── */
.bch-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 4px;
    margin: 0;
    cursor: pointer;
    color: var(--bch-icon-color, #222);
    transition: color 0.22s ease;
    position: relative;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.bch-icon-btn:hover,
.bch-icon-btn:focus-visible {
    color: var(--bch-icon-hover, #C75E3D) !important;
    background: none !important;
    box-shadow: none !important;
    text-decoration: none;
}

.bch-icon-btn svg {
    width: var(--bch-icon-size, 20px);
    height: var(--bch-icon-size, 20px);
    stroke: currentColor;
    fill: none;
    display: block;
    flex-shrink: 0;
}

/* ── Badge ── */
.bch-badge {
    position: absolute;
    top: var(--bch-badge-top, auto);
    right: var(--bch-badge-right, auto);
    bottom: var(--bch-badge-bottom, auto);
    left: var(--bch-badge-left, auto);
    width: var(--bch-badge-size, 17px);
    height: var(--bch-badge-size, 17px);
    min-width: var(--bch-badge-size, 17px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--bch-badge-fs, 10px);
    font-weight: 600;
    line-height: 1;
    color: var(--bch-badge-color, #fff);
    background: var(--bch-badge-bg, #333);
    border-radius: 50%;
    pointer-events: none;
    transition: background 0.2s ease, transform 0.2s ease;
}

.bch-badge--hidden {
    display: none !important;
}

@keyframes bch-badge-pop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

.bch-badge--updated {
    animation: bch-badge-pop 0.3s ease;
}

/* ── Shared dropdown ── */
.bch-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #fff;
    border: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 8px 24px rgba(0,0,0,.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .22s ease, visibility .22s ease, transform .22s ease;
    z-index: 99999;
    pointer-events: none;
}

/* Invisible hover bridge */
.bch-dropdown::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
}

.bch-dropdown.bch-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* ══════════════════════
   SEARCH MODULE
══════════════════════ */

.bch-search-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.bch-search-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: -20px;
    background: #fff;
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
    z-index: 99999;
}

.bch-search-dropdown.bch-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bch-search-form {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
}

.bch-search-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    color: #222;
    -webkit-appearance: none;
    appearance: none;
}

.bch-search-input::placeholder { color: #aaa; }

.bch-search-results {
    max-height: 320px;
    overflow-y: auto;
}

.bch-search-results::-webkit-scrollbar { width: 4px; }
.bch-search-results::-webkit-scrollbar-thumb { background: #e0e0e0; }

.bch-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: #222;
    transition: color .2s ease;
    border-bottom: 1px solid #f5f5f5;
    background: none !important;
}

.bch-search-result-item:last-child { border-bottom: none; }
.bch-search-result-item:hover { color: var(--bch-icon-hover, #C75E3D) !important; }

.bch-search-result-item img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    flex-shrink: 0;
}

.bch-search-result-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bch-search-result-title {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bch-search-result-price { font-size: 12px; color: #888; }

.bch-search-view-all {
    display: block;
    text-align: center;
    padding: 10px 14px;
    font-size: 13px;
    color: #222;
    text-decoration: none;
    border-top: 1px solid #f0f0f0;
    transition: color .2s ease;
    background: none !important;
}

.bch-search-view-all:hover { color: var(--bch-icon-hover, #C75E3D) !important; }
.bch-search-status { padding: 16px 14px; text-align: center; font-size: 13px; color: #999; }

/* ══════════════════════
   ACCOUNT MODULE
══════════════════════ */

.bch-account-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Desktop: hover to open */
@media (min-width: 768px) {
    .bch-account-wrap:hover .bch-dropdown { opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto; }
}

.bch-account-menu {
    min-width: 180px;
    padding: 8px 0;
}

.bch-account-menu a {
    display: block;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 400;
    color: #000;
    text-decoration: none;
    letter-spacing: .02em;
    transition: color .2s ease;
    white-space: nowrap;
}

.bch-account-menu a:hover { color: var(--bch-icon-hover, #C75E3D); }

.bch-dropdown-divider { height: 1px; background: rgba(0,0,0,.06); margin: 6px 0; }

.bch-login-panel { width: 280px; }
.bch-login-inner { padding: 24px 20px 0; }

.bch-login-title {
    font-size: 15px;
    font-weight: 600;
    color: #000;
    letter-spacing: .03em;
    margin-bottom: 16px;
    text-transform: uppercase;
}

.bch-login-msg {
    font-size: 12px;
    padding: 8px 10px;
    margin-bottom: 12px;
    border-radius: 2px;
}

.bch-login-msg--error   { background: #fef2f0; color: #c0392b; border: 1px solid #f5c6cb; }
.bch-login-msg--success { background: #f0fef2; color: #27ae60; border: 1px solid #c6f5cb; }

.bch-field { margin-bottom: 12px; }

.bch-field input {
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    font-family: inherit;
    color: #000;
    border: 1px solid rgba(0,0,0,.15);
    border-radius: 2px;
    background: transparent;
    outline: none;
    transition: border-color .2s ease;
    box-sizing: border-box;
}

.bch-field input::placeholder { color: rgba(0,0,0,.35); }
.bch-field input:focus { border-color: var(--bch-icon-hover, #C75E3D); }

.bch-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #fff;
    background: #000;
    border: 1px solid #000;
    border-radius: 2px;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease;
}

.bch-login-btn:hover { background: var(--bch-icon-hover, #C75E3D); border-color: var(--bch-icon-hover, #C75E3D); }
.bch-login-btn:disabled { opacity: .6; cursor: not-allowed; }

.bch-login-spinner svg { animation: bch-spin .8s linear infinite; }

@keyframes bch-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.bch-login-footer { padding: 14px 20px 16px; border-top: 1px solid rgba(0,0,0,.06); }

.bch-forgot-link {
    display: block;
    font-size: 12px;
    color: rgba(0,0,0,.45);
    text-decoration: none;
    margin-bottom: 10px;
    transition: color .2s ease;
}

.bch-forgot-link:hover { color: var(--bch-icon-hover, #C75E3D); }

.bch-register-prompt { font-size: 12px; color: rgba(0,0,0,.5); margin: 0; }

.bch-register-link { color: var(--bch-icon-hover, #C75E3D); font-weight: 600; text-decoration: none; }
.bch-register-link:hover { color: #000; }

/* ══════════════════════
   CART DRAWER
══════════════════════ */

.bch-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 100000;
    opacity: 0;
    transition: opacity .3s ease;
}

.bch-overlay.bch-open,
.bch-overlay.bch-cart-overlay-is-open {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

html.bch-cart-open,
body.bch-cart-open {
    overflow: hidden !important;
}

.bch-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(400px, 92vw);
    background: #fff;
    z-index: 100001;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .32s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: -4px 0 32px rgba(0,0,0,.08);
}

.bch-cart-drawer.bch-open,
.bch-cart-drawer.bch-cart-is-open {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translate3d(0,0,0) !important;
    pointer-events: auto !important;
}

.bch-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.bch-drawer-title { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }

.bch-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.bch-drawer-empty {
    padding: 60px 24px;
    text-align: center;
    color: #9a9a9a;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 320px;
}
.bch-empty-watermark {
    width: 140px;
    height: 150px;
    color: #d8d3cc;
    opacity: 0.65;
    animation: bch-hanger-sway 4.5s ease-in-out infinite;
    transform-origin: 50% 8%;
    margin-bottom: 6px;
}
.bch-empty-watermark svg { width: 100%; height: 100%; display: block; }
.bch-empty-title {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: #555;
    text-transform: uppercase;
}
.bch-empty-sub {
    margin: 0;
    font-size: 13px;
    color: #a3a3a3;
    max-width: 240px;
    line-height: 1.5;
    font-style: italic;
}
@keyframes bch-hanger-sway {
    0%, 100% { transform: rotate(-3deg); }
    50%      { transform: rotate(3deg); }
}
@media (prefers-reduced-motion: reduce) {
    .bch-empty-watermark { animation: none; }
}

/* ── Cart item card (v5 redesign) ── */
.bch-cart-item {
    display: flex;
    align-items: stretch;
    gap: 12px;
    padding: 14px 18px;
    margin: 10px 14px;
    background: #fff;
    border: 1px solid #ececec;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: box-shadow .2s, border-color .2s;
}
.bch-cart-item:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.06); border-color: #ddd; }

.bch-cart-item-img {
    flex-shrink: 0;
    width: 78px;
    height: 100px;
    overflow: hidden;
    background: #f6f6f6;
    border-radius: 4px;
}
.bch-cart-item-img a, .bch-cart-item-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bch-cart-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
}

.bch-cart-item-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.bch-cart-item-text { min-width: 0; flex: 1; }

.bch-cart-item-brand {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .12em;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.bch-cart-item-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12.5px;
    font-weight: 500;
    color: #1a1a1a;
    text-decoration: none;
    line-height: 1.35;
    margin: 0;
}
.bch-cart-item-name:hover { color: var(--bch-icon-hover, #C75E3D); }

.bch-cart-item-variation {
    font-size: 11px;
    color: #666;
    line-height: 1.3;
    margin: 0;
}

/* Quantity stepper */
.bch-cart-item-qty-stepper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    user-select: none;
}
.bch-qty-btn {
    width: 22px; height: 22px;
    border: 1px solid #e0e0e0;
    background: #fff;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #555;
    padding: 0;
    transition: border-color .15s, color .15s, background .15s;
}
.bch-qty-btn:hover { border-color: #222; color: #000; }
.bch-qty-btn:disabled { opacity: .4; cursor: not-allowed; }
.bch-qty-value {
    min-width: 22px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1a;
    font-variant-numeric: tabular-nums;
}

/* Bottom row: prices + tools */
.bch-cart-item-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.bch-cart-item-prices {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}
.bch-price-old {
    font-size: 11px;
    color: #999;
    text-decoration: line-through;
}
.bch-price-old .woocommerce-Price-amount { color: inherit; }
.bch-price-sale {
    font-size: 14px;
    font-weight: 700;
    color: #d0021b;
}
.bch-price-current {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}

.bch-cart-item-tools {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}
.bch-cart-item-tools .bch-icon-btn {
    width: 28px; height: 28px;
    color: #888;
    border-radius: 4px;
    transition: color .15s, background .15s;
}
.bch-cart-item-tools .bch-icon-btn:hover {
    color: #1a1a1a;
    background: rgba(0,0,0,0.04);
}
.bch-item-wish.is-active { color: #d0021b; }
.bch-item-wish.is-active svg { fill: currentColor; }

.bch-drawer-footer {
    border-top: 1px solid #f0f0f0;
    padding: 16px 20px;
    flex-shrink: 0;
}

.bch-drawer-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    margin-bottom: 14px;
    font-weight: 500;
}

.bch-drawer-actions { display: flex; gap: 10px; }

.bch-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 11px 14px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 2px;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
    border: 1px solid #000;
}

.bch-btn--primary { background: #000; color: #fff; }
.bch-btn--primary:hover { background: var(--bch-icon-hover, #C75E3D); border-color: var(--bch-icon-hover, #C75E3D); color: #fff; }
.bch-btn--outline { background: transparent; color: #000; }
.bch-btn--outline:hover { border-color: var(--bch-icon-hover, #C75E3D); color: var(--bch-icon-hover, #C75E3D); }

/* Clear cart — secondary ghost link below the main actions */
.bch-cart-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 12px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    color: #888;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 2px;
    transition: color .2s ease, background .2s ease;
}
.bch-cart-clear:hover { color: #c0392b; background: rgba(192,57,43,0.06); }
.bch-cart-clear:disabled { opacity: .5; cursor: not-allowed; }
.bch-cart-clear svg { flex-shrink: 0; }

/* ══════════════════════
   MOBILE
══════════════════════ */

@media (max-width: 767px) {
    .bch-search-dropdown {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100% !important;
        transform: translateY(-10px);
        box-shadow: 0 4px 20px rgba(0,0,0,.1);
    }

    .bch-search-dropdown.bch-open { transform: translateY(0); }

    .bch-search-input { font-size: 16px; padding: 14px 16px; }
}

/* ── Coupon form (v4) ── */
.bch-drawer-actions--single { grid-template-columns: 1fr; }
.bch-drawer-actions--single .bch-btn { width: 100%; }

.bch-drawer-coupon {
    padding: 0 0 12px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}
.bch-coupon-form {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.bch-coupon-input {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: #222;
    outline: none;
    transition: border-color .15s;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.bch-coupon-input:focus { border-color: var(--bch-icon-hover, #C75E3D); }
.bch-coupon-apply {
    flex-shrink: 0;
    padding: 0 14px !important;
    font-size: 12px !important;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.bch-coupon-msg {
    margin: 8px 0 0;
    font-size: 12px;
    min-height: 14px;
    line-height: 1.3;
}
.bch-coupon-msg.is-error   { color: #c0392b; }
.bch-coupon-msg.is-success { color: #2c7a4b; }

.bch-coupon-applied-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.bch-coupon-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 4px 4px 10px;
    background: rgba(0,0,0,0.06);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #222;
}
.bch-coupon-remove {
    width: 18px; height: 18px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.15);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background .15s;
}
.bch-coupon-remove:hover { background: #c0392b; }

/* ── v5: actions single (full-width) override (flex layout) ── */
.bch-drawer-actions--single { display: flex; }
.bch-drawer-actions--single .bch-btn { flex: 1 1 100%; width: 100%; }

/* ── Secure payment notice ── */
.bch-secure-payment {
    margin: 10px 0 0;
    padding: 8px 10px;
    text-align: center;
    font-size: 11px;
    letter-spacing: .04em;
    color: #4a7c59;
    background: rgba(74,124,89,0.07);
    border-radius: 4px;
    line-height: 1.3;
}
