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

:root {
    --bg-primary: #0B0B14;
    --bg-secondary: #0D0D18;
    --bg-card: #14141F;
    --bg-card-hover: #1A1A28;
    --bg-sidebar: #0E0E1A;
    --bg-input: #1A1A28;

    --border-color: rgba(255, 255, 255, 0.06);
    --border-color-hover: rgba(255, 255, 255, 0.12);

    --text-primary: #FFFFFF;
    --text-secondary: #A0A0B8;
    --text-muted: #6B6B80;
    --text-placeholder: #4A4A5A;

    --accent-purple: #7C3AED;
    --accent-purple-light: #8B5CF6;
    --accent-blue: #4F46E5;
    --accent-cyan: #06B6D4;
    --accent-orange: #F59E0B;
    --accent-green: #10B981;
    --accent-red: #EF4444;
    --accent-pink: #EC4899;

    --gradient-primary: linear-gradient(135deg, #7C3AED, #4F46E5);
    --gradient-purple: linear-gradient(135deg, #7C3AED, #8B5CF6);
    --gradient-cyan: linear-gradient(135deg, #06B6D4, #0891B2);
    --gradient-orange: linear-gradient(135deg, #F59E0B, #D97706);
    --gradient-green: linear-gradient(135deg, #10B981, #059669);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow-purple: 0 0 20px rgba(124, 58, 237, 0.3);
    --shadow-glow-cyan: 0 0 20px rgba(6, 182, 212, 0.2);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --sidebar-width: 260px;
    --topbar-height: 72px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.35s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
}

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

a {
    color: var(--accent-purple-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--accent-purple);
}

img {
    max-width: 100%;
    height: auto;
}

/* ========================= */
/*        SCROLLBAR          */
/* ========================= */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ========================= */
/*       LAYOUT              */
/* ========================= */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    padding: 24px 32px;
    padding-top: calc(var(--topbar-height) + 24px);
    min-height: 100vh;
    background: var(--bg-primary);
}

/* ========================= */
/*       SIDEBAR             */
/* ========================= */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

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

.sidebar-logo {
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
}

.sidebar-brand h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

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

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-normal);
    cursor: pointer;
    position: relative;
    text-decoration: none;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-item.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow-purple);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--accent-purple);
    border-radius: 2px;
}

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

.nav-item.active svg,
.nav-item.active i {
    opacity: 1;
}

/* Sidebar Pro Banner */
.sidebar-promo {
    margin: 16px 12px;
    padding: 20px 16px;
    background: linear-gradient(135deg, #1a1040, #2d1b69);
    border-radius: var(--radius-lg);
    text-align: center;
    border: 1px solid rgba(124, 58, 237, 0.2);
}

.sidebar-promo .promo-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.sidebar-promo h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.sidebar-promo p {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.6;
}

.sidebar-promo .btn-promo {
    display: inline-block;
    padding: 8px 24px;
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-normal);
    border: none;
    cursor: pointer;
}

.sidebar-promo .btn-promo:hover {
    box-shadow: var(--shadow-glow-purple);
    transform: translateY(-1px);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-color);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

/* ========================= */
/*       TOPBAR              */
/* ========================= */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: var(--sidebar-width);
    height: var(--topbar-height);
    background: rgba(11, 11, 20, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 90;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.admin-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
}

.admin-info h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.topbar-icon {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.topbar-icon:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.topbar-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 18px;
    height: 18px;
    background: var(--accent-red);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: white;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 16px;
    min-width: 240px;
    transition: border-color var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--accent-purple);
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 13px;
    width: 100%;
    outline: none;
}

.search-box input::placeholder {
    color: var(--text-placeholder);
}

.search-shortcut {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
    padding: 2px 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    white-space: nowrap;
}

