/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --purple: #8b5cf6;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 16px;
    --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.1);
    --transition: all .25s cubic-bezier(.4, 0, .2, 1);
}

body {
    font-family: 'Vazirmatn', -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
}

body.dark-mode {
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
}

/* ===== Layout ===== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar.collapsed {
    width: 80px;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-item span:not(.badge),
.sidebar.collapsed .nav-section,
.sidebar.collapsed .user-info {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
}

.sidebar.collapsed .user-box {
    justify-content: center;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 22px;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.brand-icon .hgi {
    color: #fff;
}

.brand-text h2 {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.brand-text span {
    font-size: 11px;
    color: #94a3b8;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-section {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #64748b;
    padding: 16px 12px 8px;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
    transition: var(--transition);
    position: relative;
}

.nav-item .hgi {
    font-size: 20px;
    flex-shrink: 0;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: #fff;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.nav-item .badge {
    margin-right: auto;
    background: rgba(255, 255, 255, 0.15);
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: #fff;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
}

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

.user-info strong {
    display: block;
    font-size: 13px;
    color: #fff;
}

.user-info span {
    font-size: 11px;
    color: #94a3b8;
}

.logout-btn {
    color: #ef4444;
    font-size: 20px;
    text-decoration: none;
    transition: var(--transition);
}

.logout-btn:hover {
    transform: scale(1.15);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-right: 260px;
    padding: 24px 32px 40px;
    transition: var(--transition);
    min-width: 0;
}

.main-content.expanded {
    margin-right: 80px;
}

/* ===== Topbar ===== */
.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.menu-toggle {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-main);
}

.topbar-title {
    flex: 1;
}

.topbar-title h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 2px;
}

.topbar-title p {
    font-size: 13px;
    color: var(--text-muted);
}

.topbar-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    width: 42px;
    height: 42px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-muted);
    display: grid;
    place-items: center;
    transition: var(--transition);
    position: relative;
}

.icon-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.icon-btn .dot {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 4px;
}

.stat-card.gradient-blue::before {
    background: linear-gradient(90deg, #6366f1, #3b82f6);
}

.stat-card.gradient-green::before {
    background: linear-gradient(90deg, #10b981, #059669);
}

.stat-card.gradient-purple::before {
    background: linear-gradient(90deg, #8b5cf6, #a855f7);
}

.stat-card.gradient-orange::before {
    background: linear-gradient(90deg, #f59e0b, #f97316);
}

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

.stat-icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 26px;
}

.gradient-blue .stat-icon {
    background: #eef2ff;
    color: #6366f1;
}

.gradient-green .stat-icon {
    background: #ecfdf5;
    color: #10b981;
}

.gradient-purple .stat-icon {
    background: #f5f3ff;
    color: #8b5cf6;
}

.gradient-orange .stat-icon {
    background: #fff7ed;
    color: #f59e0b;
}

body.dark-mode .gradient-blue .stat-icon {
    background: rgba(99, 102, 241, 0.15);
}

body.dark-mode .gradient-green .stat-icon {
    background: rgba(16, 185, 129, 0.15);
}

body.dark-mode .gradient-purple .stat-icon {
    background: rgba(139, 92, 246, 0.15);
}

body.dark-mode .gradient-orange .stat-icon {
    background: rgba(245, 158, 11, 0.15);
}

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

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.2;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: 20px;
}

.stat-trend.up {
    background: #ecfdf5;
    color: #059669;
}

.stat-trend.down {
    background: #fef2f2;
    color: #dc2626;
}

body.dark-mode .stat-trend.up {
    background: rgba(16, 185, 129, 0.15);
}

body.dark-mode .stat-trend.down {
    background: rgba(239, 68, 68, 0.15);
}

/* ===== Content Grid ===== */
.content-grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.content-grid-2>.card:only-child {
    grid-column: span 2;
}

/* ===== Card ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.card-header p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.card-header-icon {
    font-size: 22px;
    color: var(--primary);
}

.card-body {
    padding: 22px;
}

.card-body.no-pad {
    padding: 0;
}

.link-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    font-size: 12px;
    text-decoration: none;
    font-weight: 600;
}

.link-more:hover {
    text-decoration: underline;
}

/* ===== Quick Actions ===== */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 12px;
    background: var(--bg-body);
    border: 1.5px dashed var(--border);
    border-radius: 14px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
}

.quick-action .hgi {
    font-size: 24px;
    color: var(--primary);
}

.quick-action:hover {
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    border-color: var(--primary);
    border-style: solid;
    transform: translateY(-3px);
}

body.dark-mode .quick-action:hover {
    background: rgba(99, 102, 241, 0.1);
}

/* ===== Table ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-body);
}

.data-table th {
    padding: 12px 18px;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.data-table td {
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}

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

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

.user-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: #fff;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 14px;
}

.user-cell strong {
    display: block;
    font-size: 13px;
}

.user-cell span {
    font-size: 11px;
    color: var(--text-muted);
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.status-badge.success {
    background: #ecfdf5;
    color: #059669;
}

.status-badge.muted {
    background: #f1f5f9;
    color: #64748b;
}

body.dark-mode .status-badge.success {
    background: rgba(16, 185, 129, 0.15);
}

body.dark-mode .status-badge.muted {
    background: rgba(100, 116, 139, 0.2);
}

.empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 32px !important;
}

/* ===== Event Item ===== */
.event-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px dashed var(--border);
}

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

.event-date {
    width: 58px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    border-radius: 12px;
    text-align: center;
    padding: 8px 4px;
}

body.dark-mode .event-date {
    background: rgba(99, 102, 241, 0.15);
}

.event-date strong {
    display: block;
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.event-date span {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
}

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

.event-info h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.event-info p {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

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

.empty-state .hgi {
    font-size: 48px;
    color: var(--border);
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 13px;
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
    .content-grid-2 {
        grid-template-columns: 1fr;
    }

    .content-grid-2>.card:only-child {
        grid-column: auto;
    }
}

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

    .sidebar:not(.collapsed) {
        transform: translateX(0);
        box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3);
    }

    .sidebar.collapsed {
        transform: translateX(100%);
    }

    .main-content {
        margin-right: 0 !important;
        padding: 18px;
    }

    .menu-toggle {
        display: grid;
        place-items: center;
    }

    .topbar-title h1 {
        font-size: 18px;
    }

    .topbar-title p {
        font-size: 11px;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
    }

    .stat-value {
        font-size: 22px;
    }

    .topbar-actions .icon-btn:nth-child(1) {
        display: none;
    }
}