@font-face {
    font-family: 'Vazir';
    src: url('../../fonts/Vazir.woff2') format('woff2'),
         url('../../fonts/Vazir.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url('../../fonts/Vazir-Medium.woff2') format('woff2'),
         url('../../fonts/Vazir-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Vazir';
    src: url('../../fonts/Vazir-Bold.woff2') format('woff2'),
         url('../../fonts/Vazir-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-page: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-muted: #64748b;
}

html.dark {
    --bg-page: #0b0f19;
    --card-bg: #151e2e;
    --border-color: #1e293b;
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --primary-light: #1e1b4b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Vazir', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    direction: rtl;
    text-align: right;
    background-color: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
html.dark ::-webkit-scrollbar-track {
    background: #0f172a;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
html.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: all 0.25s ease;
}
.card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
}
html.dark .card {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

/* Dark Mode Overrides for Tailwind Components */
html.dark .bg-white {
    background-color: #151e2e !important;
}
html.dark .bg-slate-50 {
    background-color: #0b0f19 !important;
}
html.dark .bg-slate-100 {
    background-color: #1e293b !important;
}
html.dark .border-slate-200,
html.dark .border-slate-100 {
    border-color: #1e293b !important;
}
html.dark .text-slate-900,
html.dark .text-slate-800 {
    color: #f8fafc !important;
}
html.dark .text-slate-700 {
    color: #cbd5e1 !important;
}
html.dark .text-slate-600,
html.dark .text-slate-500 {
    color: #94a3b8 !important;
}
html.dark .hover\:bg-slate-50:hover {
    background-color: #1e293b !important;
}
html.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]) {
    border-color: #1e293b !important;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 500;
}
.badge-primary { background: #e0e7ff; color: #4338ca; }
html.dark .badge-primary { background: #312e81; color: #c7d2fe; }
.badge-success { background: #dcfce7; color: #15803d; }
html.dark .badge-success { background: #064e3b; color: #6ee7b7; }
.badge-warning { background: #fef3c7; color: #b45309; }
html.dark .badge-warning { background: #78350f; color: #fde68a; }
.badge-danger  { background: #fee2e2; color: #b91c1c; }
html.dark .badge-danger { background: #7f1d1d; color: #fca5a5; }
.badge-gray    { background: #f1f5f9; color: #475569; }
html.dark .badge-gray { background: #1e293b; color: #94a3b8; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap !important;
    flex-shrink: 0;
}
.btn:active {
    transform: scale(0.98);
}
.btn-primary {
    background: #4f46e5;
    color: #ffffff !important;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover {
    background: #4338ca;
}
.btn-secondary {
    background: #f1f5f9;
    color: #334155 !important;
    border-color: #cbd5e1;
}
html.dark .btn-secondary {
    background: #1e293b;
    color: #cbd5e1 !important;
    border-color: #334155;
}
.btn-secondary:hover {
    background: #e2e8f0;
}
html.dark .btn-secondary:hover {
    background: #334155;
}
.btn-danger {
    background: #ef4444;
    color: #ffffff !important;
}
.btn-danger:hover {
    background: #dc2626;
}
.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
    white-space: nowrap !important;
}

/* Forms */
.form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background-color: #ffffff;
    color: #0f172a;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
html.dark .form-control {
    background-color: #0f172a;
    border-color: #334155;
    color: #f8fafc;
}
.form-control:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-radius: 12px;
    background: #1e293b;
    color: #ffffff;
    font-size: 0.875rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
    min-width: 260px;
    animation: slideIn 0.3s ease forwards;
}
@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Dark Mode Switch Button */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}
html.dark .theme-toggle-btn {
    background: #1e293b;
    border-color: #334155;
    color: #f8fafc;
}
.theme-toggle-btn:hover {
    transform: scale(1.05);
}
