/* Header action buttons — categories, cart, account */
.header-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #1e293b;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.header-action:hover {
    background: #f1f5f9;
    border-color: #e2e8f0;
}

.header-action:focus-visible {
    outline: 2px solid #16a34a;
    outline-offset: 2px;
}

.user-actions {
    gap: 6px;
}

.user-actions .header-categories-nav__toggle {
    padding: 0;
    min-width: 44px;
}

.user-actions .icon,
.user-actions .cart-icon {
    display: none;
}

/* Account dropdown */
.header-account {
    position: relative;
}

.header-account__trigger {
    padding: 0 14px;
    white-space: nowrap;
}

.header-account__chevron {
    margin-left: 2px;
    opacity: 0.65;
    transition: transform 0.2s ease;
}

.header-account--open .header-account__chevron {
    transform: rotate(180deg);
}

.header-account__menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 210px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
    overflow: hidden;
    z-index: 5100;
}

.header-account--open .header-account__menu {
    display: block;
}

.header-account__menu a {
    display: block;
    padding: 11px 16px;
    color: #1e293b;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 1px solid #f1f5f9;
}

.header-account__menu a:last-child {
    border-bottom: none;
}

.header-account__menu a:hover {
    background: #f8fafc;
    color: #16a34a;
}

/* Cart */
.header-cart {
    position: relative;
}

.header-cart__trigger {
    position: relative;
    padding: 0 10px;
}

.header-cart__icon {
    display: block;
}

.header-cart__badge {
    position: absolute;
    top: 4px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #16a34a;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-sizing: border-box;
}

.header-cart__backdrop {
    display: none;
}

.header-cart__drawer {
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    z-index: 5250;
    width: min(400px, 100vw);
    height: 100vh;
    height: 100dvh;
    background: #ffffff;
    border-left: 1px solid #e5e7eb;
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.header-cart--open .header-cart__drawer {
    transform: translateX(0);
    pointer-events: auto;
}

.header-cart__drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 14px;
    border-bottom: 1px solid #eef2f7;
    background: #ffffff;
}

.header-cart__drawer-head-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.header-cart__drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    color: #334155;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.header-cart__drawer-close:hover {
    background: #f8fafc;
    color: #0f172a;
}

.header-cart__drawer-head h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

.header-cart__count {
    font-size: 13px;
    color: #64748b;
}

.header-cart__drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 18px;
    background: #ffffff;
    -webkit-overflow-scrolling: touch;
}

.header-cart__empty {
    margin: 24px 8px;
    color: #64748b;
    font-size: 14px;
    text-align: center;
    line-height: 1.5;
}

.header-cart__items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.header-cart__item {
    display: flex;
    gap: 12px;
    padding: 14px 2px;
    border-bottom: 1px solid #f1f5f9;
    align-items: flex-start;
}

.header-cart__item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.header-cart__item-top {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.header-cart__item-remove {
    margin: 0;
    flex-shrink: 0;
}

.header-cart__item-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.header-cart__item-actions form {
    margin: 0;
}

.header-cart__item-qty {
    min-width: 24px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
}

.header-cart__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    background: #fff;
    color: #334155;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.header-cart__icon-btn:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
}

.header-cart__icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.header-cart__icon-btn--danger {
    color: #dc2626;
    border-color: #fecaca;
}

.header-cart__icon-btn--danger:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #b91c1c;
}

.header-cart__item-price {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.header-cart__item:last-child {
    border-bottom: none;
}

.header-cart__item-image {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.header-cart__item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.header-cart__item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.header-cart__item-name {
    color: #0f172a;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.35;
}

.header-cart__item-name:hover {
    color: #16a34a;
}

.header-cart__item-variant,
.header-cart__item-meta {
    font-size: 12px;
    color: #64748b;
    line-height: 1.35;
}

.header-cart__drawer-foot {
    padding: 16px 18px 22px;
    border-top: 1px solid #eef2f7;
    background: #ffffff;
}

.header-cart__total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    font-size: 14px;
    color: #475569;
}

.header-cart__total strong {
    font-size: 18px;
    color: #0f172a;
}

.header-cart__view-btn,
.header-cart__checkout-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.header-cart__view-btn {
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

.header-cart__view-btn:hover {
    background: #f8fafc;
}

.header-cart__checkout-btn {
    background: #16a34a;
    border: 1px solid #16a34a;
    color: #fff;
}

.header-cart__checkout-btn:hover {
    background: #15803d;
    border-color: #15803d;
}

/* Categories polish */
.header-categories-nav__toggle.header-action {
    color: #1e293b;
}

.header-categories-nav__panel {
    border-radius: 12px;
}

.header-categories-nav__scroll a:hover {
    background: #f0fdf4;
    color: #15803d;
}

body.categories-nav-open {
    overflow: hidden;
}

@media (max-width: 768px) {
    .header-account__trigger {
        padding: 0 12px;
        font-size: 13px;
    }

    .header-cart__drawer {
        width: 100vw;
    }
}
