*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --glass-bg: rgba(255, 255, 255, 0.55);
    --glass-border: rgba(255, 255, 255, 0.6);
    --glass-blur: blur(20px) saturate(160%);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    --bg-base: #fafafa;
    --accent: #007aff;
    --accent-soft: rgba(0, 122, 255, 0.12);
    --text: #1d1d1f;
    --text-dim: rgba(0, 0, 0, 0.6);
    --text-dimmer: rgba(0, 0, 0, 0.38);
    --danger: #ff3b30;
    --danger-soft: rgba(255, 59, 48, 0.1);
    --success: #34c759;
    --warning: #ff9500;
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

html, body {
    width: 100%; min-height: 100%;
    background: var(--bg-base);
    background-image:
        radial-gradient(circle at 10% 30%, rgba(0, 122, 255, 0.03), transparent 30%),
        radial-gradient(circle at 90% 70%, rgba(255, 45, 85, 0.02), transparent 30%);
    background-attachment: fixed;
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
    -webkit-font-smoothing: antialiased;
}

.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
}
.order-note-section {
    margin-bottom: 24px;
    background: rgba(0, 0, 0, 0.02);
    padding: 16px;
    border-radius: 16px;
    border: 1px dashed rgba(0, 0, 0, 0.1);
}
.order-note-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.order-note-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}
.btn-help {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.2s;
}
.btn-help:hover {
    transform: scale(1.1);
}
.note-textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 80px;
    background: #fff;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.note-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.placeholder-list {
    text-align: left;
    margin-bottom: 24px;
    color: var(--text-dim);
    font-size: 0.95rem;
    padding-left: 20px;
}
.placeholder-list li {
    margin-bottom: 12px;
}
.placeholder-list strong {
    color: var(--text);
}
header {
    position: sticky;
    top: 24px;
    margin: 0 auto 40px;
    max-width: 1200px;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

header.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
}

.brand-logo { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.3px; color: var(--text); text-decoration: none; }
.back-link { color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.95rem; transition: color 0.3s; }
.back-link:hover { color: var(--accent); }

main { max-width: 1200px; margin: 0 auto; padding: 0 24px 80px; }
.page-title { font-family: 'Plus Jakarta Sans', sans-serif; margin-bottom: 28px; font-size: 2.2rem; font-weight: 800; letter-spacing: -1px; }

.cart-layout { display: grid; grid-template-columns: 1fr; gap: 30px; align-items: start; }
@media (min-width: 900px) { .cart-layout { grid-template-columns: 1.8fr 1fr; } }

.cart-items { display: flex; flex-direction: column; gap: 16px; }

