/* ============================================================
   cart.css
   استایل‌های اختصاصی سبد خرید در فرانت‌اند سیت‌لند
   نسخه مدرن و یکپارچه
   ============================================================ */

/* ============================================================
   متغیرها و تنظیمات پایه
   ============================================================ */
.sl-cart-page {
    --sl-cart-primary: #f4bd08;
    --sl-cart-primary-dark: #d9a700;
    --sl-cart-bg: #f1f5f9;
    --sl-cart-card: #ffffff;
    --sl-cart-text: #0f172a;
    --sl-cart-text-muted: #64748b;
    --sl-cart-border: #e2e8f0;
    --sl-cart-success: #22c55e;
    --sl-cart-danger: #ef4444;
    --sl-cart-warning: #f59e0b;
    --sl-cart-radius: 16px;
    --sl-cart-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
}

/* ============================================================
   کانتینر اصلی سبد خرید
   ============================================================ */
.sl-cart-page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px 40px;
    font-family: 'Estedad', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    direction: rtl;
    color: var(--sl-cart-text);
    background: var(--sl-cart-bg);
    min-height: 100vh;
}

/* ============================================================
   هدر سبد خرید
   ============================================================ */
.sl-cart-hero {
    background: linear-gradient(135deg, #1a1a2e, #0f3460);
    border-radius: var(--sl-cart-radius);
    padding: 30px 35px;
    margin-bottom: 24px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.sl-cart-hero::after {
    content: '';
    position: absolute;
    inset: auto -60px -100px auto;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(244, 189, 8, 0.06);
    pointer-events: none;
}

.sl-cart-hero > div {
    position: relative;
    z-index: 2;
}

.sl-cart-eyebrow {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 50px;
    background: rgba(244, 189, 8, 0.15);
    color: var(--sl-cart-primary);
    font-size: 12px;
    border: 1px solid rgba(244, 189, 8, 0.2);
}

.sl-cart-hero h1 {
    font-size: 28px;
    font-weight: 800;
    margin: 8px 0 4px;
}

.sl-cart-hero p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

.sl-cart-continue {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.sl-cart-continue:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* ============================================================
   پیام‌های سبد خرید
   ============================================================ */
.sl-cart-messages {
    margin-bottom: 16px;
    display: none;
}

.sl-cart-messages.show {
    display: block;
}

.sl-message-content {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
}

.sl-message-content.success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.sl-message-content.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.sl-message-content.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* ============================================================
   گرید اصلی سبد خرید
   ============================================================ */
.sl-cart-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    align-items: start;
}

/* ============================================================
   لیست آیتم‌های سبد خرید
   ============================================================ */
.sl-cart-list {
    background: var(--sl-cart-card);
    border-radius: var(--sl-cart-radius);
    border: 1px solid var(--sl-cart-border);
    overflow: hidden;
    box-shadow: var(--sl-cart-shadow);
}

.sl-cart-list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--sl-cart-border);
    font-size: 14px;
    font-weight: 700;
    color: var(--sl-cart-text);
}

.sl-cart-list-head span {
    font-weight: 400;
    color: var(--sl-cart-text-muted);
    font-size: 13px;
}

/* ============================================================
   آیتم سبد خرید
   ============================================================ */
.sl-cart-item {
    display: grid;
    grid-template-columns: 80px 1fr 140px 140px 40px;
    gap: 16px;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s ease;
}

.sl-cart-item:last-child {
    border-bottom: none;
}

.sl-cart-item:hover {
    background: #fafbfc;
}

