/* Shop shared: cart drawer, cart page, checkout, success */
.shop-cart-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid #e3dbd0;
    border-radius: 50%;
    background: white;
    text-decoration: none;
    color: #171717;
    font-size: 1.1rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.shop-cart-btn:hover { border-color: #171717; background: #fafafa; }
.shop-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #171717;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Cart drawer */
.shop-cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 2100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}
.shop-cart-overlay.active { opacity: 1; visibility: visible; }

.shop-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 420px;
    height: 100%;
    background: white;
    z-index: 2101;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.4, 1);
    box-shadow: -8px 0 32px rgba(0,0,0,0.12);
}
.shop-cart-drawer.open { transform: translateX(0); }

.cart-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #e5e5e5;
}
.cart-drawer-header h2 { font-size: 1.15rem; font-weight: 600; margin: 0; }
.cart-drawer-close {
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    color: #525252;
    padding: 4px 8px;
}
.cart-drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.cart-drawer-empty { text-align: center; color: #737373; padding: 48px 16px; font-size: 0.9rem; }
.cart-drawer-list { display: flex; flex-direction: column; gap: 16px; }
.cart-drawer-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    position: relative;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}
.cart-drawer-item img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 4px;
    background: #f5f5f5;
    flex-shrink: 0;
}
.cart-drawer-item-info { flex: 1; min-width: 0; padding-right: 24px; }
.cart-drawer-item-title { font-size: 0.85rem; font-weight: 600; line-height: 1.35; margin-bottom: 4px; }
.cart-item-opt, .cart-item-note { font-size: 0.75rem; color: #737373; margin-bottom: 2px; }
.cart-drawer-item-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.cart-drawer-item-price { font-size: 0.85rem; font-weight: 600; }
.cart-qty-mini {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    overflow: hidden;
}
.cart-qty-mini button {
    width: 28px;
    height: 28px;
    border: none;
    background: white;
    cursor: pointer;
    font-size: 0.95rem;
}
.cart-qty-mini button:hover { background: #f5f5f5; }
.cart-qty-mini span { min-width: 24px; text-align: center; font-size: 0.8rem; border-left: 1px solid #d4d4d4; border-right: 1px solid #d4d4d4; line-height: 28px; }
.cart-drawer-remove {
    position: absolute;
    top: 0;
    right: 0;
    border: none;
    background: none;
    font-size: 1.2rem;
    color: #a3a3a3;
    cursor: pointer;
    line-height: 1;
}
.cart-drawer-footer {
    padding: 16px 20px 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    border-top: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cart-drawer-subtotal {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    font-weight: 600;
}
.cart-drawer-hint { font-size: 0.75rem; color: #737373; margin: 0 0 4px; }

/* Shared buttons (also on product page) */
.shop-btn-primary {
    width: 100%;
    padding: 16px 24px;
    background: #171717;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: background 0.15s;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    box-sizing: border-box;
}
.shop-btn-primary:hover { background: #404040; color: white; }
.shop-btn-primary:disabled { background: #a3a3a3; cursor: not-allowed; }
.shop-btn-secondary {
    width: 100%;
    padding: 14px 24px;
    background: white;
    color: #171717;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    box-sizing: border-box;
}
.shop-btn-secondary:hover { border-color: #171717; color: #171717; }

/* Cart / Checkout layout */
.shop-page { padding: 32px 0 64px; max-width: 1100px; margin: 0 auto; }
.shop-page-title { font-size: 1.75rem; font-weight: 600; margin-bottom: 24px; color: #171717; }
.shop-checkout-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 48px;
    align-items: start;
}
.shop-form-section { margin-bottom: 28px; }
.shop-form-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e5e5;
}
.shop-field { margin-bottom: 14px; }
.shop-field label { display: block; font-size: 0.8rem; font-weight: 600; margin-bottom: 6px; color: #171717; }
.shop-field label .req { color: #dc2626; }
.shop-field input, .shop-field select, .shop-field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.shop-field input:focus, .shop-field select:focus, .shop-field textarea:focus {
    outline: none;
    border-color: #171717;
}
.shop-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shop-field-hint { font-size: 0.72rem; color: #737373; margin-top: 4px; }

.shop-order-summary {
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 24px;
    position: sticky;
    top: 88px;
}
.shop-order-summary h2 { font-size: 1rem; font-weight: 600; margin-bottom: 16px; }
.shop-summary-items { max-height: 280px; overflow-y: auto; margin-bottom: 16px; }
.shop-summary-item {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 0.85rem;
}
.shop-summary-item img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
    background: #eee;
}
.shop-summary-item-info { flex: 1; }
.shop-summary-item-title { font-weight: 600; line-height: 1.3; }
.shop-summary-item-meta { color: #737373; font-size: 0.75rem; margin-top: 2px; }
.shop-summary-line {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.9rem;
    border-top: 1px solid #e5e5e5;
}
.shop-summary-line.total { font-weight: 700; font-size: 1.05rem; border-top-width: 2px; margin-top: 4px; }

.shop-alert {
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-bottom: 20px;
}
.shop-alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.shop-alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

.shop-payment-options { display: flex; flex-direction: column; gap: 10px; }
.shop-payment-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid #d4d4d4;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s;
}
.shop-payment-option.selected { border-color: #171717; background: #fafafa; }
.shop-payment-option input { margin: 0; }

/* Success page */
.shop-success {
    text-align: center;
    max-width: 560px;
    margin: 48px auto;
    padding: 0 20px;
}
.shop-success-icon {
    width: 64px;
    height: 64px;
    background: #dcfce7;
    color: #16a34a;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 20px;
}
.shop-success h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 12px; }
.shop-success p { color: #525252; line-height: 1.6; margin-bottom: 8px; }
.shop-success-order {
    background: #fafafa;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 20px;
    margin: 24px 0;
    text-align: left;
}
.shop-success-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
.shop-success-actions .shop-btn-primary,
.shop-success-actions .shop-btn-secondary { width: auto; min-width: 160px; }

.shop-loading-inline {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: shopSpin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}
@keyframes shopSpin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
    .shop-checkout-grid { grid-template-columns: 1fr; gap: 32px; }
    .shop-order-summary { position: static; order: -1; }
    .shop-field-row { grid-template-columns: 1fr; }
    .shop-cart-drawer { max-width: 100%; }
}

@media (max-width: 480px) {
    .shop-page-title { font-size: 1.4rem; }
}

.hidden { display: none !important; }
