/* ==========================================================================
   Vazirmatn Local Font Declarations (Zero CDN, 100% Local WOFF2)
   ========================================================================== */
@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-SemiBold.woff2') format('woff2');
    font-weight: 600;
    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;
}

/* ==========================================================================
   Fintech Dark Design System Variables
   ========================================================================== */
:root {
    --bg-main: #090d16;
    --bg-surface: #0f172a;
    --bg-card: #131d33;
    --bg-card-hover: #1a2744;
    --bg-sidebar: #070a12;
    --bg-sidebar-active: rgba(59, 130, 246, 0.12);
    
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-color: #243049;
    --border-focus: #3b82f6;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #8896ab;

    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-primary-glow: rgba(59, 130, 246, 0.35);

    --color-success: #10b981;
    --color-success-hover: #059669;
    --color-success-glow: rgba(16, 185, 129, 0.25);

    --color-warning: #f59e0b;
    --color-warning-hover: #d97706;

    --color-danger: #ef4444;
    --color-danger-hover: #dc2626;

    --color-purple: #8b5cf6;

    --font-sans: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    
    --radius-sm: 0.375rem;
    --radius-md: 0.625rem;
    --radius-lg: 0.875rem;
    --radius-xl: 1.125rem;
    
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 25px -5px rgba(59, 130, 246, 0.2);
}

/* ==========================================================================
   Global Reset & Base Rules
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    direction: rtl;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(circle at 90% 10%, rgba(59, 130, 246, 0.08) 0%, transparent 35%),
        radial-gradient(circle at 10% 90%, rgba(16, 185, 129, 0.05) 0%, transparent 35%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    font-size: 0.925rem;
    line-height: 1.6;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: #60a5fa;
    text-decoration: none;
}

code, kbd, samp, pre {
    font-family: var(--font-mono);
    font-size: 0.875em;
    direction: ltr;
    display: inline-block;
}

/* ==========================================================================
   Layout Architecture
   ========================================================================== */
.admin-wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 270px;
    background-color: var(--bg-sidebar);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 20;
    box-shadow: -4px 0 25px rgba(0, 0, 0, 0.3);
}

.sidebar-header {
    padding: 1.4rem 1.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent);
}

.sidebar-header::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-success));
    border-radius: 3px;
    box-shadow: 0 0 10px var(--color-primary);
}

.sidebar-nav {
    padding: 1.25rem 0.75rem;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.nav-item:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
    transform: translateX(-3px);
}

.nav-item.active {
    background-color: var(--bg-sidebar-active);
    color: #ffffff;
    font-weight: 600;
    border-right: 3px solid var(--color-primary);
    box-shadow: inset 0 0 15px rgba(59, 130, 246, 0.1);
}

.sidebar-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(0, 0, 0, 0.2);
}

.sidebar-footer .status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--color-success);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--color-success);
}

/* Main Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    min-width: 0;
}

.topbar {
    height: 70px;
    background-color: rgba(19, 29, 51, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-size: 0.9rem;
}

.topbar-user span {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.page-container {
    padding: 2rem;
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   Metrics & Dashboard Stats Cards
   ========================================================================== */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.3), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover {
    border-color: #3b4d6e;
    transform: translateY(-2px);
    box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.4);
}

.card:hover::before {
    opacity: 1;
}

.stat-title {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-value {
    font-size: 1.95rem;
    font-weight: 800;
    color: #ffffff;
    font-feature-settings: "tnum" 1;
    line-height: 1.2;
}

.stat-sub {
    font-size: 0.82rem;
    color: var(--color-success);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 500;
}

/* ==========================================================================
   Data Tables & Grids
   ========================================================================== */
.table-responsive {
    overflow-x: auto;
    margin-top: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: right;
}

th {
    background-color: rgba(9, 13, 22, 0.9);
    color: var(--text-muted);
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.025);
    color: var(--text-primary);
}

/* ==========================================================================
   Badges & Indicators
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.badge-live, .badge-success, .badge-approved, .badge-completed, .badge-active {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.badge-live::before, .badge-success::before, .badge-approved::before, .badge-completed::before, .badge-active::before {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.badge-degraded, .badge-warning, .badge-pending, .badge-pending_review, .badge-pending_blockchain, .badge-pending_payment {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}
.badge-degraded::before, .badge-warning::before, .badge-pending::before, .badge-pending_review::before, .badge-pending_blockchain::before, .badge-pending_payment::before {
    background: #f59e0b;
    box-shadow: 0 0 6px #f59e0b;
}

.badge-error, .badge-danger, .badge-rejected, .badge-cancelled, .badge-blocked {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.badge-error::before, .badge-danger::before, .badge-rejected::before, .badge-cancelled::before, .badge-blocked::before {
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
}

.badge-secondary, .badge-stale {
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.25);
}
.badge-secondary::before, .badge-stale::before {
    background: #94a3b8;
}

/* ==========================================================================
   Form Elements & Inputs
   ========================================================================== */
.form-group {
    margin-bottom: 1.4rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input, select, textarea {
    width: 100%;
    padding: 0.8rem 1.1rem;
    background-color: #0b1120;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.92rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background-color: #0d1527;
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.35rem;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px var(--color-primary-glow);
}

.btn:active {
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(135deg, var(--color-success), var(--color-success-hover));
}
.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 15px var(--color-success-glow);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-danger), var(--color-danger-hover));
}
.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background: #243049;
    color: var(--text-primary);
}
.btn-secondary:hover {
    background: #334155;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   Alerts & Notifications
   ========================================================================== */
.alert {
    padding: 1.1rem 1.4rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.75rem;
    font-size: 0.92rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #6ee7b7;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

/* ==========================================================================
   Login Experience
   ========================================================================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    padding: 1.5rem;
    background: 
        radial-gradient(circle at 50% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 80% 80%, rgba(16, 185, 129, 0.08) 0%, transparent 40%),
        #070a12;
}

.login-box {
    width: 100%;
    max-width: 440px;
    background: rgba(19, 29, 51, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2.75rem;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.6), var(--shadow-glow);
}

.login-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
    text-align: center;
    margin-bottom: 0.4rem;
    letter-spacing: -0.02em;
}

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 2rem;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1.5rem;
}

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

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 520px;
    padding: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

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

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s;
}

.modal-close:hover {
    color: #ffffff;
}
