/**
 * Header cart — aligns with Udrive child / WooCommerce tokens (--uc-* from woocommerce.css).
 */

/* Prevent layout shift in menu-right flex rows */
.main-header .menu-area > .menu-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}

a.udrive-header-cart {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 10px;
    margin: 0;
    border-radius: 999px;
    background: rgba(22, 60, 122, 0.08);
    border: 1px solid rgba(22, 60, 122, 0.15);
    color: #163c7a;
    text-decoration: none !important;
    font-family: "Lexend", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

a.udrive-header-cart:hover,
a.udrive-header-cart:focus {
    background: #163c7a;
    border-color: #163c7a;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(22, 60, 122, 0.25);
    outline: none;
}

a.udrive-header-cart:focus-visible {
    outline: 2px solid #f6b21a;
    outline-offset: 2px;
}

a.udrive-header-cart:hover .udrive-header-cart__badge,
a.udrive-header-cart:focus .udrive-header-cart__badge {
    background: #f6b21a;
    color: #1f2937;
}

.udrive-header-cart__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.udrive-header-cart__icon svg {
    display: block;
    vertical-align: middle;
}

/* Count badge */
.udrive-header-cart__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 5px;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 800;
    line-height: 1;
    background: #f6b21a;
    color: #1f2937;
}

.udrive-header-cart__badge--empty {
    background: rgba(22, 60, 122, 0.12);
    color: #64748b;
    font-weight: 700;
}

a.udrive-header-cart:hover .udrive-header-cart__badge--empty,
a.udrive-header-cart:focus .udrive-header-cart__badge--empty {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

/* Label + price */
.udrive-header-cart__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    min-width: 0;
}

.udrive-header-cart__label {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    opacity: 0.85;
}

.udrive-header-cart__total {
    font-size: 0.8125rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

a.udrive-header-cart .woocommerce-Price-amount {
    font-weight: inherit;
}

/* -------- Responsive -------- */
@media (max-width: 1199px) {
    a.udrive-header-cart {
        padding: 7px 10px 7px 8px;
        gap: 6px;
    }

    .udrive-header-cart__label {
        display: none;
    }

    .udrive-header-cart__meta {
        flex-direction: row;
        align-items: center;
        gap: 6px;
    }
}

@media (max-width: 767px) {
    a.udrive-header-cart {
        padding: 6px 10px;
        border-radius: 12px;
    }

    .udrive-header-cart__total .woocommerce-Price-amount {
        font-size: 0.8125rem;
    }

    /* Icon + badge only on very small screens — hide formatted total to save space */
    .udrive-header-cart__meta {
        display: none;
    }

    a.udrive-header-cart {
        padding: 8px 10px;
    }
}

@media (max-width: 479px) {
    .udrive-header-cart__badge--empty {
        display: none;
    }
}

/* Fallback when theme .menu-right is missing (Elementor header, etc.) */
.elementor-location-header .udrive-header-cart-elementor-slot,
[data-elementor-type="header"] .udrive-header-cart-elementor-slot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
    flex-shrink: 0;
    padding: 4px 0;
    box-sizing: border-box;
}

header .udrive-header-cart-fallback {
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    z-index: 120;
    pointer-events: auto;
}

@media (max-width: 991px) {
    header .udrive-header-cart-fallback {
        right: 56px;
    }
}
