/* =====================================================
   main.css - متغیرها، base styles، فونت
   نسخه ۴.۰ - ماژولار
   فایل‌های جداگانه:
     modules/layout.css      - header، stats، دکمه، modal
     modules/notes.css       - کارت یادداشت
     modules/task-list.css   - لیست تسک، تب، pagination
     modules/task-modal.css  - modal تسک، تامبنیل، ویدیو
     modules/upload.css      - نوار پیشرفت آپلود
     modules/file-gallery.css - گالری فایل
   ===================================================== */

/* ── فونت ─────────────────────────────────────────── */
@font-face {
    font-family: 'Vazirmatn';
    src: url('../assets/fonts/Vazir-Medium.woff2') format('woff2'),
         url('../assets/fonts/Vazir-Medium.woff')  format('woff');
    font-weight: 400 700;
    font-style:  normal;
    font-display: swap;
}

:root { --font-fa: 'Vazirmatn', Tahoma, Arial, sans-serif; }
html  { font-family: var(--font-fa); }
body, * { font-family: var(--font-fa) !important; }
input, textarea, select, button,
.form-control, .form-select, .btn,
.modal-content, .dropdown-item,
.nav-link, .badge, .alert {
    font-family: var(--font-fa) !important;
}
*, *::before, *::after { box-sizing: border-box; }

/* ── متغیرهای CSS - تم تاریک ─────────────────────── */
:root {
    --bg-body:        #0f172a;
    --bg-card:        #1e293b;
    --bg-card-2:      #263147;
    --bg-input:       #334155;
    --bg-hover:       #2d3f58;
    --border-color:   #475569;
    --border-hover:   #64748b;
    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;
    --accent:         #3b82f6;
    --accent-hover:   #2563eb;
    --accent-light:   rgba(59,130,246,0.15);
    --danger:         #ef4444;
    --danger-light:   rgba(239,68,68,0.12);
    --success:        #10b981;
    --success-light:  rgba(16,185,129,0.12);
    --warning:        #f59e0b;
    --warning-light:  rgba(245,158,11,0.12);
    --purple:         #8b5cf6;
    --purple-light:   rgba(139,92,246,0.12);
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.35);
    --shadow-md:      0 4px 14px rgba(0,0,0,0.45);
    --shadow-lg:      0 10px 40px rgba(0,0,0,0.55);
    --radius-sm:      8px;
    --radius-md:      12px;
    --radius-lg:      20px;
    --transition:     all 0.2s ease;
    --priority-low:   #10b981;
    --priority-medium:#f59e0b;
    --priority-high:  #ef4444;
}

/* ── تم روشن ──────────────────────────────────────── */
body.light-theme {
    --bg-body:        #f0f4ff;
    --bg-card:        #ffffff;
    --bg-card-2:      #f8faff;
    --bg-input:       #eef2ff;
    --bg-hover:       #e0e9ff;
    --border-color:   #d1daf5;
    --border-hover:   #a5b4fc;
    --text-primary:   #0f172a;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;
    --accent:         #2563eb;
    --accent-hover:   #1d4ed8;
    --accent-light:   rgba(37,99,235,0.1);
    --danger-light:   rgba(239,68,68,0.1);
    --success-light:  rgba(16,185,129,0.1);
    --warning-light:  rgba(245,158,11,0.1);
    --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:      0 4px 14px rgba(0,0,0,0.1);
    --shadow-lg:      0 10px 40px rgba(0,0,0,0.14);
}

/* ── Base ─────────────────────────────────────────── */
body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    margin: 0; padding: 0;
    direction: rtl;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

::-webkit-scrollbar       { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ── Preloader ────────────────────────────────────── */
#preloader {
    position: fixed; inset: 0;
    background: var(--bg-body); z-index: 10000;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.5s, visibility 0.5s;
}
.preloader-inner { text-align: center; }
.preloader-logo {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 1rem;
    animation: preloaderPulse 1.5s ease-in-out infinite;
}
.preloader-logo svg { width: 28px; height: 28px; fill: white; }
.preloader-bar {
    width: 160px; height: 3px;
    background: var(--bg-input); border-radius: 2px; overflow: hidden; margin: 0 auto;
}
.preloader-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    border-radius: 2px;
    animation: preloaderBar 1.2s ease-in-out infinite;
}
@keyframes preloaderPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.06)} }
@keyframes preloaderBar   { 0%{width:0;margin-right:100%} 50%{width:55%} 100%{width:0;margin-left:100%} }
#preloader.hidden { opacity: 0; visibility: hidden; }

/* ── Toast ────────────────────────────────────────── */
.toast-container {
    position: fixed; top: 24px; left: 24px; z-index: 9999;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast-item {
    background: var(--bg-card-2); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 13px 16px;
    display: flex; align-items: center; gap: 11px;
    box-shadow: var(--shadow-lg); pointer-events: auto;
    min-width: 250px; max-width: 340px;
    animation: toastIn 0.3s ease-out; font-size: 0.875rem;
}
.toast-item.toast-success { border-color: var(--success); }
.toast-item.toast-error   { border-color: var(--danger);  }
.toast-item.toast-warning { border-color: var(--warning); }
.toast-item.toast-info    { border-color: var(--accent);  }
.toast-icon { flex-shrink: 0; display: flex; }
.toast-icon svg { width: 18px; height: 18px; fill: currentColor; }
.toast-item.toast-success .toast-icon { color: var(--success); }
.toast-item.toast-error   .toast-icon { color: var(--danger);  }
.toast-item.toast-warning .toast-icon { color: var(--warning); }
.toast-item.toast-info    .toast-icon { color: var(--accent);  }
.toast-text  { flex: 1; line-height: 1.45; color: var(--text-primary); }
.toast-close {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 0; margin-right: -2px; display: flex;
}
.toast-close svg   { width: 14px; height: 14px; fill: currentColor; }
.toast-close:hover { color: var(--text-primary); }
.toast-hide { animation: toastOut 0.25s ease-in forwards; }
@keyframes toastIn  { from{opacity:0;transform:translateX(-14px)} to{opacity:1;transform:none} }
@keyframes toastOut { from{opacity:1} to{opacity:0;transform:translateX(-14px)} }

@media (max-width: 480px) {
    .toast-container { left: 10px; right: 10px; }
    .toast-item { min-width: auto; max-width: 100%; }
}
