/* ==============================================
   پخش برادران ۳ - سیستم توزیع و فروش
   طراحی مدرن با فیبوناچی: 5, 8, 13, 21, 34, 55, 89
   ============================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;200;300;400;500;600;700;800;900&display=swap');

/* ============ متغیرها ============ */
:root {
    /* رنگ‌های اصلی - ملایم‌تر برای استفاده طولانی */
    --primary: #4f7df3;
    --primary-dark: #3b6ce8;
    --primary-light: #7da3f7;
    --secondary: #6b7b8a;
    --success: #22c997;
    --success-dark: #18a379;
    --warning: #f5a623;
    --danger: #e85454;
    --info: #17c1d8;
    --purple: #9370db;
    
    /* رنگ‌های وضعیت مشتری */
    --status-white: #eef2f7;
    --status-green: #22c997;
    --status-yellow: #e5b73b;
    --status-orange: #f08c4a;
    --status-red: #e85454;
    --status-purple: #9370db;
    
    /* تم روشن - نرم‌تر و راحت‌تر برای چشم */
    --bg-primary: #f4f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #edf1f7;
    --bg-card: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #5a6a7d;
    --text-muted: #8e9eb3;
    --border-color: #dde4ed;
    --shadow-color: rgba(45, 55, 72, 0.07);
    --shadow: 0 2px 10px var(--shadow-color);
    --shadow-lg: 0 8px 24px var(--shadow-color);
    --shadow-xl: 0 14px 40px var(--shadow-color);
    
    /* فیبوناچی فاصله‌ها - کمی بزرگتر برای نفس کشیدن */
    --sp-1: 6px;
    --sp-2: 10px;
    --sp-3: 16px;
    --sp-4: 24px;
    --sp-5: 38px;
    --sp-6: 60px;
    --sp-7: 96px;
    
    /* گردی‌ها - نرم‌تر */
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 22px;
    --radius-xl: 36px;
    --radius-full: 9999px;
    
    /* ابعاد */
    --sidebar-width: 260px;
    --header-height: 60px;
    --mobile-nav-height: 68px;
    
    /* انتقال */
    --transition: all 0.2s ease;
    --transition-slow: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* فونت */
    --font-xs: 0.72rem;
    --font-sm: 0.82rem;
    --font-base: 0.9rem;
    --font-md: 1.05rem;
    --font-lg: 1.15rem;
    --font-xl: 1.4rem;
    --font-2xl: 1.8rem;
}

/* تم تاریک - با کنتراست مناسب */
[data-theme="dark"] {
    --bg-primary: #0d1321;
    --bg-secondary: #1a2435;
    --bg-tertiary: #2a3649;
    --bg-card: #1a2435;
    --text-primary: #e8ecf2;
    --text-secondary: #b8c4d4;
    --text-muted: #6d7d8f;
    --border-color: #2d3e52;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --status-white: #2a3649;
}

/* ============ ریست ============ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    direction: rtl;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ============ دکمه‌های مدرن ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-4);
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: var(--font-base);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-slow);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 100%);
    opacity: 0;
    transition: var(--transition);
}

.btn:hover::before {
    opacity: 1;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 13px rgba(59, 130, 246, 0.4);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 21px rgba(59, 130, 246, 0.5);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: white;
    box-shadow: 0 4px 13px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 13px rgba(239, 68, 68, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
    color: white;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-primary);
    border-color: var(--primary);
}

.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(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-sm {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--font-sm);
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: var(--sp-4) var(--sp-5);
    font-size: var(--font-md);
    border-radius: var(--radius-lg);
}

.btn-icon {
    width: var(--sp-5);
    height: var(--sp-5);
    padding: 0;
    border-radius: var(--radius);
}

.btn-icon-lg {
    width: var(--sp-6);
    height: var(--sp-6);
    padding: 0;
    border-radius: var(--radius);
}

.btn-block {
    width: 100%;
}

.btn-pill {
    border-radius: var(--radius-full);
}

/* ============ فرم‌ها ============ */
.form-group {
    margin-bottom: var(--sp-4);
}

