@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;
}

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border: #e2e8f0;
    --font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    font-family: var(--font-family);
    direction: rtl;
    text-align: right;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 14px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.app-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.03);
}
.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}
.header-brand .brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 19px;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.3px;
}
.header-brand .brand-logo {
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(59, 130, 246, 0.25));
}
.header-balance {
    display: flex;
    gap: 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 13px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}
.header-balance .label { color: var(--text-muted); }
.header-balance .val { font-weight: 700; }
.header-balance .val.pos { color: var(--success); }
.header-balance .val.neg { color: var(--danger); }

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.header-user .user-name {
    font-weight: 600;
    font-size: 13px;
    background: #f1f5f9;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.app-nav {
    background: #0f172a;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.nav-list {
    display: flex;
    list-style: none;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.nav-list a {
    color: #94a3b8;
    text-decoration: none;
    padding: 7px 16px;
    border-radius: 25px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
}
.nav-list a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transform: translateY(-1px);
}
.nav-list a.active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}
.nav-divider {
    width: 1px;
    height: 22px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 6px;
}

.app-main {
    padding: 24px 16px 48px;
    min-height: calc(100vh - 160px);
}
.app-footer {
    border-top: 1px solid var(--border);
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
}

.card {
    background: var(--bg-card);
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 12px;
    box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.03);
    margin-bottom: 24px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}
.card-header h3, .card-header h4 { font-size: 15px; font-weight: 700; color: var(--text-main); }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: #fafbfc; }

