/*
===============================================================================
BIG TEXAN D2C - CART DRAWER STYLES
===============================================================================
Styles for the slide-out cart drawer component.
Component HTML: /components/cart-drawer.html
Logic: /js/cart.js
===============================================================================
*/

/* --- CART OVERLAY --- */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* --- CART DRAWER --- */
.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 420px;
    height: 100%;
    background: #1a0005;
    color: #fff7e6;
    border-left: 1px solid rgba(255, 210, 0, 0.2);
    box-shadow: -10px 0 34px rgba(0, 0, 0, 0.45);
    z-index: var(--z-modal);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform var(--transition-base) cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.cart-drawer.open {
    transform: translateX(0);
    visibility: visible;
}

/* --- CART HEADER --- */
.cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 210, 0, 0.16);
    background: #3d0009;
}

.cart-header h2 {
    font-size: var(--text-xl);
    color: var(--texan-yellow);
    margin: 0;
    text-shadow: 0 0 10px rgba(255, 210, 0, 0.35);
}

.cart-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: #fff7e6;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.cart-close:hover {
    background: var(--texan-yellow);
    color: var(--brand-maroon);
}

/* --- CART ITEMS CONTAINER --- */
.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background:
        linear-gradient(180deg, rgba(61, 0, 9, 0.35), rgba(26, 0, 5, 0.95)),
        #1a0005;
}

/* --- EMPTY CART STATE --- */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1rem;
    color: rgba(255, 247, 230, 0.82);
}

.cart-empty svg {
    color: var(--brand-tan);
    margin-bottom: 1rem;
}

.cart-empty p {
    font-size: var(--text-lg);
    margin-bottom: 1.5rem;
}

.cart-empty.hidden {
    display: none;
}

/* --- INDIVIDUAL CART ITEM --- */
.cart-item {
    display: flex;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 210, 0, 0.14);
    margin-bottom: 1rem;
}

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

.cart-item-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
}

.cart-item-link {
    color: inherit;
    text-decoration: none;
}

.cart-item-image-link {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-sm);
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 210, 0, 0.18);
}

