@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('/fonts/Vazirmatn-Black.woff2') format('woff2');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --sidebar-width: 260px;
    --header-height: 60px;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #4f46e5;
    --body-bg: #f1f5f9;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
}

[data-bs-theme="dark"] {
    --body-bg: #0f172a;
    --card-bg: #1e293b;
    --text-color: #e2e8f0;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --sidebar-bg: #0f172a;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-color);
    overflow-x: hidden;
}

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

.app-wrapper {
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #0f172a 100%);
    color: var(--sidebar-text);
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    min-height: var(--header-height);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand {
    color: #ffffff;
    font-size: 1.15rem;
}

.sidebar-section-label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.6;
}

.sidebar-link {
    color: var(--sidebar-text);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    margin-bottom: 2px;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: #ffffff;
}

.sidebar-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.sidebar-link .badge {
    font-size: 0.65rem;
}

.sidebar-footer {
    background: rgba(0,0,0,0.2);
}

.main-content {
    margin-right: var(--sidebar-width);
    transition: margin 0.3s ease;
}

.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    min-height: var(--header-height);
    background: var(--card-bg) !important;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}

.sidebar-overlay.show { display: block; }

.empty-state {
    padding: 3rem 1rem;
}

.empty-state i {
    opacity: 0.3;
}

.stat-card {
    transition: transform 0.2s;
    border-radius: 12px;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
}

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.toast-container {
    z-index: 9999;
}

.dropdown-menu {
    text-align: right;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-color);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-icon:hover { background: rgba(0,0,0,0.06); }

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
    }

    .sidebar-overlay.show { display: block; }
}

.admin-wrapper {
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    color: #e2e8f0;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.admin-nav-link {
    color: #94a3b8;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    margin-bottom: 1px;
}

.admin-nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #ffffff;
}

.admin-nav-link.active {
    background: var(--primary);
    color: #ffffff;
}

.admin-nav-link i {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
}

.admin-main {
    margin-right: var(--sidebar-width);
    transition: margin 0.3s ease;
    background: var(--body-bg);
}

.admin-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    min-height: var(--header-height);
    background: var(--card-bg) !important;
}

@media (max-width: 991.98px) {
    .admin-sidebar {
        transform: translateX(100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .admin-main {
        margin-right: 0;
    }
}

footer {
    background: var(--card-bg);
}

[data-bs-theme="dark"] body {
    background-color: var(--body-bg);
    color: var(--text-color);
}

[data-bs-theme="dark"] .card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

[data-bs-theme="dark"] .sticky-header,
[data-bs-theme="dark"] .admin-header,
[data-bs-theme="dark"] footer {
    background: var(--card-bg) !important;
    border-color: var(--border-color) !important;
}

[data-bs-theme="dark"] .border-bottom {
    border-color: var(--border-color) !important;
}

[data-bs-theme="dark"] .table {
    color: var(--text-color);
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

[data-bs-theme="dark"] .table-light {
    background-color: rgba(255,255,255,0.05);
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
