/**
 * DiamondTire - Main Stylesheet
 * Diamond Tire - استایل اصلی
 * Modern E-commerce Design System
 */

/* ============================================
   CSS Variables - متغیرهای رنگ و فونت
   ============================================ */
:root {
    /* Primary Colors - رنگ‌های اصلی */
    --primary: #1e3a5f;
    --primary-light: #2c5282;
    --primary-dark: #1a365d;
    
    /* Secondary Colors - رنگ‌های ثانویه */
    --secondary: #3498db;
    --secondary-light: #5dade2;
    --secondary-dark: #2980b9;
    
    /* Accent Colors - رنگ‌های تاکیدی */
    --accent: #e74c3c;
    --accent-light: #ec7063;
    --accent-dark: #c0392b;
    
    /* Success/Warning/Info */
    --success: #27ae60;
    --warning: #f39c12;
    --info: #17a2b8;
    --danger: #e74c3c;
    
    /* Neutral Colors - خاکستری‌ها */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Background */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-dark: #1e293b;
    
    /* Text Colors */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --text-white: #ffffff;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0,0,0,0.25);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition: 300ms ease;
    --transition-slow: 500ms ease;
    
    /* Font */
    --font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Container */
    --container-max: 1400px;
    --header-height: 60px;

    /* Touch target minimum */
    --touch-min: 44px;
}

/* ============================================
   Reset & Base Styles
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    direction: rtl;
    text-align: right;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Typography - تایپوگرافی
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
}

a {
    color: var(--secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--secondary-dark);
}

/* ============================================
   Container - کانتینر
   ============================================ */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 12px;
}

@media (min-width: 768px) {
    .container {
        padding: 0 24px;
    }
}

@media (min-width: 1280px) {
    .container {
        padding: 0 32px;
    }
}

/* ============================================
   Buttons - دکمه‌ها
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-family: inherit;
    font-size: var(--font-size-sm);
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    min-height: var(--touch-min);
    line-height: 1.4;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    color: var(--text-white);
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--text-white);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(231, 76, 60, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #219a52);
    color: var(--text-white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--secondary);
    color: var(--secondary);
}

.btn-outline:hover {
    background: var(--secondary);
    color: var(--text-white);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-full);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--font-size-base);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-xs);
}

/* ============================================
   Form Elements - فرم‌ها
   ============================================ */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    font-family: inherit;
    font-size: 16px;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    min-height: var(--touch-min);
    line-height: 1.5;
    -webkit-appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

.form-input::placeholder {
    color: var(--text-light);
}

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

/* ============================================
   Cards - کارت‌ها
   ============================================ */
.card {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all var(--transition);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-body {
    padding: var(--space-4);
}

/* ============================================
   Badges - نشان‌ها
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
}

.badge-primary {
    background: var(--secondary);
    color: var(--text-white);
}

.badge-accent {
    background: var(--accent);
    color: var(--text-white);
}

.badge-success {
    background: var(--success);
    color: var(--text-white);
}

.badge-warning {
    background: var(--warning);
    color: var(--text-white);
}

/* ============================================
   Utilities - کلاس‌های کاربردی
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }

.bg-primary { background-color: var(--primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-white { background-color: var(--bg-primary); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

.grid { display: grid; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }

@media (min-width: 640px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1280px) {
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

.hidden { display: none; }
.relative { position: relative; }
.absolute { position: absolute; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.shadow { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.overflow-hidden { overflow: hidden; }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================
   Loading Spinner - اسپینر لودینگ
   ============================================ */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--secondary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Animations - انیمیشن‌ها
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.animate-fadeIn { animation: fadeIn var(--transition); }
.animate-slideUp { animation: slideUp var(--transition); }
.animate-slideDown { animation: slideDown var(--transition); }
.animate-pulse { animation: pulse 2s infinite; }
.animate-bounce { animation: bounce 1s infinite; }

/* ============================================
   Scrollbar - اسکرول‌بار سفارشی
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ============================================
   Quantity Selector
   ============================================ */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

.quantity-selector {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--bg-primary);
    overflow: hidden;
}

.quantity-selector button {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-50);
    border: none;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    transition: all 0.2s ease;
    user-select: none;
}

.quantity-selector button:hover {
    background: var(--secondary);
    color: white;
}

.quantity-selector button:active {
    transform: scale(0.92);
}