.sl-cart-item.removing {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.sl-cart-thumb {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.sl-cart-thumb i {
    font-size: 28px;
    color: #cbd5e1;
}

.sl-cart-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sl-cart-info a {
    font-weight: 700;
    font-size: 15px;
    color: var(--sl-cart-text);
    text-decoration: none;
    transition: color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sl-cart-info a:hover {
    color: var(--sl-cart-primary);
}

.sl-cart-info small {
    font-size: 12px;
    color: var(--sl-cart-text-muted);
}

.sl-cart-info .sl-cart-unit-price {
    font-size: 13px;
    font-weight: 600;
    color: var(--sl-cart-primary-dark);
}

/* کنترل تعداد */
.sl-cart-qty {
    display: flex;
    height: 38px;
    border: 1px solid var(--sl-cart-border);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    width: fit-content;
}

.sl-cart-qty button {
    width: 36px;
    border: none;
    background: #f8fafc;
    color: var(--sl-cart-text);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sl-cart-qty button:hover {
    background: #e2e8f0;
}

.sl-cart-qty button:active {
    transform: scale(0.95);
}

.sl-cart-qty input {
    width: 48px;
    border: none;
    border-left: 1px solid var(--sl-cart-border);
    border-right: 1px solid var(--sl-cart-border);
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    background: #fff;
    color: var(--sl-cart-text);
    outline: none;
    padding: 0;
}

.sl-cart-qty input::-webkit-outer-spin-button,
.sl-cart-qty input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.sl-cart-qty input[type="number"] {
    -moz-appearance: textfield;
}

.sl-cart-qty input:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
}

/* مجموع خط */
.sl-cart-line-total {
    font-weight: 700;
    font-size: 15px;
    color: var(--sl-cart-text);
    white-space: nowrap;
}

.sl-cart-line-total small {
    font-size: 10px;
    font-weight: 400;
    color: var(--sl-cart-text-muted);
}

/* دکمه حذف */
.sl-cart-remove {
    width: 40px;
    height: 40px;
    border: 1px solid #f1e0e2;
    border-radius: 10px;
    background: #fff6f7;
    color: var(--sl-cart-danger);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.sl-cart-remove:hover {
    background: var(--sl-cart-danger);
    color: #fff;
    border-color: var(--sl-cart-danger);
    transform: scale(1.05);
}

/* ============================================================
   خلاصه سبد خرید (سایدبار)
   ============================================================ */
.sl-cart-summary {
    position: sticky;
    top: 20px;
    background: var(--sl-cart-card);
    border-radius: var(--sl-cart-radius);
    border: 1px solid var(--sl-cart-border);
    padding: 0;
    box-shadow: var(--sl-cart-shadow);
    overflow: hidden;
}

.sl-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--sl-cart-border);
}

.sl-summary-header h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sl-summary-header h3 i {
    color: var(--sl-cart-primary);
}

.sl-summary-badge {
    font-size: 11px;
    color: var(--sl-cart-success);
    background: #dcfce7;
    padding: 2px 12px;
    border-radius: 50px;
    font-weight: 600;
}

/* ردیف‌های قیمت */
.sl-summary-rows {
    padding: 16px 20px;
}

.sl-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--sl-cart-text-muted);
}

.sl-summary-row b {
    color: var(--sl-cart-text);
    font-weight: 600;
}

.sl-summary-row.discount b {
    color: var(--sl-cart-danger);
}

.sl-summary-divider {
    border-top: 2px dashed var(--sl-cart-border);
    margin: 8px 0;
}

.sl-summary-total {
    display: flex;
    justify-content: space-between;
    padding: 12px 0 4px;
    font-size: 18px;
    font-weight: 700;
    color: var(--sl-cart-text);
}

.sl-summary-total strong {
    color: var(--sl-cart-primary);
    font-size: 20px;
}

/* بخش کوپن */
.sl-coupon-section {
    padding: 12px 20px 16px;
    border-top: 1px solid var(--sl-cart-border);
}

.sl-coupon-section label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--sl-cart-text-muted);
    margin-bottom: 6px;
}

.sl-coupon-section .sl-coupon-input-group {
    display: flex;
    gap: 8px;
}

.sl-coupon-section .sl-coupon-input-group input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--sl-cart-border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
    background: #f8fafc;
    min-width: 0;
}

.sl-coupon-section .sl-coupon-input-group input:focus {
    border-color: var(--sl-cart-primary);
    box-shadow: 0 0 0 3px rgba(244, 189, 8, 0.08);
    background: #fff;
}

.sl-coupon-section .sl-coupon-input-group input:disabled {
    background: #f1f5f9;
    cursor: not-allowed;
}

.sl-coupon-section .sl-coupon-input-group button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    background: var(--sl-cart-primary);
    color: var(--sl-cart-text);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.sl-coupon-section .sl-coupon-input-group button:hover {
    background: var(--sl-cart-primary-dark);
}

.sl-coupon-section .sl-coupon-input-group button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.sl-coupon-message {
    font-size: 12px;
    margin-top: 6px;
    min-height: 20px;
}

.sl-coupon-message.success {
    color: var(--sl-cart-success);
}

.sl-coupon-message.error {
    color: var(--sl-cart-danger);
}

.sl-remove-coupon {
    background: none;
    border: none;
    color: var(--sl-cart-danger);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    padding: 0 4px;
}

.sl-remove-coupon:hover {
    text-decoration: underline;
}

/* دکمه تسویه حساب */
.sl-checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: calc(100% - 40px);
    margin: 0 20px 16px;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--sl-cart-primary), var(--sl-cart-primary-dark));
    color: var(--sl-cart-text);
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.sl-checkout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(244, 189, 8, 0.3);
}

.sl-checkout-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.sl-checkout-btn i {
    font-size: 18px;
}