.form-label {
    display: block;
    margin-bottom: var(--sp-2);
    font-weight: 500;
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: var(--sp-3);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: var(--font-base);
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control-lg {
    padding: var(--sp-4);
    font-size: var(--font-md);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left var(--sp-3) center;
    padding-left: var(--sp-6);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    cursor: pointer;
}

.form-check input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-4);
}

/* ============ کارت‌ها ============ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.card-header {
    padding: var(--sp-4) var(--sp-4);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    background: var(--bg-tertiary);
}

.card-title {
    font-size: var(--font-md);
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.card-body {
    padding: var(--sp-4);
}

.card-footer {
    padding: var(--sp-3) var(--sp-4);
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

/* ============ بج‌ها ============ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-1) var(--sp-2);
    border-radius: var(--radius-full);
    font-size: var(--font-xs);
    font-weight: 700;
    line-height: 1;
}

.badge-lg {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--font-sm);
}

.badge-primary { background: rgba(59, 130, 246, 0.15); color: var(--primary); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-purple { background: rgba(139, 92, 246, 0.15); color: var(--purple); }

.badge-solid-primary { background: var(--primary); color: white; }
.badge-solid-success { background: var(--success); color: white; }
.badge-solid-warning { background: var(--warning); color: white; }
.badge-solid-danger { background: var(--danger); color: white; }

/* ============ هشدارها ============ */
.alert {
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius);
    margin-bottom: var(--sp-4);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    font-size: var(--font-sm);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    color: var(--success-dark);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--warning);
    color: #92400e;
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid var(--info);
    color: #0e7490;
}

/* ============ لایه‌بندی اصلی - ادمین ============ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* سایدبار ادمین */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition-slow);
}

.sidebar-header {
    padding: var(--sp-4);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
}

.sidebar-logo {
    width: var(--sp-6);
    height: var(--sp-6);
    background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: var(--font-xl);
    font-weight: 800;
    box-shadow: 0 4px 13px rgba(59, 130, 246, 0.3);
}

.sidebar-brand h1 {
    font-size: var(--font-md);
    font-weight: 700;
    margin-bottom: 2px;
}

.sidebar-brand span {
    font-size: var(--font-xs);
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: var(--sp-3);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--sp-4);
}

