/* ==========================================================================
   🎨 سیستم طراحی مشترک پلتفرم کارا
   طراحی شده برای کاربران خانم موبایلی (۹۰٪)
   ========================================================================== */

/* ==========================================================================
   ۱. متغیرهای رنگی و تم زنانه
   ========================================================================== */
:root {
    /* رنگ‌های اصلی - تم صورتی/بنفش */
    --primary: #d63384;
    --primary-dark: #a61e5c;
    --primary-light: #f8d7e8;
    --primary-50: #fdf2f8;
    
    --secondary: #7c3aed;
    --secondary-dark: #5b21b6;
    --secondary-light: #ede9fe;
    
    --accent: #f59e0b;
    --accent-light: #fef3c7;
    
    /* رنگ‌های وضعیت */
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #dbeafe;
    
    /* رنگ‌های متن */
    --text-dark: #1f2937;
    --text-medium: #4b5563;
    --text-light: #9ca3af;
    --text-muted: #d1d5db;
    
    /* پس‌زمینه‌ها */
    --bg-body: #fdf2f8;
    --bg-white: #ffffff;
    --bg-light: #f9fafb;
    --bg-muted: #f3f4f6;
    
    /* حاشیه‌ها */
    --border-color: #f3e8ee;
    --border-light: #f9fafb;
    
    /* سایه‌ها */
    --shadow-xs: 0 1px 2px rgba(214, 51, 132, 0.05);
    --shadow-sm: 0 2px 8px rgba(214, 51, 132, 0.08);
    --shadow-md: 0 4px 15px rgba(214, 51, 132, 0.12);
    --shadow-lg: 0 8px 25px rgba(214, 51, 132, 0.18);
    --shadow-xl: 0 12px 35px rgba(214, 51, 132, 0.25);
    
    /* شعاع گوشه‌ها */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 15px;
    --radius-lg: 20px;
    --radius-xl: 25px;
    --radius-full: 50px;
    --radius-circle: 50%;
    
    /* فاصله‌ها */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;
    --space-2xl: 32px;
    --space-3xl: 48px;
    
    /* اندازه فونت */
    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 14px;
    --text-md: 15px;
    --text-lg: 17px;
    --text-xl: 20px;
    --text-2xl: 24px;
    --text-3xl: 30px;
    
    /* ترنزیشن‌ها */
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s ease;
    
    /* Z-index */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
}

/* ==========================================================================
   ۲. ریست و پایه
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--bg-body);
    color: var(--text-dark);
    font-size: var(--text-base);
    line-height: 1.7;
    margin: 0;
    padding: 0;
    direction: rtl;
    text-align: right;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* ==========================================================================
   ۳. تایپوگرافی
   ========================================================================== */
.heading-1 {
    font-size: var(--text-3xl);
    font-weight: 900;
    color: var(--text-dark);
    margin: 0 0 var(--space-lg);
    line-height: 1.3;
}

.heading-2 {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-dark);
    margin: 0 0 var(--space-md);
    line-height: 1.4;
}

.heading-3 {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 var(--space-sm);
}

.text-muted { color: var(--text-light); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }

/* ==========================================================================
   ۴. کانتینر و گرید
   ========================================================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.container-wide {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

.grid {
    display: grid;
    gap: var(--space-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

/* ==========================================================================
   ۵. کارت‌ها
   ========================================================================== */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-lg);
    transition: all var(--transition-base);
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.card-flat {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    border: 1px solid var(--border-color);
}

