/**
 * MyTasbih Cart Page Styles
 * @package MyTasbih Theme
 */

/* Base */
.cart-page { padding: 30px 20px 60px; min-height: 70vh; font-family: 'Inter', -apple-system, sans-serif; }
.cart-container { max-width: 1100px; margin: 0 auto; }
.cart-header { text-align: center; margin-bottom: 30px; }
.cart-page .back-link { display: inline-block; color: var(--accent); text-decoration: none; font-size: 14px; margin-bottom: 12px; }
.cart-page .back-link:hover { text-decoration: underline; }
.cart-header h1 { font: 700 32px 'Amiri', serif; color: var(--text); margin: 0; }
.page-wrapper.dark .cart-header h1 { color: var(--text-dark); }

/* Layout */
.cart-layout { display: grid; grid-template-columns: 1fr 380px; gap: 40px; align-items: start; }

/* Cart Items */
.cart-items { display: flex; flex-direction: column; gap: 0; }
.items-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid #e5e5e5; }
.page-wrapper.dark .items-title { color: var(--text-dark); border-color: rgba(255,255,255,0.1); }
.items-count { color: #666; font-weight: 400; }

/* Cart Card */
.cart-card {
    display: flex;
    gap: 16px;
    padding: 20px 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid #e5e5e5;
    align-items: center;
}
.page-wrapper.dark .cart-card { border-color: rgba(255,255,255,0.1); }
.cart-card:last-child { border-bottom: none; }
.cart-card.removing { opacity: 0.4; }

.card-image { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: #f5f5f5; border: 1px solid #e5e5e5; }
.page-wrapper.dark .card-image { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); }

.card-details { flex: 1; min-width: 0; }
.card-name { font-size: 15px; font-weight: 500; color: var(--text); margin: 0 0 4px; }
.page-wrapper.dark .card-name { color: var(--text-dark); }
.card-variant { font-size: 13px; color: #666; display: block; }
.page-wrapper.dark .card-variant { color: #9ca3af; }

/* Quantity Selector */
.card-qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    width: auto;
}
.page-wrapper.dark .card-qty { border-color: rgba(255,255,255,0.2); }

.qty-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f9fafb;
    font-size: 16px;
    cursor: pointer;
    color: var(--text);
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}
.qty-btn:focus { background: #e5e7eb; outline: none; }
.qty-btn:hover { background: #e5e7eb; }
.page-wrapper.dark .qty-btn { background: rgba(255,255,255,0.05); color: var(--text-dark); }
.page-wrapper.dark .qty-btn:focus { background: rgba(255,255,255,0.1); }
.page-wrapper.dark .qty-btn:hover { background: rgba(255,255,255,0.1); }

.qty-num {
    width: 40px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    background: #fff;
}
.page-wrapper.dark .qty-num { color: var(--text-dark); background: transparent; }

/* Price & Remove */
.card-price {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    min-width: 80px;
    text-align: right;
    flex-shrink: 0;
}
.page-wrapper.dark .card-price { color: var(--text-dark); }

.card-remove {
    width: 36px;
    height: 36px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
    font-size: 20px;
    color: #666;
    line-height: 1;
}
.card-remove:hover { background: #fef2f2; border-color: #fca5a5; color: #dc2626; }
.page-wrapper.dark .card-remove { background: transparent; border-color: rgba(255,255,255,0.2); color: #9ca3af; }
.page-wrapper.dark .card-remove:hover { background: rgba(220,38,38,0.1); border-color: rgba(220,38,38,0.3); color: #f87171; }

/* Order Summary */
.cart-summary {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 24px;
    position: sticky;
    top: 20px;
}
.page-wrapper.dark .cart-summary { background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.1); }
.cart-summary h2 { font-size: 18px; font-weight: 600; color: var(--text); margin: 0 0 20px; padding-bottom: 16px; border-bottom: 1px solid #e5e5e5; }
.page-wrapper.dark .cart-summary h2 { color: var(--text-dark); border-color: rgba(255,255,255,0.1); }

.summary-info { display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid #e5e5e5; }
.page-wrapper.dark .summary-info { border-color: rgba(255,255,255,0.1); }
.info-row { display: flex; justify-content: space-between; font-size: 14px; color: #666; }
.page-wrapper.dark .info-row { color: #9ca3af; }
.info-row .free { color: #16a34a; font-weight: 600; }

/* Summary Animations */
.cart-summary.updating { animation: summaryPulse 0.5s ease; }
@keyframes summaryPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(212,175,55,0); }
    50% { box-shadow: 0 0 0 3px rgba(212,175,55,0.2); }
}
.summary-total.highlight { animation: totalHighlight 0.6s ease; }
@keyframes totalHighlight {
    0%, 100% { background: transparent; }
    40% { background: rgba(212,175,55,0.1); }
}

.bundle-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(212,175,55,0.06);
    border: 1px solid rgba(212,175,55,0.12);
    border-radius: 4px;
    padding: 10px 12px;
    margin: 8px 0;
    font-size: 13px;
    color: #666;
}
.page-wrapper.dark .bundle-hint { background: rgba(212,175,55,0.08); border-color: rgba(212,175,55,0.15); color: #aaa; }
.bundle-hint strong { color: var(--accent); }

.summary-subtotal {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 14px;
    color: #666;
    border-top: 1px solid rgba(0,0,0,0.06);
    margin-top: 16px;
}
.page-wrapper.dark .summary-subtotal { color: #aaa; border-color: rgba(255,255,255,0.08); }

.summary-discount { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; color: #16a34a; }
.discount-value { font-weight: 600; }

.summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0 0;
    margin-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.06);
}
.page-wrapper.dark .summary-total { border-color: rgba(255,255,255,0.08); }
.summary-total span:first-child { font-size: 16px; font-weight: 700; color: var(--text); }
.page-wrapper.dark .summary-total span:first-child { color: var(--text-dark); }
.total-price { font-size: 20px; font-weight: 700; color: var(--accent); }

.btn-checkout {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: #fff;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    margin-top: 20px;
    transition: background 0.2s;
    border: none;
}
.btn-checkout:hover { background: #b8972e; }

.secure-text { text-align: center; font-size: 12px; color: #888; margin: 14px 0 0; }

/* Empty Cart */
.empty-cart { text-align: center; padding: 80px 20px; max-width: 500px; margin: 0 auto; }
.empty-icon { font-size: 64px; margin-bottom: 20px; opacity: 0.3; }
.empty-cart h2 { font-size: 24px; color: var(--text); margin-bottom: 12px; font-weight: 600; }
.page-wrapper.dark .empty-cart h2 { color: var(--text-dark); }
.empty-cart p { color: #666; margin-bottom: 24px; font-size: 15px; line-height: 1.5; }
.page-wrapper.dark .empty-cart p { color: #9ca3af; }
.btn-primary {
    display: inline-block;
    padding: 14px 32px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 15px;
    transition: background 0.2s;
}
.btn-primary:hover { background: #b8972e; }

/* Responsive */
@media (max-width: 800px) {
    .cart-layout { grid-template-columns: 1fr; gap: 24px; }
    .cart-summary { position: static; }
    .cart-page { padding: 20px 16px 40px; }
    .cart-header h1 { font-size: 26px; }
    .card-image { width: 64px; height: 64px; }
    .cart-card { gap: 12px; padding: 16px 0; flex-wrap: wrap; }
    .card-details { flex: 1; min-width: 120px; }
    .card-name { font-size: 14px; }
    .card-variant { font-size: 12px; }
    .card-price { font-size: 14px; min-width: auto; }
    .card-remove { width: 32px; height: 32px; font-size: 18px; }
    .qty-btn { width: 32px; height: 32px; font-size: 14px; }
    .qty-num { width: 28px; font-size: 13px; }
    .cart-summary { padding: 20px 16px; }
    .cart-summary h2 { font-size: 16px; margin-bottom: 16px; padding-bottom: 12px; }
    .btn-checkout { padding: 14px; font-size: 15px; }
    .items-title { font-size: 16px; }
}

@media (max-width: 480px) {
    .cart-page { padding: 16px 12px 32px; }
    .cart-header h1 { font-size: 22px; }
    .cart-card {
        display: grid;
        grid-template-columns: 56px 1fr auto;
        grid-template-rows: auto auto;
        gap: 8px 10px;
    }
    .card-image { width: 56px; height: 56px; grid-row: 1 / 3; }
    .card-details { grid-column: 2 / 4; }
    .card-qty { grid-column: 2; grid-row: 2; justify-self: start; }
    .card-price { grid-column: 3; grid-row: 2; align-self: center; text-align: right; }
    .card-remove { position: absolute; top: 16px; right: 0; border: none; background: none; }
    .cart-card { position: relative; padding-right: 32px; }
    .empty-cart { padding: 50px 16px; }
    .empty-icon { font-size: 48px; }
    .empty-cart h2 { font-size: 20px; }
    .empty-cart p { font-size: 14px; }
}