/* امنیت */
.sl-cart-security {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    border-top: 1px solid var(--sl-cart-border);
    font-size: 11px;
    color: var(--sl-cart-text-muted);
}

.sl-cart-security span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.sl-cart-security i {
    color: var(--sl-cart-success);
}

/* ============================================================
   سبد خرید خالی
   ============================================================ */
.sl-cart-empty {
    text-align: center;
    padding: 60px 20px;
    background: var(--sl-cart-card);
    border-radius: var(--sl-cart-radius);
    border: 1px solid var(--sl-cart-border);
    box-shadow: var(--sl-cart-shadow);
}

.sl-empty-icon {
    font-size: 60px;
    color: #d1d9e0;
    margin-bottom: 16px;
}

.sl-empty-icon i {
    color: #d1d9e0;
}

.sl-cart-empty h2 {
    font-size: 24px;
    color: var(--sl-cart-text);
    margin: 0 0 6px;
}

.sl-cart-empty p {
    font-size: 14px;
    color: var(--sl-cart-text-muted);
    margin: 0 0 20px;
}

.sl-cart-empty .sl-cart-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 10px;
    background: var(--sl-cart-primary);
    color: var(--sl-cart-text);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
}

.sl-cart-empty .sl-cart-primary:hover {
    background: var(--sl-cart-primary-dark);
    transform: translateY(-2px);
}

/* ============================================================
   نشان‌ها و بج‌ها
   ============================================================ */
.sl-cart-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 50px;
    background: var(--sl-cart-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
}

.sl-cart-badge.is-empty {
    display: none;
}

/* ============================================================
   انیمیشن‌ها
   ============================================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sl-cart-item {
    animation: fadeInUp 0.3s ease forwards;
}

.sl-cart-item:nth-child(1) { animation-delay: 0.05s; }
.sl-cart-item:nth-child(2) { animation-delay: 0.1s; }
.sl-cart-item:nth-child(3) { animation-delay: 0.15s; }
.sl-cart-item:nth-child(4) { animation-delay: 0.2s; }
.sl-cart-item:nth-child(5) { animation-delay: 0.25s; }
.sl-cart-item:nth-child(6) { animation-delay: 0.3s; }
.sl-cart-item:nth-child(7) { animation-delay: 0.35s; }
.sl-cart-item:nth-child(8) { animation-delay: 0.4s; }
.sl-cart-item:nth-child(9) { animation-delay: 0.45s; }
.sl-cart-item:nth-child(10) { animation-delay: 0.5s; }

/* ============================================================
   واکنش‌گرایی
   ============================================================ */
@media (max-width: 1024px) {
    .sl-cart-grid {
        grid-template-columns: 1fr;
    }
    
    .sl-cart-summary {
        position: static;
    }
}