.nav-section-title {
    font-size: var(--font-xs);
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: var(--sp-2) var(--sp-3);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border-radius: var(--radius);
    color: var(--text-secondary);
    margin-bottom: var(--sp-1);
    transition: var(--transition);
    font-size: var(--font-sm);
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 13px rgba(59, 130, 246, 0.3);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item .badge {
    margin-right: auto;
}

.sidebar-footer {
    padding: var(--sp-3);
    border-top: 1px solid var(--border-color);
}

.user-card {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.user-card:hover {
    background: var(--bg-primary);
}

.user-avatar {
    width: var(--sp-5);
    height: var(--sp-5);
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 3px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: var(--font-sm);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: var(--font-sm);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: var(--font-xs);
    color: var(--text-muted);
}

.logout-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: var(--sp-2);
    margin-top: var(--sp-2);
    color: var(--danger);
    text-decoration: none;
    font-size: var(--font-sm);
    border-radius: var(--radius);
    transition: var(--transition);
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* محتوای اصلی */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* هدر */
.main-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 var(--sp-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title h2 {
    font-size: var(--font-lg);
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.sidebar-toggle {
    display: none;
    width: var(--sp-5);
    height: var(--sp-5);
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

/* iOS-style Theme Switch */
.theme-switch {
    position: relative;
    width: 52px;
    height: 28px;
    display: block;
    cursor: pointer;
    flex-shrink: 0;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.theme-slider {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 28px;
    transition: all 0.35s ease;
    overflow: hidden;
}

.theme-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.35s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.theme-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    transition: opacity 0.3s;
    line-height: 1;
}

.theme-icon.sun {
    right: 6px;
    opacity: 1;
}

.theme-icon.moon {
    left: 7px;
    opacity: 0;
}

.theme-switch input:checked + .theme-slider {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.theme-switch input:checked + .theme-slider::before {
    transform: translateX(24px);
}

.theme-switch input:checked + .theme-slider .sun {
    opacity: 0;
}

.theme-switch input:checked + .theme-slider .moon {
    opacity: 1;
}

.notification-btn {
    position: relative;
}

.notification-btn .badge {
    position: absolute;
    top: -4px;
    left: -4px;
    min-width: 18px;
    height: 18px;
    background: var(--danger);
    color: white;
    font-size: 10px;
}

/* محتوای صفحه */
.page-content {
    flex: 1;
    padding: var(--sp-4);
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    margin-bottom: var(--sp-4);
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: var(--font-xl);
    font-weight: 700;
}

.page-actions {
    display: flex;
    gap: var(--sp-2);
    flex-wrap: wrap;
}

/* ============ جدول ============ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-sm);
}

.table th,
.table td {
    padding: var(--sp-3);
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    font-size: var(--font-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--bg-tertiary);
}

.table .actions {
    display: flex;
    gap: var(--sp-1);
}

/* ============ آمار ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--sp-4);
    margin-bottom: var(--sp-5);
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: var(--sp-6);
    height: var(--sp-6);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.primary { background: rgba(59, 130, 246, 0.15); color: var(--primary); }
.stat-icon.success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.stat-icon.danger { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.stat-icon.purple { background: rgba(139, 92, 246, 0.15); color: var(--purple); }

.stat-info h3 {
    font-size: var(--font-2xl);
    font-weight: 800;
    line-height: 1;
    margin-bottom: var(--sp-1);
}

.stat-info p {
    font-size: var(--font-sm);
    color: var(--text-secondary);
}

/* ============ مودال ============ */
.modal-overlay,
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
    overflow-y: auto;
}

.modal-overlay.active,
.modal.active {
    display: flex !important;
}

.modal-overlay.active .modal {
    display: block !important;
}

.modal-overlay .modal,
.modal .modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.2s ease;
}

.modal-content,
.modal > form,
.modal-overlay .modal form,
.modal .modal-content form {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.2s ease;
}

.modal .modal-content {
    display: flex;
    flex-direction: column;
}

.modal .modal-content > form {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    background: transparent;
    box-shadow: none;
    max-width: none;
    max-height: none;
}

.modal-overlay .modal form,
.modal .modal-content form {
    background: transparent;
    box-shadow: none;
    max-width: none;
}

.modal-lg .modal-content,
.modal-content.modal-lg,
.modal.modal-lg > form,
.modal .modal-content.modal-lg {
    max-width: 700px;
}

.modal-xl .modal-content,
.modal-content.modal-xl {
    max-width: 900px;
}

@keyframes modalIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
}

/* Search Box */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box svg {
    position: absolute;
    right: var(--sp-3);
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    padding: var(--sp-2) var(--sp-3);
    padding-right: calc(var(--sp-3) + 24px);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    font-size: var(--font-sm);
    width: 100%;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-secondary);
}

.modal-header {
    padding: var(--sp-4);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: var(--font-lg);
    font-weight: 700;
}

.modal-close {
    width: var(--sp-5);
    height: var(--sp-5);
    border: none;
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-body {
    padding: var(--sp-4);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    padding: var(--sp-3) var(--sp-4);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--sp-2);
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

/* ============ توست ============ */
.toast-container {
    position: fixed;
    top: var(--sp-4);
    left: var(--sp-4);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.toast {
    background: var(--bg-secondary);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    animation: toastIn 0.3s ease;
    border-right: 4px solid;
}

@keyframes toastIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.info { border-color: var(--info); }

/* ============ Empty State ============ */
.empty-state {
    text-align: center;
    padding: var(--sp-6);
    color: var(--text-muted);
}

.empty-state svg {
    width: var(--sp-6);
    height: var(--sp-6);
    margin-bottom: var(--sp-3);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: var(--font-md);
    margin-bottom: var(--sp-2);
    color: var(--text-secondary);
}

/* ============ رنگ وضعیت ============ */
.color-dot {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-full);
    display: inline-block;
}

.color-white { background: var(--status-white); border: 1px solid var(--border-color); }
.color-green { background: var(--status-green); }
.color-yellow { background: var(--status-yellow); }
.color-orange { background: var(--status-orange); }
.color-red { background: var(--status-red); }
.color-purple { background: var(--status-purple); }

/* ============ MOBILE LAYOUT - Visitor/Supervisor ============ */
.mobile-only {
    display: none;
}

.mobile-app {
    min-height: 100vh;
    padding-bottom: var(--mobile-nav-height);
}

.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--sp-3);
    z-index: 100;
}

.mobile-header-title {
    font-size: var(--font-md);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.mobile-content {
    padding: calc(var(--header-height) + var(--sp-3)) var(--sp-3) var(--sp-3);
}

/* Bottom Navigation */
.mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mobile-nav-height);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: var(--sp-2);
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    border-radius: var(--radius);
    min-width: 60px;
}

