/**
 * Cart Drawer Styles
 *
 * @package Sonnex
 */

/* =============================================================================
   CART DRAWER OVERLAY
   ============================================================================= */

.sonnex-cart-drawer {
    position: fixed;
    inset: 0;
    z-index: 9999;
    visibility: hidden;
    pointer-events: none;
}

.sonnex-cart-drawer[aria-hidden="false"] {
    visibility: visible;
    pointer-events: auto;
}

.sonnex-cart-drawer__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s var(--ease-out-expo);
}

.sonnex-cart-drawer[aria-hidden="false"] .sonnex-cart-drawer__overlay {
    opacity: 1;
}

/* =============================================================================
   CART DRAWER PANEL
   ============================================================================= */

.sonnex-cart-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 440px;
    background: var(--surface-primary, #fff);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s var(--ease-out-expo);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
}

.sonnex-cart-drawer[aria-hidden="false"] .sonnex-cart-drawer__panel {
    transform: translateX(0);
}

/* Header */
.sonnex-cart-drawer__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
}

.sonnex-cart-drawer__title {
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sonnex-cart-drawer__count {
    font-weight: 400;
    color: var(--text-tertiary);
}

.sonnex-cart-drawer__close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s, transform 0.2s;
}

.sonnex-cart-drawer__close:hover {
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* Content */
.sonnex-cart-drawer__content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Empty State */
.sonnex-cart-drawer__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    color: var(--text-tertiary);
    gap: 1rem;
}

.sonnex-cart-drawer__empty svg {
    opacity: 0.4;
}

.sonnex-cart-drawer__empty p {
    font-size: 1.125rem;
    margin: 0;
}

/* Footer */
.sonnex-cart-drawer__footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-light);
    background: var(--surface-secondary, #fafafa);
}

.sonnex-cart-drawer__subtotal {
    display: flex;
    justify-content: space-between;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.sonnex-cart-drawer__note {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    margin: 0 0 1.5rem;
}

.sonnex-cart-drawer__actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sonnex-btn--full {
    width: 100%;
}

/* =============================================================================
   CART ITEMS
   ============================================================================= */

.sonnex-cart-drawer__items {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sonnex-cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
}

.sonnex-cart-item:last-child {
    border-bottom: none;
}

.sonnex-cart-item__image {
    aspect-ratio: 1;
    background: var(--surface-secondary);
    overflow: hidden;
}

.sonnex-cart-item__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sonnex-cart-item__details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sonnex-cart-item__name {
    font-size: 0.9375rem;
    font-weight: 600;
    margin: 0;
}

.sonnex-cart-item__name a {
    color: inherit;
    text-decoration: none;
}

.sonnex-cart-item__name a:hover {
    color: var(--color-accent);
}

.sonnex-cart-item__price {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.sonnex-cart-item__quantity {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-medium);
    margin-top: 0.5rem;
}

.qty-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.125rem;
    color: var(--text-secondary);
    transition: background 0.2s, color 0.2s;
}

.qty-btn:hover {
    background: var(--surface-secondary);
    color: var(--text-primary);
}

.qty-input {
    width: 40px;
    height: 32px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--border-medium);
    border-right: 1px solid var(--border-medium);
    font-size: 0.875rem;
    font-weight: 600;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sonnex-cart-item__remove {
    align-self: start;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: color 0.2s;
}

.sonnex-cart-item__remove:hover {
    color: var(--color-error, #ef4444);
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 480px) {
    .sonnex-cart-drawer__panel {
        max-width: 100%;
    }
}

/* Body scroll lock when cart open */
body.cart-drawer-open {
    overflow: hidden;
}