/* ==================== CART DRAWER ==================== */
.cart-drawer {
    position: fixed;
    top: 0;
    inset-inline-end: -440px;
    z-index: 200;
    width: min(420px, 100vw);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--surface-glass);
    border-inline-start: 1px solid var(--line-gold);
    box-shadow: -25px 0 80px rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    transform: translateZ(0);
    will-change: inset-inline-end;
    transition: inset-inline-end 0.35s var(--ease);
    visibility: hidden;
    pointer-events: none;
}

.cart-drawer.active {
    inset-inline-end: 0;
    visibility: visible;
    pointer-events: auto;
}

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--line);
}

.cart-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-size: 20px;
    font-weight: 800;
}

.cart-header h3 i {
    color: var(--gold);
}

.close-cart {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    color: var(--muted);
    border-radius: 50%;
    transition: var(--transition);
}

.close-cart:hover {
    color: var(--text);
    background: var(--surface-3);
}

.cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.cart-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
}

.cart-empty i {
    font-size: 48px;
    color: var(--quiet);
    margin-bottom: 16px;
}

.cart-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    margin-bottom: 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: var(--transition);
}

.cart-item:hover {
    border-color: var(--line-gold);
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.cart-item-qty {
    color: var(--accent);
    font-weight: 800;
    font-size: 14px;
    margin-inline-start: 4px;
}

.cart-item-extras {
    color: var(--muted);
    font-size: 11px;
    margin-bottom: 8px;
}

.cart-item-price {
    color: var(--gold-light);
    font-size: 15px;
    font-weight: 800;
}

.remove-cart-item {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 12px;
    transition: var(--transition);
}

.remove-cart-item:hover {
    background: #e74c3c;
    color: #fff;
}

.cart-footer {
    padding: 24px;
    background: var(--surface-2);
    border-top: 1px solid var(--line);
}

.cart-total-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: 800;
}

.cart-total-row span:last-child {
    color: var(--gold-light);
    font-size: 22px;
}

.cart-checkout-btn {
    width: 100%;
}

/* Cart checkout step */
.cart-checkout-step {
    margin-top: 16px;
    padding: 20px;
    border-top: 1px solid var(--line);
}
.checkout-section {
    margin-bottom: 16px;
}
.checkout-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
}
.checkout-label i {
    color: var(--gold);
}
.checkout-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.checkout-option-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 2px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.checkout-option-btn i {
    font-size: 14px;
}
.checkout-option-btn:hover {
    border-color: var(--line-gold);
    color: var(--gold);
    background: var(--gold-wash);
}
.checkout-option-btn.selected {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-wash);
    box-shadow: 0 0 12px rgba(201, 165, 78, 0.2);
}
.cart-proceed-btn,
.cart-confirm-btn,
.cart-back-btn {
    width: 100%;
    margin-top: 8px;
}
.cart-footer-actions {
    display: flex;
    gap: 8px;
}

.checkout-validation-message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-height: 20px;
    margin: 2px 0 10px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
}

.checkout-validation-message:empty {
    display: none;
}

.checkout-validation-message.is-error {
    color: #ffb4b4;
}

.checkout-validation-message.is-ready {
    color: #8ee6b1;
}

.checkout-validation-message i {
    flex: 0 0 auto;
    margin-top: 2px;
}

.checkout-validation-message.is-error i {
    color: #ed4245;
}

.checkout-validation-message.is-ready i {
    color: #2ecc71;
}

.checkout-validation-message a {
    color: #8ca8ff;
    text-decoration: underline;
}

.cart-footer-actions .btn {
    flex: 1;
}
.cart-buy-btn {
    flex: 2;
}
.cart-clear-btn {
    flex: 1;
}
.cart-confirm-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.overlay {
    position: fixed;
    inset: 0;
    z-index: 180;
    visibility: hidden;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: var(--transition);
}

.overlay.active {
    visibility: visible;
    opacity: 1;
}