.mobile-nav-item svg {
    width: 22px;
    height: 22px;
}

.mobile-nav-item span {
    font-size: 10px;
    font-weight: 600;
}

.mobile-nav-item.active {
    color: var(--primary);
}

.mobile-nav-item.active svg {
    transform: scale(1.1);
}

/* ============ صفحه ورود ============ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-4);
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-tertiary) 100%);
}

.login-box {
    background: var(--bg-secondary);
    padding: var(--sp-5);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--sp-5);
}

.login-logo .login-logo-img {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-lg);
    margin: 0 auto var(--sp-3);
    display: block;
    box-shadow: 0 8px 21px rgba(59, 130, 246, 0.3);
}

.login-logo .icon {
    width: var(--sp-7);
    height: var(--sp-7);
    background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--sp-3);
    color: white;
    font-size: var(--font-2xl);
    font-weight: 800;
    box-shadow: 0 8px 21px rgba(59, 130, 246, 0.3);
}

.login-logo h1 {
    font-size: var(--font-xl);
    font-weight: 700;
    margin-bottom: var(--sp-1);
}

.login-logo p {
    color: var(--text-muted);
    font-size: var(--font-sm);
}

/* ============ Grid System ============ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }

/* ============ Utilities ============ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }

.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fw-medium { font-weight: 500; }

.d-none { display: none !important; }
.d-flex { display: flex; }
.d-block { display: block; }
.d-grid { display: grid; }

.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mb-1 { margin-bottom: var(--sp-1); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }

.p-0 { padding: 0; }
.p-2 { padding: var(--sp-2); }
.p-3 { padding: var(--sp-3); }
.p-4 { padding: var(--sp-4); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    /* Admin mobile */
    .sidebar {
        transform: translateX(100%);
        box-shadow: var(--shadow-xl);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-content {
        margin-right: 0;
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .grid-3, .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Mobile styles */
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    html {
        font-size: 15px;
    }
    
    .page-content {
        padding: var(--sp-3);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--sp-3);
    }
    
    .stat-card {
        padding: var(--sp-3);
    }
    
    .stat-icon {
        width: var(--sp-5);
        height: var(--sp-5);
    }
    
    .stat-info h3 {
        font-size: var(--font-xl);
    }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .card-header .btn {
        width: 100%;
    }
    
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-header .btn {
        width: 100%;
    }
    
    /* Modal mobile */
    .modal-overlay,
    div.modal[id] {
        align-items: flex-end;
        padding: 0;
    }
    
    .modal-overlay .modal,
    div.modal[id] > .modal-content {
        max-width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 90vh;
        display: flex;
        flex-direction: column;
    }
    
    div.modal[id] > .modal-content > form {
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow: hidden;
        max-height: none;
    }
    
    div.modal[id] .modal-body {
        flex: 1;
        overflow-y: auto;
        min-height: 0;
        padding-bottom: var(--sp-4);
    }
    
    div.modal[id] .modal-footer {
        flex-direction: row;
        flex-shrink: 0;
        background: var(--bg-secondary);
        padding: var(--sp-3) var(--sp-4);
        padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom, 0));
        border-top: 1px solid var(--border-color);
    }
    
    .modal-footer .btn {
        flex: 1;
    }
    
    /* Table mobile */
    .table {
        font-size: var(--font-xs);
    }
    
    .table th, .table td {
        padding: var(--sp-2);
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .login-box {
        padding: var(--sp-4);
    }
}