.table-responsive { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; text-align: right; }
.table th, .table td { padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.table th { background: #f8fafc; color: var(--text-muted); font-weight: 600; }
.table-hover tbody tr:hover { background: #f8fafc; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}
.badge-ok { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.badge-warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-bad { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.badge-info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.badge-muted { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); color: #fff; }
.btn-primary:hover { background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); }
.btn-secondary { background: #475569; color: #fff; }
.btn-secondary:hover { background: #334155; }
.btn-success { background: linear-gradient(135deg, #10b981 0%, #059669 100%); color: #fff; }
.btn-success:hover { background: linear-gradient(135deg, #059669 0%, #047857 100%); box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3); }
.btn-warning { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); color: #fff; }
.btn-warning:hover { background: linear-gradient(135deg, #d97706 0%, #b45309 100%); box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3); }
.btn-danger { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); color: #fff; }
.btn-danger:hover { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }
.btn-outline-primary { border-color: #93c5fd; color: #2563eb; background: #fff; }
.btn-outline-primary:hover { background: #eff6ff; border-color: #3b82f6; }
.btn-outline-secondary { border-color: #cbd5e1; color: #475569; background: #fff; }
.btn-outline-secondary:hover { background: #f8fafc; border-color: #94a3b8; }
.btn-outline-danger { border-color: #fca5a5; color: #dc2626; background: #fff; }
.btn-outline-danger:hover { background: #fef2f2; border-color: #ef4444; }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 11px; border-radius: 6px; }
.btn-lg { padding: 12px 24px; font-size: 15px; font-weight: 700; border-radius: 10px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; color: var(--text-main); }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    background: #fff;
    transition: all 0.2s;
    box-sizing: border-box;
}
.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3.5px rgba(59, 130, 246, 0.15);
}
.ltr-input { direction: ltr; text-align: left; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .col { flex: 1; min-width: 180px; }

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.btn-close { background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 14px;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.04);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -4px rgba(15, 23, 42, 0.08);
}
.stat-icon {
    font-size: 26px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #f1f5f9;
    flex-shrink: 0;
}
.stat-title { font-size: 13px; color: var(--text-muted); display: block; font-weight: 500; }
.stat-value { font-size: 20px; font-weight: 800; display: block; color: var(--text-main); }

/* Floating Glass Modals */
.modal-backdrop, .modal-dialog-wrapper {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.7) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999 !important;
    padding: 20px;
    box-sizing: border-box;
}

.modal-box {
    background: #ffffff;
    border-radius: 16px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(226, 232, 240, 0.8);
    overflow: hidden;
    position: relative;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.92) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}
.modal-header h4 { font-size: 16px; font-weight: 700; color: var(--text-main); margin: 0; }
.modal-header .btn-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 20px;
    line-height: 1;
    color: var(--text-muted);
    background: #fff;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}
.modal-header .btn-close:hover {
    background: #fee2e2;
    color: var(--danger);
    border-color: #fca5a5;
    transform: rotate(90deg);
}
.modal-body { padding: 20px; max-height: calc(90vh - 140px); overflow-y: auto; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8fafc;
}

.toast-container { position: fixed; bottom: 20px; left: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1e293b; color: #fff; padding: 10px 16px; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); font-size: 13px; }

.progress { height: 10px; background: #e2e8f0; border-radius: 5px; overflow: hidden; margin-top: 6px; }
.progress-bar { height: 100%; transition: width 0.3s; }
.bg-success { background-color: var(--success); }
.bg-warning { background-color: var(--warning); }
.bg-danger { background-color: var(--danger); }

.bare-body { background: #f1f5f9; display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.bare-container { width: 100%; max-width: 420px; }
.bare-card { background: #fff; border-radius: 10px; border: 1px solid var(--border); padding: 30px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.bare-brand { text-align: center; margin-bottom: 24px; }
.bare-brand .brand-logo { font-size: 40px; display: block; margin-bottom: 8px; }
.bare-brand h2 { font-size: 20px; font-weight: 700; color: var(--text-main); }

/* Page Header & Top Action Buttons */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.page-title h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
}
.page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Modern Segmented Nav Tabs */
.nav-tabs {
    display: inline-flex;
    list-style: none;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
    gap: 4px;
}
.nav-tabs li a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-tabs li:hover a { color: var(--text-main); }
.nav-tabs li.active a {
    background: #ffffff;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.pagination-container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.pagination { display: flex; list-style: none; gap: 4px; }
.page-item .page-link { display: block; padding: 6px 12px; border: 1px solid var(--border); border-radius: 4px; color: var(--text-main); text-decoration: none; font-size: 13px; }
.page-item.active .page-link { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination-info { font-size: 12px; color: var(--text-muted); }

.input-group { display: flex; gap: 6px; }
.input-group input { flex: 1; }

.status-summary-grid { display: flex; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.summary-pill {
    flex: 1;
    min-width: 120px;
    padding: 14px 18px;
    border-radius: 12px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.summary-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.05);
}
.summary-pill .count { font-size: 24px; font-weight: 800; display: block; line-height: 1.2; }
.summary-pill .label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.summary-pill.active { border-color: #bbf7d0; background: linear-gradient(135deg, #fff, #f0fdf4); }
.summary-pill.active .count { color: var(--success); }
.summary-pill.suspended { border-color: #fde68a; background: linear-gradient(135deg, #fff, #fffbeb); }
.summary-pill.suspended .count { color: var(--warning); }
.summary-pill.expired { border-color: #fecaca; background: linear-gradient(135deg, #fff, #fff5f5); }
.summary-pill.expired .count { color: var(--danger); }

/* Field validation and feedback */
.form-control.is-invalid, input:invalid.is-invalid, select:invalid.is-invalid {
    border-color: var(--danger) !important;
    background-color: #fef2f2 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}
.invalid-feedback {
    display: block;
    color: var(--danger);
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}
.btn.loading {
    opacity: 0.7;
    pointer-events: none;
    cursor: wait;
}
.toast {
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.toast.toast-error {
    background: #b91c1c;
    border-right: 4px solid #f87171;
}
.toast.toast-success {
    background: #15803d;
    border-right: 4px solid #4ade80;
}
.toast.toast-warning {
    background: #b45309;
    border-right: 4px solid #fbbf24;
}

/* ── Modern Action Card Buttons ────────────────────────────── */
.action-buttons-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.action-card-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 18px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    text-align: right;
    font-family: inherit;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    position: relative;
    overflow: hidden;
}
.action-card-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.08);
}
.action-card-icon {
    font-size: 22px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #f1f5f9;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.action-card-btn:hover .action-card-icon {
    transform: scale(1.1);
}
.action-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.action-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}
.action-card-desc {
    font-size: 12px;
    color: var(--text-muted);
}
.action-card-arrow {
    font-size: 16px;
    color: #94a3b8;
    transition: transform 0.2s, color 0.2s;
}
.action-card-btn:hover .action-card-arrow {
    transform: translateX(-4px);
    color: var(--primary);
}

.action-card-primary {
    border-color: #bfdbfe;
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
}
.action-card-primary .action-card-icon { background: #dbeafe; }
.action-card-primary:hover { border-color: #3b82f6; }

.action-card-success {
    border-color: #bbf7d0;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}
.action-card-success .action-card-icon { background: #dcfce7; }
.action-card-success:hover { border-color: #10b981; }

.action-card-warning {
    border-color: #fde68a;
    background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
}
.action-card-warning .action-card-icon { background: #fef3c7; }
.action-card-warning:hover { border-color: #f59e0b; }

.action-card-info {
    border-color: #bae6fd;
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
}
.action-card-info .action-card-icon { background: #e0f2fe; }
.action-card-info:hover { border-color: #0284c7; }

.action-card-purple {
    border-color: #ddd6fe;
    background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
}
.action-card-purple .action-card-icon { background: #ede9fe; }
.action-card-purple:hover { border-color: #8b5cf6; }

.action-card-danger {
    border-color: #fecaca;
    background: linear-gradient(135deg, #ffffff 0%, #fff5f5 100%);
}
.action-card-danger .action-card-icon { background: #fee2e2; }
.action-card-danger .action-card-title { color: #dc2626; }
.action-card-danger:hover { border-color: #ef4444; }

/* ── Service Details & Stats ────────────────────────────────── */
.service-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.stat-box {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.stat-box .label {
    font-size: 11px;
    color: var(--text-muted);
}
.stat-box code {
    font-family: monospace;
    font-weight: 600;
    color: #4338ca;
    background: #eef2ff;
    padding: 2px 6px;
    border-radius: 4px;
    width: fit-content;
}