.cart-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cart-item-title {
    font-family: var(--font-heading);
    font-size: var(--text-base);
    color: #fff7e6;
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.cart-item-title-link:hover {
    color: var(--texan-yellow);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.cart-item-title-link {
    display: inline-flex;
    min-height: 36px;
    align-items: center;
}

.cart-item-image-link:hover img {
    border-color: rgba(255, 210, 0, 0.62);
}

.cart-item-variant {
    font-size: var(--text-sm);
    color: rgba(255, 247, 230, 0.72);
    margin-bottom: 0.5rem;
}

.cart-item-price {
    font-weight: 700;
    color: var(--texan-yellow);
    font-size: var(--text-base);
}

.cart-item-price--discounted {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.cart-item-price-original {
    color: rgba(255, 247, 230, 0.62);
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: line-through;
}

.cart-item-price-current {
    color: var(--texan-yellow);
    font-size: var(--text-base);
    font-weight: 800;
}

.cart-item-savings {
    display: inline-flex;
    align-self: flex-start;
    margin-top: 0.35rem;
    padding: 0.22rem 0.45rem;
    border: 1px solid rgba(67, 140, 98, 0.42);
    border-radius: var(--radius-full);
    background: rgba(30, 111, 73, 0.08);
    color: var(--color-success);
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.2;
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
}

/* Quantity Controls */
.qty-control {
    display: flex;
    align-items: center;
    border: 1px solid rgba(255, 210, 0, 0.22);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #fff7e6;
}

.cart-drawer .qty-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff7e6;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 800;
    color: var(--brand-maroon);
    transition:
        background var(--transition-fast),
        color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.cart-drawer .qty-btn:hover,
.cart-drawer .qty-btn:focus-visible {
    background: var(--texan-yellow);
    color: var(--brand-maroon);
    box-shadow: inset 0 0 0 2px rgba(107, 0, 13, 0.3);
    outline: none;
}

.cart-drawer .qty-btn:active {
    background: #e2b800;
    color: var(--brand-maroon);
}

.cart-drawer .qty-btn:disabled {
    background: rgba(255, 247, 230, 0.32);
    color: rgba(255, 247, 230, 0.72);
    cursor: not-allowed;
    box-shadow: none;
}

.qty-value {
    width: 38px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    font-size: var(--text-sm);
    font-weight: 600;
    background: #fff7e6;
    border: none;
    border-left: 1px solid rgba(107, 0, 13, 0.18);
    border-right: 1px solid rgba(107, 0, 13, 0.18);
    color: var(--brand-maroon);
}

/* Remove Button */
.cart-item-remove {
    background: none;
    border: none;
    color: rgba(255, 247, 230, 0.74);
    font-size: var(--text-sm);
    cursor: pointer;
    min-height: 40px;
    padding: 0.45rem 0.65rem;
    transition: color var(--transition-fast);
}

.cart-item-remove:hover {
    color: var(--texan-yellow);
}

/* Cart Add-ons */
.cart-addons-slot[hidden] {
    display: none;
}

.cart-addons-slot {
    margin-top: 0.75rem;
    padding: 0.85rem;
    border: 1px solid rgba(255, 210, 0, 0.16);
    border-radius: 8px;
    background: rgba(61, 0, 9, 0.72);
}

.cart-addons-header {
    margin-bottom: 0.7rem;
}

.cart-addons-title {
    margin: 0;
    color: #fff7e6;
    font-family: var(--font-heading);
    font-size: var(--text-base);
    line-height: 1.15;
}

.cart-addons-subtitle {
    margin: 0.2rem 0 0;
    color: rgba(255, 247, 230, 0.72);
    font-size: 0.78rem;
    line-height: 1.35;
}

.cart-addons-grid {
    display: grid;
    gap: 0.5rem;
}

.cart-addon-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 86px;
    align-items: center;
    gap: 0.65rem;
    min-height: 58px;
    padding: 0.65rem 0.7rem;
    border: 1px solid rgba(255, 210, 0, 0.22);
    border-radius: 8px;
    background: rgba(255, 247, 230, 0.055);
}

.cart-addon-item:has(.cart-addon-image) {
    grid-template-columns: 48px minmax(0, 1fr) 82px;
}

.cart-addon-image {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 5px;
    background: rgba(255, 247, 230, 0.1);
}

.cart-addon-body {
    min-width: 0;
}

.cart-addon-title {
    color: #fff7e6;
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.18;
    overflow-wrap: anywhere;
}

.cart-addon-price {
    margin-top: 0.18rem;
    color: var(--texan-yellow);
    font-family: var(--font-heading);
    font-size: 0.86rem;
    font-weight: 800;
}

.cart-addon-add {
    min-height: 34px;
    width: 100%;
    padding: 0 0.55rem;
    border: 1px solid rgba(255, 210, 0, 0.28);
    border-radius: 6px;
    background: #fff7e6;
    color: #6b000d;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 900;
    cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.cart-addon-add:hover {
    transform: translateY(-1px);
    background: var(--texan-yellow);
    color: #3d0009;
}

/* Add-to-cart feedback */
.btn.is-cart-added,
.btn-card.is-cart-added,
.add-to-cart-btn.is-cart-added,
.cart-addon-add.is-cart-added {
    background: #1f7a4d;
    border-color: rgba(143, 226, 179, 0.75);
    color: #fff7e6;
    box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.18);
}

.btn.is-cart-added:hover,
.btn-card.is-cart-added:hover,
.add-to-cart-btn.is-cart-added:hover,
.cart-addon-add.is-cart-added:hover {
    background: #1f7a4d;
    color: #fff7e6;
}

.cart-feedback-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5.5em;
}

.btn.is-shopforge-in-cart,
.btn-card.is-shopforge-in-cart,
.add-to-cart-btn.is-shopforge-in-cart,
.cart-addon-add.is-shopforge-in-cart {
    display: inline-flex;
    min-height: 44px;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0;
    line-height: 1;
    white-space: nowrap;
    padding: 0;
    border-color: transparent !important;
    background: transparent !important;
    box-shadow: none !important;
}

.btn.is-shopforge-in-cart:hover,
.btn-card.is-shopforge-in-cart:hover,
.add-to-cart-btn.is-shopforge-in-cart:hover,
.cart-addon-add.is-shopforge-in-cart:hover {
    transform: none;
    border-color: transparent !important;
    background: transparent !important;
    color: var(--texan-yellow);
    box-shadow: none !important;
}

.sf-cart-action__stepper {
    display: inline-grid;
    width: 100%;
    min-width: 8rem;
    grid-template-columns: 2.35rem minmax(2.6rem, 1fr) 2.35rem;
    align-items: center;
    overflow: hidden;
    border: 1px solid var(--texan-yellow);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.16);
}