/* ========================= */
/*       PAGE HEADER         */
/* ========================= */
.page-header {
    margin-bottom: 28px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

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

/* ========================= */
/*       STAT CARDS          */
/* ========================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

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

.stat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.stat-card-title {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.stat-icon.purple { background: var(--gradient-primary); }
.stat-icon.cyan { background: var(--gradient-cyan); }
.stat-icon.orange { background: var(--gradient-orange); }
.stat-icon.green { background: var(--gradient-green); }

.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    margin-top: 4px;
}

.stat-change.positive {
    color: var(--accent-green);
    background: rgba(16, 185, 129, 0.1);
}

.stat-change.negative {
    color: var(--accent-red);
    background: rgba(239, 68, 68, 0.1);
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 8px 0;
    letter-spacing: -0.5px;
}

.stat-value small {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
    margin-right: 4px;
}

.stat-footer {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-sparkline {
    height: 40px;
    margin-top: 12px;
}

/* ========================= */
/*       CARDS               */
/* ========================= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px;
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: var(--border-color-hover);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ========================= */
/*       CHARTS              */
/* ========================= */
.charts-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

/* ========================= */
/*       DATA TABLE          */
/* ========================= */
.data-table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 12px 16px;
    text-align: right;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

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

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.product-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.product-thumb {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.product-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

/* ========================= */
/*       BADGES              */
/* ========================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

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

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-orange);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-info {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.badge-purple {
    background: rgba(124, 58, 237, 0.1);
    color: var(--accent-purple-light);
    border: 1px solid rgba(124, 58, 237, 0.2);
}

.stock-badge {
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.stock-low {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-orange);
}

.stock-ok {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
}

.stock-out {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

/* ========================= */
/*       ACTION BUTTONS      */
/* ========================= */
.actions-cell {
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
}

.action-btn.edit {
    background: rgba(124, 58, 237, 0.1);
    color: var(--accent-purple-light);
}
.action-btn.edit:hover {
    background: rgba(124, 58, 237, 0.2);
}

.action-btn.delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}
.action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.2);
}

.action-btn.more {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}
.action-btn.more:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ========================= */
/*       BUTTONS             */
/* ========================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    border: none;
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}
.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
    transform: translateY(-1px);
    color: white;
}

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

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-sm {
    padding: 6px 16px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 32px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ========================= */
/*       FORMS               */
/* ========================= */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    transition: border-color var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

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

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

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B6B80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 36px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 11px;
    color: var(--accent-red);
    margin-top: 4px;
}

/* ========================= */
/*       DROPDOWN            */
/* ========================= */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.dropdown-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-hover);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    display: none;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--text-secondary);
    font-size: 13px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    font-family: 'Vazirmatn', sans-serif;
    text-align: right;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
}

/* ========================= */
/*       MODAL               */
/* ========================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 18px;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* ========================= */
/*       ALERT / FLASH       */
/* ========================= */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 13px;
    margin-bottom: 20px;
    border: 1px solid;
}

.alert-success {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
}

.alert-error {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--accent-orange);
}

.alert-info {
    background: rgba(6, 182, 212, 0.08);
    border-color: rgba(6, 182, 212, 0.2);
    color: var(--accent-cyan);
}

/* ========================= */
/*       PAGINATION          */
/* ========================= */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.pagination a:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.pagination .active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ========================= */
/*       FILTERS BAR         */
/* ========================= */
.filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters-bar .filters-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-btn {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.filter-btn.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
}

/* ========================= */
/*       EMPTY STATE         */
/* ========================= */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ========================= */
/*       TOGGLE SWITCH       */
/* ========================= */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-full);
    transition: var(--transition-normal);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    right: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition-normal);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-green);
}

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

/* ========================= */
/*       FILE UPLOAD         */
/* ========================= */
.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.file-upload:hover {
    border-color: var(--accent-purple);
    background: rgba(124, 58, 237, 0.03);
}

.file-upload input {
    display: none;
}

.file-upload svg {
    width: 40px;
    height: 40px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

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

.file-upload .upload-hint {
    font-size: 11px;
    color: var(--text-placeholder);
    margin-top: 4px;
}

.image-preview {
    position: relative;
    display: inline-block;
    margin-top: 12px;
}

.image-preview img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.image-preview .remove-image {
    position: absolute;
    top: -8px;
    left: -8px;
    width: 24px;
    height: 24px;
    background: var(--accent-red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    border: 2px solid var(--bg-card);
}

/* ========================= */
/*   ORDER STATUS TIMELINE   */
/* ========================= */
.status-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 20px 0;
}

.status-step {
    flex: 1;
    text-align: center;
    position: relative;
}

.status-step::after {
    content: '';
    position: absolute;
    top: 16px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--border-color);
    z-index: 0;
}