.card-gradient-pink {
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.card-gradient-gold {
    background: linear-gradient(135deg, var(--accent-light) 0%, #fde68a 100%);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 2px solid var(--accent);
}

.card-gradient-purple {
    background: linear-gradient(135deg, var(--secondary-light) 0%, #ddd6fe 100%);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

/* ==========================================================================
   ۶. دکمه‌ها
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--text-base);
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    min-height: 44px;
    white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: white;
}

.btn-secondary {
    background: var(--bg-muted);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: var(--border-color);
    color: var(--text-dark);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-ghost {
    background: transparent;
    color: var(--primary);
}

.btn-ghost:hover { background: var(--primary-50); }

.btn-sm {
    padding: 8px var(--space-md);
    font-size: var(--text-sm);
    min-height: 36px;
}

.btn-lg {
    padding: 16px var(--space-xl);
    font-size: var(--text-lg);
    min-height: 52px;
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn-pill { border-radius: var(--radius-full); }

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-circle);
}

/* ==========================================================================
   ۷. فرم‌ها
   ========================================================================== */
.form-group { margin-bottom: var(--space-lg); }

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: var(--space-sm);
    font-size: var(--text-sm);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px var(--space-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--text-base);
    background: var(--bg-white);
    color: var(--text-dark);
    transition: all var(--transition-fast);
    min-height: 44px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(214, 51, 132, 0.15);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    font-size: var(--text-xs);
    color: var(--text-light);
    margin-top: var(--space-xs);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--danger);
    margin-top: var(--space-xs);
}

/* ==========================================================================
   ۸. Badge و Tag
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 700;
    white-space: nowrap;
}

.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: var(--success-light); color: #065f46; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-info { background: var(--info-light); color: #1e40af; }

.badge-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border-radius: var(--radius-circle);
}

/* ==========================================================================
   ۹. آواتار
   ========================================================================== */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-circle);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    font-weight: 900;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-xs { width: 32px; height: 32px; font-size: var(--text-sm); }
.avatar-sm { width: 42px; height: 42px; font-size: var(--text-base); }
.avatar-md { width: 56px; height: 56px; font-size: var(--text-lg); }
.avatar-lg { width: 80px; height: 80px; font-size: var(--text-2xl); }
.avatar-xl { width: 110px; height: 110px; font-size: var(--text-3xl); }

/* ==========================================================================
   ۱۰. رتبه‌بندی (ستاره)
   ========================================================================== */
.rating {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.rating-star { color: var(--accent); font-size: var(--text-lg); }
.rating-star.empty { color: var(--text-muted); }

.rating-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--accent-light);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-full);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

.rating-badge-value {
    font-size: var(--text-lg);
    font-weight: 900;
    color: var(--accent);
}

.rating-badge-count {
    font-size: var(--text-xs);
    color: var(--text-medium);
}

/* ==========================================================================
   ۱۱. وضعیت خالی (Empty State)
   ========================================================================== */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    color: var(--text-light);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    opacity: 0.7;
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-medium);
    margin: 0 0 var(--space-sm);
}

.empty-state-text {
    font-size: var(--text-base);
    color: var(--text-light);
    margin: 0;
}

/* ==========================================================================
   ۱۲. لودینگ
   ========================================================================== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-muted) 0%, var(--border-color) 50%, var(--bg-muted) 100%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: var(--radius-circle);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   ۱۳. Utility Classes
   ========================================================================== */
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.flex-1 { flex: 1; }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

.bg-white { background: var(--bg-white); }
.bg-light { background: var(--bg-light); }
.bg-primary-light { background: var(--primary-50); }

.text-sm { font-size: var(--text-sm); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }

/* مخفی کردن اسکرول‌بار زشت اما حفظ قابلیت اسکرول */
.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ==========================================================================
   ۱۴. انیمیشن‌ها
   ========================================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fade-in { animation: fadeIn 0.4s ease-out; }
.animate-slide-up { animation: slideUp 0.5s ease-out; }
.animate-pulse { animation: pulse 2s infinite; }

/* ==========================================================================
   ۱۵. ریسپانسیو - Breakpoints مشترک
   ========================================================================== */
@media (max-width: 399px) {
    :root { --text-base: 13px; }
    .container, .container-narrow, .container-wide { padding: 0 var(--space-sm); }
}

@media (min-width: 400px) and (max-width: 767px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

@media (min-width: 768px) {
    .container, .container-narrow, .container-wide { padding: 0 var(--space-lg); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
    .container, .container-narrow, .container-wide { padding: 0 var(--space-xl); }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1280px) {
    .container { max-width: 1200px; }
    .container-wide { max-width: 1400px; }
}

/* ==========================================================================
   ۱۶. بهینه‌سازی لمسی برای موبایل (حیاتی)
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 48px;
        padding: 14px var(--space-lg);
    }
    
    .btn-sm { min-height: 40px; }
    
    .form-input, .form-select, .form-textarea {
        min-height: 48px;
    }
    
    a, button { min-height: 44px; }
    
    /* ✅ جلوگیری از زوم خودکار در iOS هنگام فوکوس روی اینپوت */
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* ==========================================================================
   ۱۷. کاهش انیمیشن برای کاربرانی که ترجیح می‌دهند
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   ۱۸. حالت تاریک (آماده برای آینده)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    /* در آینده می‌توانیم متغیرها را override کنیم */
}

/* ==========================================================================
   ۱۹. چاپ
   ========================================================================== */
@media print {
    .btn, .mobile-sticky-book, .no-print { display: none !important; }
    body { background: white; color: black; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}