/* ==================== CART PAGE ==================== */
.cart-page-main { width:min(760px, calc(100% - 32px)); margin:48px auto; }
.cart-page .cart-drawer { position:relative; inset:auto; width:100%; height:min(780px, calc(100dvh - 150px)); min-height:520px; border:1px solid var(--line-gold); border-radius:18px; box-shadow:0 24px 70px rgba(0,0,0,.38); visibility:visible; pointer-events:auto; }
.cart-page .cart-drawer.active { inset:auto; }
.cart-page-back { display:inline-flex; align-items:center; gap:8px; margin-bottom:18px; color:var(--muted); font-weight:700; }
.cart-page-back:hover { color:var(--gold); }
.cart-tabs { display:grid; grid-template-columns:repeat(3, 1fr); gap:8px; margin-bottom:18px; }
.cart-tab { min-height:52px; padding:10px; border:1px solid var(--line); border-radius:10px; background:var(--surface-2); color:var(--muted); font:inherit; font-size:13px; font-weight:800; cursor:pointer; transition:var(--transition); }
.cart-tab i { display:block; margin-bottom:4px; color:var(--gold); }
.cart-tab:hover, .cart-tab.active { color:var(--text); border-color:var(--gold); background:var(--gold-wash); }
.cart-tab-panel { display:none; }
.cart-tab-panel.active { display:block; }

/* ==================== PURCHASE ORDERS ==================== */
.purchase-empty { min-height:380px; display:grid; place-items:center; text-align:center; padding:42px 24px; border:1px solid var(--line-gold); border-radius:18px; background:var(--surface-glass); }
.purchase-empty i { display:block; margin-bottom:14px; color:var(--gold); font-size:42px; }
.purchase-empty h2 { margin-bottom:8px; color:var(--text); font-size:20px; }
.purchase-empty p { color:var(--muted); font-size:14px; }
.purchase-list { display:grid; gap:12px; }
.purchase-order { padding:18px; border:1px solid var(--line); border-radius:14px; background:var(--surface-glass); }
.purchase-order-button { width:100%; padding:0; border:0; background:transparent; color:inherit; font:inherit; text-align:inherit; cursor:pointer; }
.purchase-order:hover { border-color:var(--gold); background:var(--surface-2); }
.purchase-order-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:8px; }
.purchase-order h2 { color:var(--text); font-size:16px; }
.purchase-order-qty { color:var(--gold); font-size:14px; font-weight:800; margin-inline-start:4px; }
.purchase-order-meta { display:flex; align-items:center; justify-content:space-between; }
.purchase-order p { color:var(--muted); font-size:13px; }
.purchase-status { padding:4px 9px; border-radius:999px; background:var(--gold-wash); color:var(--gold); font-size:11px; font-weight:800; white-space:nowrap; }

/* ==================== ORDER DETAILS MODAL ==================== */
.order-details-modal { position:fixed; inset:0; z-index:500; display:none; place-items:center; padding:20px; background:rgba(0,0,0,.72); backdrop-filter:blur(5px); }
.order-details-modal.active { display:grid; }
.order-details-card { width:min(520px, 100%); max-height:calc(100dvh - 40px); overflow:auto; padding:24px; border:1px solid var(--line-gold); border-radius:16px; background:var(--surface); box-shadow:0 24px 70px rgba(0,0,0,.5); }
.order-details-head { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:18px; }
.order-details-head h2 { font-size:19px; color:var(--text); }
.order-details-close { width:34px; height:34px; border-radius:50%; color:var(--muted); background:var(--surface-2); cursor:pointer; }
.order-detail-row { padding:13px 0; border-top:1px solid var(--line); }
.order-detail-row span { display:block; margin-bottom:3px; color:var(--muted); font-size:12px; }
.order-detail-row strong { color:var(--text); font-size:14px; word-break:break-word; }
.cancel-order-btn { width:100%; margin-top:18px; padding:12px; border:1px solid rgba(231,76,60,.55); border-radius:9px; background:rgba(231,76,60,.12); color:#ff8174; font:inherit; font-weight:800; cursor:pointer; }
.cancel-order-btn:hover { background:rgba(231,76,60,.23); }

@media (max-width: 600px) {
    .cart-page-main { width: calc(100% - 20px); margin: 24px auto; }
    .cart-page .cart-drawer { height: auto; min-height: calc(100dvh - 150px); }
    .cart-tabs { gap: 5px; }
    .cart-tab { min-height: 48px; padding: 8px 4px; font-size: 11px; }
    .cart-footer-actions { flex-direction: column; }
    .cart-item { flex-wrap: wrap; }
    .cart-item-info { min-width: 0; overflow-wrap: anywhere; }
    .purchase-order-head, .purchase-order-meta { align-items: flex-start; flex-direction: column; }
}