.empty-cart { padding: 60px 20px; text-align: center; color: var(--text-dim); font-size: 1.1rem; }
.empty-cart i { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; display: block; }
.cart-item {
    padding: 20px;
    display: flex; align-items: center; gap: 20px;
    will-change: transform, opacity;
    transition:
        background 0.4s var(--ease-spring),
        transform 0.4s var(--ease-spring),
        box-shadow 0.4s var(--ease-spring),
        opacity 0.3s ease;
}
.cart-item:hover { background: #fff; transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,0,0,0.05); }
.cart-item.removing {
    transform: scale(0.95) !important;
    opacity: 0 !important;
    pointer-events: none;
}

.item-info { flex: 1; min-width: 0; }
.item-name {
    font-size: 1.15rem; font-weight: 600; margin-bottom: 6px; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; text-overflow: ellipsis; word-wrap: break-word;
}
.item-meta { font-size: 0.8rem; color: var(--success); font-weight: 600; margin-bottom: 6px; }
.item-price { color: var(--accent); font-weight: 700; font-size: 1.1rem; }

.qty-controls {
    display: flex; align-items: center; gap: 12px;
    background: rgba(0,0,0,0.04); padding: 6px; border-radius: 50px; flex-shrink: 0;
}
.btn-qty {
    border: none; background: #fff; width: 32px; height: 32px; border-radius: 50%;
    cursor: pointer; font-weight: bold; font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    will-change: transform;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.btn-qty:hover:not(:disabled) { transform: scale(1.1); }
.btn-qty:active:not(:disabled) { transform: scale(0.95); }
.btn-qty:disabled { opacity: 0.5; cursor: not-allowed; }
.qty-value { font-weight: 600; font-size: 1rem; width: 20px; text-align: center; }

.btn-remove {
    color: var(--danger); background: var(--danger-soft);
    border: none; width: 44px; height: 44px; border-radius: 14px;
    font-size: 1.1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    will-change: transform;
    transition: background 0.3s var(--ease-spring), color 0.3s var(--ease-spring), transform 0.3s var(--ease-spring);
    flex-shrink: 0;
}
.btn-remove:hover { background: var(--danger); color: #fff; transform: scale(1.05); }


.summary-card { padding: 30px; position: sticky; top: 100px; }
.summary-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.4rem; margin-bottom: 24px; font-weight: 800; }
.summary-row { display: flex; justify-content: space-between; margin-bottom: 14px; color: var(--text-dim); font-size: 1rem; }
.summary-total { border-top: 1px solid rgba(0,0,0,0.1); padding-top: 18px; margin-top: 18px; font-size: 1.5rem; font-weight: 800; color: var(--text); }

.btn-checkout {
    width: 100%; padding: 18px; border: none; border-radius: 16px;
    background: var(--text); color: #fff; font-size: 1.15rem; font-weight: 700;
    cursor: pointer; margin-top: 28px;
    will-change: transform;
    transition: background 0.3s var(--ease-spring), transform 0.3s var(--ease-spring), box-shadow 0.3s var(--ease-spring);
}
.btn-checkout:hover:not(:disabled) { background: var(--accent); transform: translateY(-3px); box-shadow: 0 10px 24px var(--accent-soft); }
.btn-checkout:disabled { background: var(--text-dimmer); cursor: not-allowed; }

.wallet-balance { text-align: center; margin-top: 14px; font-size: 0.9rem; color: var(--text-dim); }
.wallet-balance strong { color: #ff9500; font-weight: 700; }
.discount-section { margin-bottom: 24px; background: rgba(0,0,0,0.02); padding: 16px; border-radius: 16px; border: 1px dashed rgba(0,0,0,0.1); }
.discount-input-wrapper { display: flex; gap: 8px; }
.discount-input {
    flex: 1; min-width: 0; padding: 12px 16px; border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.1); font-family: inherit; font-size: 1rem;
    outline: none; transition: border-color 0.3s, box-shadow 0.3s; background: #fff;
}
.discount-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.discount-btn {
    padding: 0 20px; border-radius: 12px; border: none;
    background: var(--text); color: #fff; font-weight: 600;
    cursor: pointer; transition: background 0.3s; white-space: nowrap; flex-shrink: 0;
}
.discount-btn:hover { background: var(--accent); }
.discount-msg { font-size: 0.85rem; margin-top: 8px; font-weight: 600; }
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.2); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 0; pointer-events: none;
    transition: opacity 0.4s var(--ease-spring);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.checkout-modal {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 28px; padding: 40px; text-align: center;
    max-width: 420px; width: 90%;
    box-shadow: var(--glass-shadow);
    will-change: transform;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.4s var(--ease-spring);
}
.modal-overlay.active .checkout-modal { transform: translateY(0) scale(1); }

.modal-icon { font-size: 4.5rem; color: var(--success); margin-bottom: 24px; text-shadow: 0 8px 24px rgba(52, 199, 89, 0.3); }
.modal-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 12px; letter-spacing: -0.5px; }
.modal-text { color: var(--text-dim); margin-bottom: 30px; line-height: 1.6; font-size: 1.05rem; }
.modal-btn {
    background: var(--accent); color: white; border: none;
    padding: 16px 32px; border-radius: 100px; font-weight: 700;
    font-size: 1.05rem; cursor: pointer; width: 100%;
    will-change: transform;
    transition: background 0.3s var(--ease-spring), box-shadow 0.3s var(--ease-spring), transform 0.3s var(--ease-spring);
}
.modal-btn:hover { background: #0062cc; box-shadow: 0 10px 24px var(--accent-soft); transform: translateY(-2px); }
@media (max-width: 768px) {
    header { margin: 12px auto 24px; padding: 10px 20px; }
    .brand-logo { font-size: 1.2rem; }
    .back-link { font-size: 0.85rem; }
    main { padding: 0 12px 60px; }
    .page-title { font-size: 1.75rem; margin-bottom: 20px; text-align: center; }
    .summary-card { padding: 20px; position: relative; top: 0; }
    .summary-title { font-size: 1.25rem; margin-bottom: 18px; }
    .summary-total { font-size: 1.35rem; }
    .btn-checkout { padding: 16px; font-size: 1.1rem; margin-top: 20px; }
}

@media (max-width: 600px) {
    .cart-item { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 16px; align-items: center; }
    .item-info { grid-column: span 2; }
    .item-name { font-size: 1.05rem; margin-bottom: 4px; }
    .item-price { font-size: 1rem; }
    .qty-controls { grid-column: 1; justify-self: start; padding: 4px 8px; }
    .btn-qty { width: 28px; height: 28px; font-size: 1rem; }
    .qty-value { font-size: 0.9rem; width: 18px; }
    .btn-remove { grid-column: 2; justify-self: end; width: 38px; height: 38px; border-radius: 10px; font-size: 1rem; }
    .discount-section { padding: 12px; margin-bottom: 16px; }
    .discount-input { padding: 10px 12px; font-size: 0.9rem; }
    .discount-btn { padding: 0 14px; font-size: 0.9rem; }
}

@media (max-width: 380px) {
    .discount-input-wrapper { flex-direction: column; gap: 8px; }
    .discount-btn { width: 100%; padding: 12px; text-align: center; }
}