.status-step:last-child::after {
    display: none;
}

.status-step.completed::after {
    background: var(--accent-green);
}

.status-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    position: relative;
    z-index: 1;
    font-size: 14px;
}

.status-step.completed .status-dot {
    background: var(--accent-green);
    border-color: var(--accent-green);
    color: white;
}

.status-step.current .status-dot {
    border-color: var(--accent-purple);
    background: var(--gradient-primary);
    color: white;
}

.status-label {
    font-size: 11px;
    color: var(--text-muted);
}

.status-step.completed .status-label,
.status-step.current .status-label {
    color: var(--text-primary);
}

/* ========================= */
/*       TABS                */
/* ========================= */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.tab {
    padding: 12px 20px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
}

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

.tab.active {
    color: var(--accent-purple-light);
    border-bottom-color: var(--accent-purple);
}

/* ========================= */
/*    LOGIN PAGE             */
/* ========================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    text-align: center;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
    color: white;
    box-shadow: var(--shadow-glow-purple);
}

.login-card h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-card .subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.login-card .form-group {
    text-align: right;
}

/* ========================= */
/*    INSTALL WIZARD         */
/* ========================= */
.install-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 20px;
}

.install-container {
    width: 100%;
    max-width: 600px;
}

.install-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
}

.install-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 32px;
}

.install-step {
    display: flex;
    align-items: center;
    gap: 8px;
}

.install-step-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 2px solid var(--border-color);
}

.install-step.active .install-step-dot {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--accent-purple);
}

.install-step.done .install-step-dot {
    background: var(--accent-green);
    color: white;
    border-color: var(--accent-green);
}

.install-step-line {
    width: 40px;
    height: 2px;
    background: var(--border-color);
}

.install-step.done + .install-step .install-step-line,
.install-step.done .install-step-line {
    background: var(--accent-green);
}

.check-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 8px;
}

.check-item .check-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.check-item .check-status {
    font-size: 12px;
    font-weight: 600;
}

.check-item .check-status.pass {
    color: var(--accent-green);
}

.check-item .check-status.fail {
    color: var(--accent-red);
}

/* ========================= */
/*    LOADING / SKELETON     */
/* ========================= */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

/* ========================= */
/*    RESPONSIVE             */
/* ========================= */
.mobile-menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

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

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
        transition: transform var(--transition-normal);
    }

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

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

    .main-content {
        margin-right: 0;
        padding: 16px;
        padding-top: calc(var(--topbar-height) + 16px);
    }

    .topbar {
        right: 0;
        padding: 0 16px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .search-box {
        display: none;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .data-table-container {
        margin: 0 -16px;
        padding: 0 16px;
    }

    .modal {
        max-width: 100%;
        margin: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 85vh;
    }

    .modal-overlay {
        align-items: flex-end;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 13px;
    }

    .topbar-right .admin-info {
        display: none;
    }

    .page-header h1 {
        font-size: 20px;
    }

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

/* ========================= */
/*    TOAST NOTIFICATIONS    */
/* ========================= */
.toast-container {
    position: fixed;
    top: 24px;
    left: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    color: var(--text-primary);
    animation: toast-in 0.3s ease;
    min-width: 280px;
}

.toast.toast-success { border-right: 3px solid var(--accent-green); }
.toast.toast-error { border-right: 3px solid var(--accent-red); }
.toast.toast-warning { border-right: 3px solid var(--accent-orange); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ========================= */
/*    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(--accent-green); }
.text-danger { color: var(--accent-red); }
.text-warning { color: var(--accent-orange); }
.text-purple { color: var(--accent-purple-light); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

.hidden { display: none !important; }
.visible { display: block !important; }

.w-100 { width: 100%; }
.overflow-hidden { overflow: hidden; }
.cursor-pointer { cursor: pointer; }