.quantity-selector input {
    width: 52px;
    height: 44px;
    text-align: center;
    border: none;
    border-left: 1px solid var(--gray-200);
    border-right: 1px solid var(--gray-200);
    font-weight: 600;
    font-size: 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    -moz-appearance: textfield;
}

.quantity-selector input::-webkit-outer-spin-button,
.quantity-selector input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ============================================
   Selection - انتخاب متن
   ============================================ */
::selection {
    background: var(--secondary);
    color: var(--text-white);
}
/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    left: auto;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: 360px;
    max-width: calc(100vw - 40px);
}

.toast {
    position: relative;
    width: 100%;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    padding: 12px 16px;
    pointer-events: auto;
    overflow: hidden;
    animation: toastSlideIn 0.35s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
    border-right: 4px solid;
}

.toast.removing {
    animation: toastSlideOut 0.3s ease-in forwards;
}

.toast.success { border-right-color: var(--success); }
.toast.error { border-right-color: var(--accent); }
.toast.warning { border-right-color: var(--warning); }
.toast.info { border-right-color: var(--secondary); }

.toast-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    margin-left: 12px;
}

.toast.success .toast-icon { color: var(--success); background: rgba(39, 174, 96, 0.1); }
.toast.error .toast-icon { color: var(--accent); background: rgba(231, 76, 60, 0.1); }
.toast.warning .toast-icon { color: var(--warning); background: rgba(243, 156, 18, 0.1); }
.toast.info .toast-icon { color: var(--secondary); background: rgba(52, 152, 219, 0.1); }

.toast-content { flex: 1; min-width: 0; }

.toast-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.toast-message {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    flex-shrink: 0;
    transition: color 0.2s;
    line-height: 1;
}

.toast-close:hover { color: var(--text-primary); }

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gray-200);
}

.toast.success .toast-progress { background: rgba(39, 174, 96, 0.15); }
.toast.error .toast-progress { background: rgba(231, 76, 60, 0.15); }
.toast.warning .toast-progress { background: rgba(243, 156, 18, 0.15); }
.toast.info .toast-progress { background: rgba(52, 152, 219, 0.15); }

.toast-progress-bar {
    height: 100%;
    border-radius: 0 0 0 var(--radius-md);
}

.toast.success .toast-progress-bar { background: var(--success); }
.toast.error .toast-progress-bar { background: var(--accent); }
.toast.warning .toast-progress-bar { background: var(--warning); }
.toast.info .toast-progress-bar { background: var(--secondary); }

.toast-progress-bar {
    animation: toastProgress linear forwards;
}

.toast-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.toast-actions button {
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

.toast-actions .btn-undo {
    background: var(--secondary);
    color: white;
}

.toast-actions .btn-dismiss {
    background: var(--gray-200);
    color: var(--text-primary);
}

@keyframes toastSlideIn {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastSlideOut {
    from { transform: translateX(0); opacity: 1; max-height: 120px; margin-bottom: 0; }
    to { transform: translateX(-100%); opacity: 0; max-height: 0; margin-bottom: -10px; padding: 0; }
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

@media (max-width: 575px) {
    .toast-container {
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
    }
}

/* ============================================
   Dialog (Alert/Confirm)
   ============================================ */
.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: dialogFadeIn 0.25s ease;
    padding: var(--space-4);
}

.dialog-box {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    animation: dialogScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dialog-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 0;
}

.dialog-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.dialog-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.dialog-body {
    padding: 16px 24px;
}

.dialog-body p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
    margin: 0;
}

.dialog-footer {
    display: flex;
    gap: 10px;
    padding: 0 24px 20px;
    justify-content: flex-start;
}

.dialog-footer .btn {
    min-width: 100px;
}

@keyframes dialogFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dialogScaleIn {
    from { transform: scale(0.9) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

/* ============================================
   Navigation Dropdown Fixes
   ============================================ */
.nav-item { position: relative; }
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: var(--bg-primary);
    box-shadow: var(--shadow-lg);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: var(--space-2) 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition);
    z-index: 100;
}

.nav-item:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: var(--space-2) var(--space-4);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    transition: background var(--transition-fast);
}

.dropdown-menu a:hover {
    background: var(--gray-50);
    color: var(--secondary);
}

.img-error-text {
    display: block;
    padding: 20px;
    color: var(--text-light);
    font-size: var(--font-size-sm);
    text-align: center;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 2px dashed var(--gray-200);
}
/* Banner Slider Styles - moved to components.css */