/**
 * cart-icon.css
 *
 * Styles for the [gf_cart_icon] shortcode:
 *   - Cart icon button and SVG
 *   - Badge (item count)
 *   - Optional total display
 *   - Mini cart dropdown panel
 *   - Dropdown items area (uses .gf-cart-item--compact from cart-field.css)
 *   - More items button
 *   - Empty state
 *   - Dropdown footer (total + checkout button)
 *
 * BEM:
 *   .gf-cart-icon-wrap              Positioning root
 *   .gf-cart-icon-btn               Trigger button / link
 *   .gf-cart-icon-svg               Cart SVG icon
 *   .gf-cart-icon-badge             Item count pill
 *   .gf-cart-icon-badge--empty      Hidden state (count = 0)
 *   .gf-cart-icon-total             Grand total text
 *
 *   .gf-cart-mini-cart              Dropdown panel
 *   .gf-cart-mini-cart--open        Visible state
 *   .gf-cart-mini-cart__items       Scrollable item list
 *   .gf-cart-mini-cart__more-btn    "+ X more items →" link
 *   .gf-cart-mini-cart__empty       Empty state
 *   .gf-cart-mini-cart__footer      Sticky footer
 *   .gf-cart-mini-cart__total-row   Total label + value
 *   .gf-cart-mini-cart__checkout-btn  CTA button
 */

/* ── Reset ───────────────────────────────────────────────────────────────── */

.gf-cart-icon-wrap *,
.gf-cart-icon-wrap *::before,
.gf-cart-icon-wrap *::after {
    box-sizing: border-box;
}

/* ── Positioning root ────────────────────────────────────────────────────── */

.gf-cart-icon-wrap {
    position: relative;
    display: inline-block;
}

/* ── Icon button ─────────────────────────────────────────────────────────── */

.gf-cart-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
    position: relative;
}

.gf-cart-icon-btn:hover {
    background: rgba( 0, 0, 0, 0.05 );
}

.gf-cart-icon-btn:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* ── SVG icon ────────────────────────────────────────────────────────────── */

.gf-cart-icon-svg {
    display: block;
    flex-shrink: 0;
}

/* ── Badge ───────────────────────────────────────────────────────────────── */

.gf-cart-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #111827;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    transition: background 0.2s ease, transform 0.15s ease;
}

/* Pulse animation when badge count increases */
.gf-cart-icon-badge--updated {
    animation: gfBadgePulse 0.3s ease;
}

@keyframes gfBadgePulse {
    0%   { transform: scale( 1 ); }
    50%  { transform: scale( 1.3 ); }
    100% { transform: scale( 1 ); }
}

/* Dim badge when cart is empty */
.gf-cart-icon-badge--empty {
    background: #9ca3af;
}

/* ── Cart total text ─────────────────────────────────────────────────────── */

.gf-cart-icon-total {
    font-size: 13px;
    font-weight: 600;
    color: inherit;
    white-space: nowrap;
}

/* ── Mini cart dropdown panel ────────────────────────────────────────────── */

.gf-cart-mini-cart {
    position: absolute;
    top: calc( 100% + 8px );
    right: 0;
    z-index: 9999;
    width: 320px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba( 0, 0, 0, 0.12 ), 0 4px 10px rgba( 0, 0, 0, 0.06 );
    overflow: hidden;

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY( -6px );
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
    pointer-events: none;
}

.gf-cart-mini-cart--open {
    opacity: 1;
    visibility: visible;
    transform: translateY( 0 );
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: auto;
}

/* ── Items area ──────────────────────────────────────────────────────────── */

.gf-cart-mini-cart__items {
    max-height: 280px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar styling */
.gf-cart-mini-cart__items::-webkit-scrollbar {
    width: 4px;
}
.gf-cart-mini-cart__items::-webkit-scrollbar-track {
    background: transparent;
}
.gf-cart-mini-cart__items::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

/* ── More items button ───────────────────────────────────────────────────── */

.gf-cart-mini-cart__more-btn {
    display: block;
    padding: 10px 16px;
    background: #f9fafb;
    color: #4b5563;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.12s ease, color 0.12s ease;
}

.gf-cart-mini-cart__more-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */

.gf-cart-mini-cart__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 16px;
    color: #9ca3af;
    text-align: center;
}

.gf-cart-mini-cart__empty-icon {
    font-size: 28px;
    line-height: 1;
    opacity: 0.6;
}

.gf-cart-mini-cart__empty-text {
    margin: 0;
    font-size: 14px;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.gf-cart-mini-cart__footer {
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

/* ── Total row ───────────────────────────────────────────────────────────── */

.gf-cart-mini-cart__total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px 8px;
}

.gf-cart-mini-cart__total-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.gf-cart-mini-cart__total-value {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
}

/* ── Checkout button ─────────────────────────────────────────────────────── */

.gf-cart-mini-cart__checkout-btn {
    display: block;
    margin: 0 12px 12px;
    padding: 11px 16px;
    background: #111827;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.15s ease, transform 0.1s ease;
}

.gf-cart-mini-cart__checkout-btn:hover {
    background: #1f2937;
    transform: translateY( -1px );
}

.gf-cart-mini-cart__checkout-btn:active {
    transform: translateY( 0 );
}

.gf-cart-mini-cart__checkout-btn:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* ── Responsive — dropdown goes full-width on small screens ──────────────── */

@media ( max-width: 360px ) {
    .gf-cart-mini-cart {
        width: calc( 100vw - 24px );
        right: -8px;
    }
}

