/* ============================================
   سامانه سپاس - استایل‌های کمکی
   ============================================ */

* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

body {
    font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
    overflow-x: hidden;
}
.backup-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 190px;
    padding: 1.25rem;
    border: 2px dashed #c7d2fe;
    border-radius: 1rem;
    background: linear-gradient(145deg, #f8faff, #f1f5ff);
    color: #334155;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, transform .2s ease, box-shadow .2s ease;
}
.backup-dropzone:hover,
.backup-dropzone:focus-visible,
.backup-dropzone.is-dragging {
    border-color: #6366f1;
    background: #eef2ff;
    box-shadow: 0 10px 24px rgba(99, 102, 241, .12);
    outline: none;
}
.backup-dropzone.is-dragging { transform: scale(1.01); }
.backup-dropzone-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-bottom: .75rem;
    border-radius: 16px;
    background: #e0e7ff;
    color: #4f46e5;
}
.backup-selected-file {
    padding: .75rem 1rem;
    border: 1px solid #dbeafe;
    border-radius: .75rem;
    background: #eff6ff;
    color: #1e40af;
    direction: rtl;
    font-size: .8rem;
    overflow-wrap: anywhere;
}
.backup-selected-file.hidden,
#backup-restore-preview.hidden { display: none !important; }
.backup-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: .65rem;
}
.backup-preview-heading,
.backup-preview-note {
    grid-column: 1 / -1;
    padding: .8rem 1rem;
    border-radius: .75rem;
    background: #f8fafc;
    line-height: 1.8;
}
.backup-preview-card {
    display: grid;
    gap: .4rem;
    padding: .85rem;
    border: 1px solid #e2e8f0;
    border-radius: .75rem;
    background: #fff;
    color: #475569;
    font-size: .75rem;
    line-height: 1.7;
}
.backup-preview-card strong { color: #4338ca; font-size: .9rem; }
.backup-preview-note { background: #f0fdf4; color: #166534; font-size: .75rem; }
.backup-preview-note.warning {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
}
.backup-preview-note.warning strong { color: #9a3412; }
.backup-preview-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    padding: 1.5rem;
    color: #64748b;
    font-size: .8rem;
}
.backup-restore-progress {
    padding: 1rem;
    border: 1px solid #c7d2fe;
    border-radius: .85rem;
    background: #f8faff;
    color: #334155;
    font-size: .8rem;
    line-height: 1.8;
}
.backup-restore-progress.hidden { display: none !important; }
.backup-progress-track {
    width: 100%;
    height: .7rem;
    margin-top: .65rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e2e8f0;
}
.backup-progress-bar {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6366f1, #10b981);
    transition: width .25s ease;
}
.font-mono{
	font-family: 'Vazirmatn' !important;
	font-size: 13px !important;
}
.text-xs{
	font-size: 13px !important;
}
/* Scrollbar نازک و تمیز */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* اعداد فارسی برای بعضی جاها */
.fa-num {
    font-feature-settings: "ss02";
}

/* انیمیشن‌های ملایم */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.anim-fade    { animation: fadeIn 0.25s ease-out; }
.anim-slide   { animation: slideUp 0.3s ease-out; }
.anim-scale   { animation: scaleIn 0.2s ease-out; }

/* کارت پایه */
.app-card {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    overflow: hidden;
}

/* دکمه‌های اصلی */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    cursor: pointer;
    border: none;
    white-space: nowrap;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-primary {
    background: #6366f1;
    color: #fff;
}
.btn-primary:hover:not(:disabled) {
    background: #4f46e5;
}
.btn-success {
    background: #10b981;
    color: #fff;
}
.btn-success:hover:not(:disabled) {
    background: #059669;
}
.btn-danger {
    background: #ef4444;
    color: #fff;
}
.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}
.btn-warning {
    background: #f59e0b;
    color: #fff;
}
.btn-warning:hover:not(:disabled) {
    background: #d97706;
}
.btn-ghost {
    background: transparent;
    color: #64748b;
}
.btn-ghost:hover:not(:disabled) {
    background: #f1f5f9;
}
.btn-outline {
    background: #fff;
    color: #6366f1;
    border: 1px solid #c7d2fe;
}
.btn-outline:hover:not(:disabled) {
    background: #eef2ff;
}

/* فیلد ورودی */
.form-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: all 0.15s ease;
    background: #fff;
    font-family: inherit;
}
.form-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.form-input:disabled {
    background: #f8fafc;
    color: #94a3b8;
    cursor: not-allowed;
}
.form-label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #475569;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 500;
    white-space: nowrap;
}
.badge-success  { background: #d1fae5; color: #065f46; }
.badge-warning  { background: #fef3c7; color: #92400e; }
.badge-danger   { background: #fee2e2; color: #991b1b; }
.badge-info     { background: #dbeafe; color: #1e40af; }
.badge-gray     { background: #f1f5f9; color: #475569; }
.badge-primary  { background: #e0e7ff; color: #3730a3; }

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    z-index: 40;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0;
    gap: 0.125rem;
    font-size: 0.6875rem;
    color: #64748b;
    cursor: pointer;
    transition: color 0.15s ease;
    position: relative;
    background: none;
    border: none;
    font-family: inherit;
}
.bottom-nav-item.active {
    color: #6366f1;
}
.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: #6366f1;
    border-radius: 0 0 3px 3px;
}
.bottom-nav-item svg {
    width: 20px;
    height: 20px;
}

/* هدر اپ */
.app-header {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #fff;
    padding: 0.875rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 30;
}
.app-header-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    background: rgba(255,255,255,0.15);
    cursor: pointer;
    transition: background 0.15s ease;
    position: relative;
}
.app-header-icon:hover {
    background: rgba(255,255,255,0.25);
}
.app-header-icon .badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 0.625rem;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.15s ease-out;
}
.modal-content {
    background: #fff;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.2s ease-out;
    overflow: hidden;
}
.modal-header {
    padding: 1rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-body {
    padding: 1rem;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid #f1f5f9;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    background: #f8fafc;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    width: calc(100% - 2rem);
    max-width: 400px;
}
.toast {
    background: #fff;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    animation: slideUp 0.25s ease-out;
    pointer-events: auto;
    border-right: 4px solid;
}
.toast-success { border-color: #10b981; }
.toast-error   { border-color: #ef4444; }
.toast-warning { border-color: #f59e0b; }
.toast-info    { border-color: #6366f1; }

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}

/* Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: pulse 1.5s ease-in-out infinite;
    border-radius: 0.375rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* خالی بودن */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}
.empty-state svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    opacity: 0.5;
}

/* Login صفحه */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    padding: 1rem;
}
.login-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}
.login-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    border-radius: 1rem;
    color: #4f46e5;
    font-size: 2rem;
    font-weight: bold;
}
.login-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
}
.login-subtitle {
    font-size: 0.8125rem;
    color: #64748b;
    margin-bottom: 1.5rem;
}
.login-rotating-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.5rem;
    max-width: 100%;
    color: #6366f1;
    font-size: 0.75rem;
    font-weight: 500;
    text-decoration: none;
    overflow-wrap: anywhere;
    direction: rtl;
}
.login-rotating-link span { unicode-bidi: plaintext; }
.login-rotating-link:hover { color: #4338ca; }
.install-app-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    min-height: 42px;
    padding: .6rem 1rem;
    border: 1px solid #c7d2fe;
    border-radius: .75rem;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    color: #4338ca;
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.install-app-button:hover,
.install-app-button.is-installable {
    border-color: #818cf8;
    background: #e0e7ff;
    box-shadow: 0 6px 16px rgba(79, 70, 229, .12);
    transform: translateY(-1px);
}
.install-instructions {
    display: grid;
    justify-items: center;
    gap: .75rem;
    padding: .75rem .25rem;
    color: #475569;
    text-align: center;
    line-height: 1.9;
}
.install-instructions > i { color: #4f46e5; }
.install-instructions p { margin: 0; font-weight: 600; }
.install-instructions span { font-size: .8rem; color: #64748b; }
.login-rotating-link span::after {
    content: '|';
    display: inline-block;
    margin-inline-start: 2px;
    animation: login-caret-blink 0.8s steps(2, start) infinite;
}
@keyframes login-caret-blink {
    to { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
    .login-rotating-link span::after { animation: none; }
}
.login-btn {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-weight: 500;
    font-size: 0.9375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.15s ease;
    cursor: pointer;
    border: none;
    color: #fff;
}
.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

/* محتوای اصلی */
.main-content {
    padding: 1rem;
    padding-bottom: 5rem; /* برای bottom nav */
    min-height: calc(100vh - 60px);
}

/* Grid کارت‌ها */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

/* Stat Card */
.stat-card {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
}
.stat-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-size: 1.25rem;
}

/* جدول */
.app-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    background: #fff;
}
.app-table th {
    background: #f8fafc;
    padding: 0.75rem 0.5rem;
    text-align: right;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}
.app-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
.app-table tr:hover {
    background: #f8fafc;
}

/* ریسپانسیو */
@media (min-width: 768px) {
    .main-content {
        max-width: 100%;
        margin: 0 auto;
        padding: 1.5rem;
        padding-bottom: 6rem;
    }
}

/* موبایل: جدول اسکرول افقی */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
}

/* Quick Actions */
.quick-action {
    background: #fff;
    border-radius: 0.5rem;
    padding: 1rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid #f1f5f9;
    text-align: center;
}
.quick-action:hover {
    border-color: #c7d2fe;
    background: #f8fafc;
}
.quick-action svg {
    width: 24px;
    height: 24px;
    color: #6366f1;
}

/* Tabs */
.tab-bar {
    display: flex;
    background: #f1f5f9;
    border-radius: 0.5rem;
    padding: 0.25rem;
    gap: 0.25rem;
}
.tab-item {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #64748b;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s ease;
    background: none;
    border: none;
    font-family: inherit;
}
.tab-item.active {
    background: #fff;
    color: #6366f1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    margin-top: 1rem;
}
.pagination button {
    min-width: 32px;
    height: 32px;
    border-radius: 0.375rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    color: #475569;
    cursor: pointer;
    font-size: 0.8125rem;
    font-family: inherit;
}
.pagination button:hover:not(:disabled) {
    background: #f8fafc;
}
.pagination button.active {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}
.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
#drop-zone {
    transition: all 0.2s ease;
}
#drop-zone:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}