@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2");
    font-style: normal;
    font-weight: 700;
    font-display: swap;
}

:root {
    color-scheme: dark;
    --bg-dark: #0f172a;
    --bg-purple: #1e1b4b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --primary: #8b5cf6;
    --radius-lg: 18px;
    --radius-xl: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    color: var(--text-main);
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-purple) 55%, #312e81);
    font-family: "Vazirmatn", sans-serif;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
input, select, textarea { color: var(--text-main); }

.hidden { display: none !important; }

.icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    flex: 0 0 auto;
    vertical-align: middle;
}

.background-orb {
    position: fixed;
    z-index: 0;
    pointer-events: none;
    border-radius: 50%;
    opacity: 0.28;
    filter: blur(90px);
    animation: float 14s ease-in-out infinite;
}
.orb-one { top: -120px; right: -100px; width: 420px; height: 420px; background: #7c3aed; }
.orb-two { bottom: -120px; left: -100px; width: 340px; height: 340px; background: #db2777; animation-delay: 2s; }
.orb-three { top: 42%; left: 35%; width: 260px; height: 260px; background: #059669; animation-delay: 4s; }

.page-container {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 60px;
}

.glass {
    background: rgba(255, 255, 255, 0.055);
    border: 1px solid var(--border);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.glass-strong {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}

.header-panel { margin-bottom: 24px; padding: 24px; border-radius: var(--radius-xl); }

.header-main, .brand, .header-actions, .modal-actions, .password-input,
.card-header, .card-user, .card-actions, .card-row, .card-label, .card-value {
    display: flex;
    align-items: center;
}

.header-main { justify-content: space-between; gap: 24px; }
.brand { gap: 14px; }

.brand-icon {
    width: 58px; height: 58px;
    display: grid; place-items: center;
    border-radius: 18px; color: #fff;
    background: linear-gradient(135deg, #7c3aed, #d946ef);
    box-shadow: 0 12px 28px rgba(124, 58, 237, 0.35);
}
.brand-icon .icon { width: 29px; height: 29px; }

.brand h1 {
    margin: 0;
    font-size: clamp(1.45rem, 3vw, 2rem);
    font-weight: 700;
    background: linear-gradient(90deg, #fff, #c4b5fd, #f5d0fe);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.brand p { margin: 5px 0 0; color: var(--text-muted); font-size: 0.85rem; }

.header-actions { gap: 10px; width: min(100%, 510px); }

.search-box { position: relative; flex: 1; }
.search-box .icon {
    position: absolute; top: 50%; right: 14px;
    color: #64748b; transform: translateY(-50%);
}
.search-box input {
    width: 100%; height: 46px; padding: 0 44px 0 14px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px; outline: 0;
    background: rgba(15, 23, 42, 0.65);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.button {
    min-height: 46px; padding: 0 18px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border-radius: 12px; color: #fff; font-weight: 700;
    transition: transform 0.2s, filter 0.2s, background 0.2s;
}
.button:hover { filter: brightness(1.1); transform: translateY(-1px); }
.button:active { transform: translateY(1px); }

.button-primary {
    background: linear-gradient(100deg, #7c3aed, #d946ef);
    box-shadow: 0 10px 24px rgba(124, 58, 237, 0.25);
}
.button-secondary {
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
}
.button-danger {
    background: linear-gradient(100deg, #e11d48, #ef4444);
    box-shadow: 0 10px 24px rgba(239, 68, 68, 0.2);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    min-height: 92px; padding: 16px;
    display: flex; align-items: center; gap: 13px;
    border-radius: var(--radius-lg);
}

.stat-icon {
    width: 48px; height: 48px;
    display: grid; place-items: center;
    border-radius: 14px;
}
.stat-icon .icon { width: 22px; height: 22px; }
.stat-icon.blue { color: #60a5fa; background: rgba(59, 130, 246, 0.16); }
.stat-icon.green { color: #34d399; background: rgba(16, 185, 129, 0.16); }
.stat-icon.yellow { color: #fbbf24; background: rgba(245, 158, 11, 0.16); }
.stat-icon.red { color: #fb7185; background: rgba(244, 63, 94, 0.16); }

.stat-card span { display: block; color: var(--text-muted); font-size: 0.75rem; }
.stat-card strong { display: block; margin-top: 4px; color: #fff; font-size: 1.35rem; }

.accounts-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.account-card {
    min-width: 0;
    padding: 19px;
    border-radius: var(--radius-lg);
    content-visibility: auto;
    contain-intrinsic-size: 330px;
    will-change: transform;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}
.account-card:hover {
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 18px 36px rgba(124, 58, 237, 0.14);
    transform: translateY(-3px);
}

.card-header {
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.card-user { min-width: 0; gap: 11px; }

.user-avatar {
    width: 46px; height: 46px;
    display: grid; place-items: center;
    flex: 0 0 auto;
    border-radius: 14px; color: #fff;
    background: linear-gradient(135deg, #7c3aed, #d946ef);
    font-size: 1.2rem; font-weight: 700;
}

.user-info { min-width: 0; }
.user-info h3 {
    overflow: hidden; margin: 0;
    color: #fff; font-size: 1rem;
    text-overflow: ellipsis; white-space: nowrap;
}

.meta-row {
    display: flex; align-items: center; gap: 6px;
    flex-wrap: wrap; margin-top: 4px;
}

.bank-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.7rem;
}
.bank-resalat { color: #34d399; background: rgba(16, 185, 129, 0.14); border-color: rgba(16, 185, 129, 0.3); }
.bank-redbank { color: #fbbf24; background: rgba(245, 158, 11, 0.14); border-color: rgba(245, 158, 11, 0.3); }

.last-login-badge {
    display: inline-flex; align-items: center; gap: 4px;
    color: #94a3b8; font-size: 0.7rem; vertical-align: middle;
}
.last-login-badge .icon { width: 12px; height: 12px; color: #64748b; }

.card-id { color: #64748b; font-size: 0.7rem; }

.card-actions { gap: 5px; }

.card-action, .icon-button {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    border-radius: 9px; color: #94a3b8;
    background: rgba(255, 255, 255, 0.06);
    transition: background 0.2s, color 0.2s;
}
.card-action:hover { color: #fff; background: rgba(139, 92, 246, 0.7); }
.card-action.delete:hover { background: rgba(239, 68, 68, 0.8); }
.card-action .icon, .icon-button .icon { width: 16px; height: 16px; }

.card-row {
    justify-content: space-between; gap: 12px;
    min-height: 42px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.card-label { gap: 7px; color: #94a3b8; font-size: 0.78rem; }
.card-label .icon { width: 14px; height: 14px; color: #64748b; }

.card-value {
    min-width: 0; max-width: 65%; gap: 7px;
    overflow: hidden; color: #f8fafc;
    font-size: 0.78rem;
    text-overflow: ellipsis; white-space: nowrap;
}

.password-value { font-family: monospace; direction: ltr; }
.password-value.is-visible { letter-spacing: normal; }

.password-card-toggle {
    padding: 0; color: #64748b; background: none;
}
.password-card-toggle:hover { color: var(--primary); }

.card-link {
    display: flex; align-items: center; gap: 6px;
    max-width: 100%; margin-top: 13px;
    overflow: hidden; color: #a78bfa;
    font-size: 0.75rem; text-decoration: none;
    text-overflow: ellipsis; white-space: nowrap;
    direction: ltr; justify-content: flex-start;
}
.card-link:hover { color: #ddd6fe; }

.empty-state { padding: 70px 20px; text-align: center; }
.empty-icon {
    width: 84px; height: 84px; margin: 0 auto 16px;
    display: grid; place-items: center;
    border-radius: 50%; color: #64748b;
    background: rgba(15, 23, 42, 0.5);
}
.empty-icon .icon { width: 38px; height: 38px; }
.empty-state h2 { margin: 0; font-size: 1.15rem; }
.empty-state p { margin: 8px 0 0; color: #64748b; font-size: 0.85rem; }

.modal-backdrop {
    position: fixed; inset: 0; z-index: 20;
    display: flex; justify-content: center;
    overflow-y: auto;
    padding: 40px 16px;
    opacity: 0; visibility: hidden;
    background: rgba(0, 0, 0, 0.62);
    transition: opacity 0.2s, visibility 0.2s;
}
.modal-backdrop.is-open { opacity: 1; visibility: visible; }

.modal {
    width: min(100%, 700px);
    margin: auto;
    border-radius: var(--radius-xl);
    transform: translateY(15px) scale(0.97);
    transition: transform 0.2s;
}
.modal-backdrop.is-open .modal { transform: translateY(0) scale(1); }

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 22px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2, .delete-modal h2 { margin: 0; color: #c4b5fd; font-size: 1.35rem; }

.icon-button { border: 0; background: rgba(255, 255, 255, 0.06); }

.account-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 22px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.form-field.full-width { grid-column: 1 / -1; }

.form-field label { color: #cbd5e1; font-size: 0.8rem; font-weight: 500; }

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%; padding: 11px 13px;
    border: 1px solid rgba(139, 92, 246, 0.28);
    border-radius: 11px; outline: 0;
    background: rgba(15, 23, 42, 0.7);
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-field textarea { resize: vertical; }
.field-hint { color: #94a3b8; font-size: 0.72rem; line-height: 1.5; }
.form-field select option { color: #fff; background: #111827; }

.password-input { position: relative; }
.password-input input { padding-left: 44px; }

.password-toggle {
    position: absolute; top: 50%; left: 12px;
    display: grid; place-items: center;
    padding: 0; color: #64748b; background: none;
    transform: translateY(-50%);
}
.password-toggle:hover { color: var(--primary); }

.modal-actions { grid-column: 1 / -1; gap: 10px; margin-top: 6px; }
.modal-actions .button { flex: 1; }

.delete-modal { padding: 28px; text-align: center; }
.delete-icon {
    width: 76px; height: 76px; margin: 0 auto 15px;
    display: grid; place-items: center;
    border-radius: 50%; color: #fb7185;
    background: rgba(244, 63, 94, 0.16);
}
.delete-icon .icon { width: 32px; height: 32px; }
.delete-modal p { margin: 10px 0 24px; color: #94a3b8; line-height: 1.9; font-size: 0.85rem; }

.loading-overlay {
    position: fixed; inset: 0; z-index: 30;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    background: rgba(15, 23, 42, 0.92);
    transition: opacity 0.25s, visibility 0.25s;
}
.loading-overlay.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loading-overlay h2 { margin: 18px 0 4px; color: #c4b5fd; font-size: 1.25rem; }
.loading-overlay p { margin: 0; color: #94a3b8; font-size: 0.8rem; }

.loader {
    width: 58px; height: 58px;
    border: 4px solid rgba(139, 92, 246, 0.25);
    border-top-color: #8b5cf6;
    border-right-color: #d946ef;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

.toast-container {
    position: fixed; top: 18px; left: 18px; z-index: 50;
    display: flex; flex-direction: column; gap: 9px;
}

.toast {
    min-width: 280px;
    max-width: min(380px, calc(100vw - 36px));
    padding: 13px 15px;
    display: flex; align-items: center; gap: 9px;
    border: 1px solid var(--border);
    border-radius: 12px; color: #fff;
    background: rgba(15, 23, 42, 0.92);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
    animation: toast-in 0.25s ease both;
}
.toast.success { color: #6ee7b7; }
.toast.error { color: #fda4af; }
.toast-message { color: #e2e8f0; font-size: 0.8rem; }

/* =========================================================
   رادیو کارت‌های انتخاب بانک — بهینه و بدون هنگ
   ========================================================= */
.radio-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.radio-card {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.radio-card input {
    position: absolute; inset: 0;
    opacity: 0; width: 100%; height: 100%;
    margin: 0; cursor: pointer; z-index: 2;
}

.radio-bg {
    position: absolute; inset: 0;
    border-radius: 14px;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: 0;
}

.radio-card[data-bank="resalat"] .radio-bg {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(16, 185, 129, 0.06));
    box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.35), 0 10px 32px rgba(16, 185, 129, 0.12);
}

.radio-card[data-bank="redbank"] .radio-bg {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(245, 158, 11, 0.06));
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.35), 0 10px 32px rgba(245, 158, 11, 0.12);
}

.radio-inner {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.5);
    transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease;
    will-change: transform;
    z-index: 1;
}

.radio-card:hover .radio-inner {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}
.radio-card:active .radio-inner { transform: translateY(0) scale(0.97); }

.radio-icon-wrap {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 10px;
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.radio-card[data-bank="resalat"] .radio-icon-wrap { color: #34d399; background: rgba(16, 185, 129, 0.14); }
.radio-card[data-bank="redbank"] .radio-icon-wrap { color: #fbbf24; background: rgba(245, 158, 11, 0.14); }

.radio-card input:checked ~ .radio-inner .radio-icon-wrap { transform: scale(1.12); }
.radio-icon-wrap .icon { width: 20px; height: 20px; }

.radio-title {
    flex: 1;
    font-size: 0.9rem; font-weight: 600; color: #cbd5e1;
    transition: color 0.15s ease;
}
.radio-card:hover .radio-title { color: #f8fafc; }

.radio-check {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.12);
    display: grid; place-items: center;
    flex-shrink: 0;
    transition: border-color 0.2s ease, background 0.2s ease;
}
.radio-check::after {
    content: '';
    width: 8px; height: 8px;
    border-radius: 50%; background: #fff;
    transform: scale(0);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.radio-card input:checked ~ .radio-bg { opacity: 1; }
.radio-card input:checked ~ .radio-inner { background: transparent; border-color: transparent; }

.radio-card[data-bank="resalat"] input:checked ~ .radio-inner .radio-check {
    border-color: rgba(52, 211, 153, 0.6);
    background: rgba(16, 185, 129, 0.15);
}
.radio-card[data-bank="redbank"] input:checked ~ .radio-inner .radio-check {
    border-color: rgba(251, 191, 36, 0.6);
    background: rgba(245, 158, 11, 0.15);
}
.radio-card input:checked ~ .radio-inner .radio-check::after { transform: scale(1); }
.radio-card[data-bank="resalat"] input:checked ~ .radio-inner .radio-title { color: #34d399; }
.radio-card[data-bank="redbank"] input:checked ~ .radio-inner .radio-title { color: #fbbf24; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(22px, -24px, 0) scale(1.06); }
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(-18px); }
    to { opacity: 1; transform: translateX(0); }
}

@media (max-width: 980px) {
    .accounts-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .header-main { align-items: stretch; flex-direction: column; }
    .header-actions { width: 100%; }
}

@media (max-width: 620px) {
    .page-container { width: min(100% - 20px, 560px); padding-top: 14px; }
    .header-panel { padding: 18px; }
    .header-actions { align-items: stretch; flex-direction: column; }
    .header-actions .button { width: 100%; }
    .accounts-grid, .stats-grid, .account-form { grid-template-columns: 1fr; }
    .form-field.full-width { grid-column: auto; }
    .brand h1 { font-size: 1.35rem; }
    .toast-container { right: 10px; left: 10px; }
    .toast { min-width: 0; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