.sf-cart-action__label {
    display: block;
    line-height: 1.08;
}

.sf-cart-action__step,
.sf-cart-action__qty {
    display: inline-flex;
    min-height: 2rem;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-weight: 900;
}

.sf-cart-action__step {
    font-size: 1rem;
    cursor: pointer;
    user-select: none;
}

.sf-cart-action__step:hover {
    background: rgba(255, 210, 0, 0.18);
    color: #fff7e6;
}

.sf-cart-action__qty {
    border-right: 1px solid rgba(255, 247, 230, 0.32);
    border-left: 1px solid rgba(255, 247, 230, 0.32);
    font-size: 0.95rem;
}

/* --- CART FOOTER --- */
.cart-footer {
    padding: 0.7rem 1.25rem 0.9rem;
    border-top: 1px solid rgba(255, 210, 0, 0.16);
    background: #3d0009;
    color: #fff7e6;
}

/* Shipping Progress */
.shipping-progress {
    margin-bottom: 0.55rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid rgba(255, 210, 0, 0.16);
}

.shipping-message {
    font-size: 0.8rem;
    text-align: left;
    margin-bottom: 0.28rem;
    color: rgba(255, 247, 230, 0.82);
}

.shipping-message.success {
    color: #8fe2b3;
}

.shipping-progress.is-complete {
    margin-bottom: 0.45rem;
    padding-bottom: 0.4rem;
}

.shipping-progress.is-complete .shipping-message {
    margin-bottom: 0;
}

.shipping-progress.is-complete .progress-bar {
    display: none;
}

.progress-bar {
    height: 4px;
    background: rgba(255, 247, 230, 0.25);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-success);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}

.cart-subscription-savings {
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.55rem;
    padding: 0.5rem 0.7rem;
    border: 1px solid rgba(67, 140, 98, 0.42);
    border-radius: var(--radius-sm);
    background: rgba(30, 111, 73, 0.08);
    color: #fff7e6;
    font-size: 0.82rem;
    font-weight: 700;
}

.cart-subscription-savings strong {
    color: #8fe2b3;
    white-space: nowrap;
}

/* Cart Total */
.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
    font-size: 1rem;
    font-weight: 700;
    color: #fff7e6;
}

.cart-total-amount {
    color: var(--texan-yellow);
    font-family: var(--font-heading);
    font-size: 1.08rem;
}

/* Checkout Button */
.cart-checkout {
    width: 100%;
    margin-bottom: 0.45rem;
    visibility: visible;
    background: #8f1d1d;
    color: #fff7e6;
    border: 1px solid rgba(255, 210, 0, 0.2);
}

.cart-checkout:hover {
    background: #6b000d;
    color: var(--texan-yellow);
}

/* Continue Shopping Link */
.cart-continue {
    display: flex;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: rgba(255, 247, 230, 0.78);
    font-size: 0.82rem;
    text-decoration: underline;
}

.cart-continue:hover {
    color: var(--texan-yellow);
}

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 480px) {
    .cart-drawer {
        max-width: 100%;
    }

    .cart-addon-item {
        grid-template-columns: minmax(0, 1fr) 78px;
    }

    .cart-addon-item:has(.cart-addon-image) {
        grid-template-columns: 44px minmax(0, 1fr) 78px;
    }

    .cart-addon-image {
        width: 44px;
        height: 44px;
    }

    .cart-addon-add {
        min-height: 32px;
    }
}