/* ============ Print ============ */
@media print {
    .sidebar, .main-header, .mobile-nav, .mobile-header,
    .btn, .modal-overlay, .toast-container {
        display: none !important;
    }
    
    .main-content, .mobile-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* ============ Animations ============ */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ============ Tabs ============ */
.tabs {
    display: flex;
    gap: var(--sp-2);
    border-bottom: 2px solid var(--border-color);
    margin-bottom: var(--sp-4);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    padding: var(--sp-3) var(--sp-4);
    border: none;
    background: none;
    font-family: inherit;
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ============ Progress ============ */
.progress {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--success));
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

/* ============ Avatar Group ============ */
.avatar-group {
    display: flex;
}

.avatar-group .user-avatar {
    margin-left: -10px;
    border: 2px solid var(--bg-secondary);
}

.avatar-group .user-avatar:first-child {
    margin-left: 0;
}

/* ============ Invoice Preview ============ */
.invoice-preview {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    border: 2px dashed var(--border-color);
}

.invoice-preview-header {
    text-align: center;
    padding-bottom: var(--sp-3);
    border-bottom: 2px dashed var(--border-color);
    margin-bottom: var(--sp-3);
}

.invoice-preview-header h2 {
    font-size: var(--font-lg);
    margin-bottom: var(--sp-1);
}

.invoice-preview-header p {
    font-size: var(--font-xs);
    color: var(--text-muted);
}

.invoice-preview-items {
    margin-bottom: var(--sp-3);
}

.invoice-preview-item {
    display: flex;
    justify-content: space-between;
    padding: var(--sp-2) 0;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--font-sm);
}

.invoice-preview-total {
    display: flex;
    justify-content: space-between;
    padding-top: var(--sp-3);
    font-size: var(--font-md);
    font-weight: 700;
}

/* ============ Product Cards for POS ============ */
.products-grid-pos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-2);
}

.product-card-pos {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--sp-3);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.product-card-pos:active {
    transform: scale(0.97);
}

.product-card-pos.selected {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.08);
}

.product-card-pos.out-of-stock {
    opacity: 0.5;
    pointer-events: none;
}

.product-card-pos .qty-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    background: var(--success);
    color: white;
    border-radius: var(--radius-full);
    font-size: var(--font-sm);
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}

.product-card-pos.selected .qty-badge {
    display: flex;
}

