/* ============================================================
   Unseelie Workshop — Cart Drawer Styles
   ============================================================ */

/* ---- Cart icon button (injected into header by cart.js) ---- */

#cart-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--cream);
    display: flex;
    align-items: center;
    position: relative;
    padding: 0.25rem;
    margin-left: 1.5rem;
    flex-shrink: 0;
    transition: color 0.3s ease;
    z-index: 201; /* above nav z-index so it stays clickable when mobile nav is open */
}

#cart-icon-btn:hover {
    color: var(--gold);
}

/* ---- Badge ---- */

#cart-badge {
    position: absolute;
    top: -5px;
    right: -7px;
    background: var(--gold);
    color: #0f1513;
    font-family: 'Jost', sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#cart-badge.cart-badge-visible {
    opacity: 1;
    transform: scale(1);
}

/* ---- Pulse animation on add-to-cart ---- */

@keyframes cart-icon-pulse {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.3); }
    65%  { transform: scale(0.92); }
    100% { transform: scale(1); }
}

#cart-icon-btn.cart-icon-pulse svg {
    animation: cart-icon-pulse 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* ---- Backdrop ---- */

#cart-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

body.cart-open #cart-backdrop {
    opacity: 1;
    pointer-events: auto;
}

/* ---- Drawer panel ---- */

#cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(15, 21, 19, 0.98);
    border-left: 1px solid rgba(201, 169, 97, 0.2);
    z-index: 1101;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    outline: none;
    overflow: hidden;
}

body.cart-open #cart-drawer {
    transform: translateX(0);
}

/* ---- Drawer header ---- */

#cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid rgba(201, 169, 97, 0.15);
    flex-shrink: 0;
}

#cart-drawer-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    font-weight: 300;
    font-style: italic;
    color: var(--gold);
    letter-spacing: 1px;
    margin: 0;
}

#cart-close-btn {
    background: none;
    border: 1px solid rgba(201, 169, 97, 0.2);
    color: rgba(245, 241, 232, 0.5);
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.2s ease, border-color 0.2s ease;
}

#cart-close-btn:hover {
    color: var(--gold);
    border-color: var(--gold);
}

/* ---- Drawer body (scrollable) ---- */

#cart-drawer-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(201, 169, 97, 0.2) transparent;
}

#cart-drawer-body::-webkit-scrollbar {
    width: 4px;
}

#cart-drawer-body::-webkit-scrollbar-track {
    background: transparent;
}

#cart-drawer-body::-webkit-scrollbar-thumb {
    background: rgba(201, 169, 97, 0.2);
    border-radius: 2px;
}

/* ---- Empty state ---- */

#cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    gap: 0.6rem;
    min-height: 300px;
}

.cart-empty-ornament {
    font-size: 2rem;
    opacity: 0.2;
    display: block;
    margin-bottom: 0.75rem;
}

.cart-empty-text {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 300;
    font-style: italic;
    color: rgba(245, 241, 232, 0.45);
}

.cart-empty-sub {
    font-size: 0.72rem;
    color: rgba(245, 241, 232, 0.25);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.cart-shop-link {
    font-size: 0.75rem;
    padding: 0.75rem 1.75rem;
    letter-spacing: 1.5px;
}

/* ---- Line items ---- */

#cart-items-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cart-item {
    display: grid;
    grid-template-columns: 2.5rem 1fr auto;
    align-items: center;
    gap: 0.65rem 0.9rem;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid rgba(201, 169, 97, 0.07);
    transition: background 0.15s ease;
}

.cart-item:hover {
    background: rgba(255, 255, 255, 0.018);
}

.cart-item-thumb {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 2px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item-thumb-fallback {
    font-size: 0.9rem;
    opacity: 0.3;
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.cart-item-name {
    font-size: 0.88rem;
    color: var(--cream);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-collection {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(245, 241, 232, 0.3);
}

.cart-item-price {
    font-size: 0.8rem;
    color: var(--gold);
    font-weight: 300;
    letter-spacing: 0.5px;
    margin-top: 0.1rem;
}

.cart-item-controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.cart-qty-btn {
    background: none;
    border: 1px solid rgba(201, 169, 97, 0.2);
    color: rgba(245, 241, 232, 0.55);
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 2px;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.cart-qty-btn:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.cart-qty-display {
    min-width: 1.25rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--cream);
    font-weight: 300;
}

.cart-remove-btn {
    background: none;
    border: none;
    color: rgba(245, 241, 232, 0.2);
    font-size: 1rem;
    cursor: pointer;
    padding: 0 0.15rem;
    line-height: 1;
    margin-left: 0.2rem;
    transition: color 0.2s ease;
}

.cart-remove-btn:hover {
    color: rgba(245, 241, 232, 0.6);
}

/* ---- Drawer footer ---- */

#cart-drawer-footer {
    border-top: 1px solid rgba(201, 169, 97, 0.15);
    padding: 1.25rem 1.75rem 1.75rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

#cart-subtotal-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 0.25rem;
}

.cart-subtotal-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(245, 241, 232, 0.4);
}

.cart-subtotal-value {
    font-family: 'Jost', sans-serif;
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--gold);
    letter-spacing: 0.5px;
}

#cart-checkout-btn {
    width: 100%;
    padding: 1rem 2rem;
    font-size: 0.8rem;
    letter-spacing: 2px;
}

#cart-checkout-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.45;
}

.cart-footer-note {
    font-size: 0.67rem;
    color: rgba(245, 241, 232, 0.28);
    text-align: center;
    letter-spacing: 0.3px;
    font-style: italic;
    line-height: 1.7;
}

.cart-footer-note a {
    color: rgba(245, 241, 232, 0.38);
    text-decoration: none;
    transition: color 0.2s ease;
}

.cart-footer-note a:hover {
    color: var(--gold);
}

#cart-checkout-error {
    display: none;
    font-size: 0.75rem;
    color: #e07070;
    text-align: center;
    letter-spacing: 0.3px;
    line-height: 1.5;
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
    /* Keep icon in header row alongside hamburger on mobile */
    #cart-icon-btn {
        margin-left: 0.75rem;
        flex-shrink: 0;
    }
}

@media (max-width: 480px) {
    #cart-drawer {
        width: 100vw;
        border-left: none;
        border-top: 1px solid rgba(201, 169, 97, 0.12);
    }
}