@media (max-width: 768px) {
    .sl-cart-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 24px 20px;
    }
    
    .sl-cart-hero h1 {
        font-size: 22px;
    }
    
    .sl-cart-continue {
        width: 100%;
        justify-content: center;
    }
    
    .sl-cart-item {
        grid-template-columns: 60px 1fr 40px;
        gap: 10px;
        padding: 14px 16px;
    }
    
    .sl-cart-thumb {
        width: 60px;
        height: 60px;
    }
    
    .sl-cart-thumb i {
        font-size: 20px;
    }
    
    .sl-cart-info a {
        font-size: 13px;
    }
    
    .sl-cart-info .sl-cart-unit-price {
        font-size: 12px;
    }
    
    .sl-cart-qty {
        grid-column: 2;
        height: 34px;
    }
    
    .sl-cart-qty button {
        width: 30px;
        font-size: 15px;
    }
    
    .sl-cart-qty input {
        width: 40px;
        font-size: 13px;
    }
    
    .sl-cart-line-total {
        grid-column: 2;
        font-size: 14px;
    }
    
    .sl-cart-remove {
        grid-column: 3;
        grid-row: 1;
        width: 34px;
        height: 34px;
        font-size: 14px;
    }
    
    .sl-checkout-btn {
        width: calc(100% - 32px);
        margin: 0 16px 14px;
        padding: 12px;
        font-size: 14px;
    }
    
    .sl-cart-security {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .sl-cart-page {
        padding: 0 12px 30px;
    }
    
    .sl-cart-hero {
        padding: 20px 16px;
        border-radius: 12px;
    }
    
    .sl-cart-hero h1 {
        font-size: 19px;
    }
    
    .sl-cart-hero p {
        font-size: 13px;
    }
    
    .sl-cart-item {
        grid-template-columns: 50px 1fr 32px;
        gap: 8px;
        padding: 10px 12px;
    }
    
    .sl-cart-thumb {
        width: 50px;
        height: 50px;
    }
    
    .sl-cart-info a {
        font-size: 12px;
    }
    
    .sl-cart-info small {
        font-size: 10px;
    }
    
    .sl-cart-qty {
        height: 30px;
    }
    
    .sl-cart-qty button {
        width: 26px;
        font-size: 13px;
    }
    
    .sl-cart-qty input {
        width: 34px;
        font-size: 12px;
    }
    
    .sl-cart-line-total {
        font-size: 13px;
    }
    
    .sl-cart-remove {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    .sl-summary-rows {
        padding: 12px 16px;
    }
    
    .sl-summary-row {
        font-size: 13px;
        padding: 6px 0;
    }
    
    .sl-summary-total {
        font-size: 16px;
    }
    
    .sl-summary-total strong {
        font-size: 18px;
    }
    
    .sl-coupon-section {
        padding: 10px 16px 14px;
    }
    
    .sl-coupon-section .sl-coupon-input-group input {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .sl-coupon-section .sl-coupon-input-group button {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .sl-checkout-btn {
        font-size: 13px;
        padding: 10px;
    }
}

/* ============================================================
   حالت تاریک (اختیاری)
   ============================================================ */
@media (prefers-color-scheme: dark) {
    .sl-cart-page {
        background: #0f172a;
        color: #e2e8f0;
    }
    
    .sl-cart-list,
    .sl-cart-summary,
    .sl-cart-empty {
        background: #1e293b;
        border-color: #334155;
    }
    
    .sl-cart-list-head {
        background: #1a2332;
        border-color: #334155;
        color: #e2e8f0;
    }
    
    .sl-cart-list-head span {
        color: #94a3b8;
    }
    
    .sl-cart-item {
        border-color: #1e293b;
    }
    
    .sl-cart-item:hover {
        background: #1a2332;
    }
    
    .sl-cart-info a {
        color: #e2e8f0;
    }
    
    .sl-cart-info a:hover {
        color: var(--sl-cart-primary);
    }
    
    .sl-cart-info small {
        color: #94a3b8;
    }
    
    .sl-cart-qty {
        border-color: #334155;
        background: #0f172a;
    }
    
    .sl-cart-qty button {
        background: #1e293b;
        color: #e2e8f0;
    }
    
    .sl-cart-qty button:hover {
        background: #334155;
    }
    
    .sl-cart-qty input {
        background: #0f172a;
        color: #e2e8f0;
        border-color: #334155;
    }
    
    .sl-cart-qty input:disabled {
        background: #1e293b;
    }
    
    .sl-cart-remove {
        background: #2d1a1a;
        border-color: #4a2a2a;
        color: #ef4444;
    }
    
    .sl-cart-remove:hover {
        background: #ef4444;
        color: #fff;
    }
    
    .sl-summary-header {
        background: #1a2332;
        border-color: #334155;
    }
    
    .sl-summary-row {
        color: #94a3b8;
    }
    
    .sl-summary-row b {
        color: #e2e8f0;
    }
    
    .sl-summary-divider {
        border-color: #334155;
    }
    
    .sl-coupon-section {
        border-color: #334155;
    }
    
    .sl-coupon-section .sl-coupon-input-group input {
        background: #0f172a;
        border-color: #334155;
        color: #e2e8f0;
    }
    
    .sl-coupon-section .sl-coupon-input-group input:focus {
        border-color: var(--sl-cart-primary);
        background: #1e293b;
    }
    
    .sl-coupon-section .sl-coupon-input-group input:disabled {
        background: #1e293b;
    }
    
    .sl-cart-security {
        border-color: #334155;
        color: #94a3b8;
    }
    
    .sl-cart-empty h2 {
        color: #e2e8f0;
    }
    
    .sl-cart-empty p {
        color: #94a3b8;
    }
    
    .sl-empty-icon i {
        color: #334155;
    }
}

/* ============================================================
   چاپ
   ============================================================ */
@media print {
    .sl-cart-hero .sl-cart-continue,
    .sl-cart-remove,
    .sl-cart-security,
    .sl-coupon-section {
        display: none !important;
    }
    
    .sl-cart-page {
        background: #fff !important;
        padding: 0 !important;
    }
    
    .sl-cart-list,
    .sl-cart-summary {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
    }
    
    .sl-cart-item {
        border-color: #eee !important;
    }
}

/* ============================================================
   اسکرول‌بار سفارشی
   ============================================================ */
.sl-cart-list::-webkit-scrollbar {
    width: 4px;
}

.sl-cart-list::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.sl-cart-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.sl-cart-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}