.product-card-pos .remove-badge {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 28px;
    height: 28px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: var(--font-md);
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.product-card-pos.selected .remove-badge {
    display: flex;
}

.product-card-pos .product-icon {
    font-size: var(--font-2xl);
    margin-bottom: var(--sp-2);
}

.product-card-pos .product-name {
    font-size: var(--font-sm);
    font-weight: 600;
    margin-bottom: var(--sp-1);
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
}

.product-card-pos .product-price {
    font-size: var(--font-sm);
    color: var(--primary);
    font-weight: 700;
}

.product-card-pos .product-stock {
    font-size: var(--font-xs);
    color: var(--text-muted);
    margin-top: var(--sp-1);
}

@media (min-width: 600px) {
    .products-grid-pos {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 900px) {
    .products-grid-pos {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============ Spinner Animation ============ */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-left: var(--sp-2);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ Disabled Button ============ */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ============ Confirm Dialog Fix ============ */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.confirm-overlay.active {
    opacity: 1;
    visibility: visible;
}

.confirm-box {
    background: var(--bg-secondary);
    padding: var(--sp-5);
    border-radius: var(--radius-lg);
    text-align: center;
    max-width: 300px;
    box-shadow: var(--shadow-xl);
}

.confirm-box h3 {
    margin-bottom: var(--sp-3);
}

.confirm-box .btn-group {
    display: flex;
    gap: var(--sp-3);
    margin-top: var(--sp-4);
}

.confirm-box .btn-group .btn {
    flex: 1;
}

/* ============ Better Mobile Only Message ============ */
@media (min-width: 769px) {
    .mobile-only-message {
        display: none !important;
    }
}

/* ============ Stock Warning ============ */
.low-stock {
    color: var(--warning);
}

.out-of-stock {
    opacity: 0.5;
    pointer-events: none;
}

.out-of-stock::after {
    content: 'ناموجود';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--danger);
    color: white;
    padding: var(--sp-1) var(--sp-2);
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    font-weight: 700;
}

/* ============ Customer Search Select ============ */
.customer-select-wrapper {
    position: relative;
}

.customer-select-wrapper .search-input {
    margin-bottom: var(--sp-2);
}

.customer-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.customer-list-item {
    padding: var(--sp-2) var(--sp-3);
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.customer-list-item:last-child {
    border-bottom: none;
}

.customer-list-item:hover {
    background: var(--bg-tertiary);
}

.customer-list-item.selected {
    background: var(--primary);
    color: white;
}

/* ============ Print Styles ============ */
@media print {
    .mobile-nav,
    .sidebar,
    .main-header,
    .mobile-header,
    .cart-fab,
    .no-print {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
    }
    
    .page-content {
        padding: 0 !important;
    }
}

/* ============ Spinner & Loading States ============ */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

.spinner-lg {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-box {
    background: var(--bg-secondary);
    padding: var(--sp-5);
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.loading-box .spinner {
    width: 40px;
    height: 40px;
    border-width: 3px;
    margin-bottom: var(--sp-3);
}

/* Disabled link */
a.disabled {
    pointer-events: none;
    opacity: 0.5;
}

/* ============ Skeleton Loading ============ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    margin-bottom: var(--sp-2);
}

.skeleton-text:last-child {
    width: 60%;
}

.skeleton-title {
    height: 1.5em;
    width: 50%;
    margin-bottom: var(--sp-3);
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
}

.skeleton-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    border: 1px solid var(--border-color);
}

.skeleton-btn {
    height: 44px;
    width: 120px;
}

/* ============ Better Form Styling ============ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--sp-4);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-4);
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-4);
}

.form-actions {
    display: flex;
    gap: var(--sp-3);
    margin-top: var(--sp-4);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--border-color);
}

/* ============ Import Help Styling ============ */
.import-help {
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    padding: var(--sp-4);
    margin-top: var(--sp-3);
}

.import-help h4 {
    font-size: var(--font-sm);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--sp-2);
}

.import-help p {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    margin-bottom: var(--sp-2);
}

.import-help p:last-child {
    margin-bottom: 0;
}

.import-help pre {
    background: var(--bg-secondary);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-sm);
    font-size: var(--font-xs);
    overflow-x: auto;
    margin: var(--sp-2) 0;
}

.import-help code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: var(--font-xs);
}

/* ============ Better Stats Cards ============ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--sp-4);
    margin-bottom: var(--sp-4);
}

.stat-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-box:hover {
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.stat-box-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--sp-3);
}

.stat-box-value {
    font-size: var(--font-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--sp-1);
}

.stat-box-label {
    font-size: var(--font-sm);
    color: var(--text-muted);
}

/* ============ Filter Bar ============ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-3);
    padding: var(--sp-4);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: var(--sp-4);
}

.filter-bar .form-group {
    min-width: 160px;
    flex: 1;
}

.filter-bar .form-control {
    background: var(--bg-tertiary);
}

/* ============ Page Section ============ */
.page-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: var(--sp-4);
    overflow: hidden;
}

.section-header {
    padding: var(--sp-4);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
}

.section-header h3 {
    font-size: var(--font-md);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.section-body {
    padding: var(--sp-4);
}

.section-body.no-padding {
    padding: 0;
}

/* ============ Data List ============ */
.data-list {
    display: flex;
    flex-direction: column;
}

.data-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

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

.data-item:hover {
    background: var(--bg-tertiary);
}

.data-item-content {
    flex: 1;
    min-width: 0;
}

.data-item-title {
    font-weight: 600;
    color: var(--text-primary);
}

.data-item-subtitle {
    font-size: var(--font-sm);
    color: var(--text-muted);
}

.data-item-actions {
    display: flex;
    gap: var(--sp-2);
}

/* ============ Form Row Inline ============ */
.form-row-inline {
    display: flex;
    gap: var(--sp-3);
    align-items: flex-end;
}

.form-row-inline .form-group {
    flex: 1;
}

.form-row-inline .btn {
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .form-row-inline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-grid-2, .form-grid-3 {
        grid-template-columns: 1fr;
    }
    
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============ Skeleton Loading ============ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius);
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1em;
    margin-bottom: var(--sp-2);
}

.skeleton-text-sm {
    height: 0.8em;
    width: 60%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 120px;
    margin-bottom: var(--sp-3);
}

.skeleton-row {
    display: flex;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border-bottom: 1px solid var(--border-color);
}

.skeleton-row .skeleton-avatar {
    flex-shrink: 0;
}

.skeleton-row-content {
    flex: 1;
}

/* ============ Form Validation States ============ */
.form-control.is-invalid {
    border-color: var(--danger);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23e85454' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23e85454' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left var(--sp-2) center;
    background-size: 1rem;
    padding-left: 2.5rem;
}

.form-control.is-valid {
    border-color: var(--success);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath fill='%2322c997' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left var(--sp-2) center;
    background-size: 1rem;
    padding-left: 2.5rem;
}

.invalid-feedback {
    display: none;
    color: var(--danger);
    font-size: var(--font-sm);
    margin-top: var(--sp-1);
}

.is-invalid ~ .invalid-feedback {
    display: block;
}

/* ============ Loading Overlay ============ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

[data-theme="dark"] .loading-overlay {
    background: rgba(20, 27, 45, 0.8);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============ Empty State ============ */
.empty-state {
    text-align: center;
    padding: var(--sp-6) var(--sp-4);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--sp-3);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--sp-2);
}

.empty-state-text {
    margin-bottom: var(--sp-4);
}

/* ============ Better Focus States ============ */
.form-control:focus,
.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 125, 243, 0.15);
}

.btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(79, 125, 243, 0.3);
}

/* ============ Responsive Improvements ============ */
@media (max-width: 480px) {
    .page-header {
        flex-direction: column;
        gap: var(--sp-3);
        align-items: flex-start;
    }
    
    .page-actions {
        width: 100%;
        display: flex;
        gap: var(--sp-2);
    }
    
    .page-actions .btn {
        flex: 1;
        justify-content: center;
    }
}

/* ============ PWA Install Button ============ */
.pwa-install-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.pwa-install-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.pwa-install-btn:active {
    transform: scale(0.95);
}

.pwa-install-btn.installed {
    background: var(--success);
    color: white;
}

.pwa-install-btn.installed .pwa-icon-install {
    display: none;
}

.pwa-install-btn.installed .pwa-icon-installed {
    display: block !important;
}

.pwa-install-btn .pwa-icon-installed {
    display: none;
}

/* انیمیشن نصب */
@keyframes pwaInstallPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.pwa-install-btn.pulse {
    animation: pwaInstallPulse 1s ease infinite;
}

/* ============ Native App Behavior ============ */
/* جلوگیری از هایلایت لینک‌ها در iOS */
a, button, input, select, textarea {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* جلوگیری از زوم روی فیلدها در iOS */
input[type="text"],
input[type="number"],
input[type="tel"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
    font-size: 16px !important;
}

/* Safe area برای نوتچ‌دار‌ها */
@supports (padding: max(0px)) {
    .mobile-header {
        padding-top: max(var(--sp-3), env(safe-area-inset-top));
    }
    .mobile-nav {
        padding-bottom: max(var(--sp-2), env(safe-area-inset-bottom));
    }
}
