/* ============================================
   SIM Wallet — Professional Modern Theme
   sim.boostigo.org
   ============================================ */

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

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

:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  --accent: #06b6d4;
  --accent-light: #22d3ee;
  --success: #10b981;
  --success-light: #34d399;
  --danger: #ef4444;
  --danger-light: #f87171;
  --warning: #f59e0b;

  --bg-body: #0f1117;
  --bg-surface: #1a1d2e;
  --bg-card: #1e2235;
  --bg-card-hover: #252a40;
  --bg-input: #161928;
  --bg-elevated: #262b42;

  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --text: #e8eaf0;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --text-bright: #ffffff;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px var(--primary-glow);

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

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-body);
  color: var(--text);
  line-height: 1.6;
  direction: rtl;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== Container ===== */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ===== Typography ===== */
h1, h2, h3 { font-weight: 700; color: var(--text-bright); }
a { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-light); }

/* ===== Topbar ===== */
.topbar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.topbar-left .logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.topbar h1 {
  font-size: 1.3rem;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.user-greeting {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9rem;
}

.user-greeting span {
  color: var(--text-bright);
  font-weight: 600;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--primary);
  color: #fff;
  width: auto;
}

.btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-block { width: 100%; }

.btn-primary { background: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }

.btn-success { background: var(--success); }
.btn-success:hover { background: #059669; box-shadow: 0 0 20px rgba(16, 185, 129, 0.3); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; box-shadow: 0 0 20px rgba(239, 68, 68, 0.3); }

.btn-ghost {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-card-hover); color: var(--text); box-shadow: none; }

.btn-sm {
  padding: 6px 12px;
  font-size: 0.82rem;
  border-radius: 6px;
}

/* ===== Inputs ===== */
input, select, textarea {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text);
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

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

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

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  transition: border-color var(--transition);
}

.card:hover { border-color: rgba(255, 255, 255, 0.12); }

.card h2 {
  margin-bottom: 16px;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-bright);
}

.card h2 .icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 1rem;
}

.card h2 .icon-blue { background: rgba(99, 102, 241, 0.15); color: var(--primary-light); }
.card h2 .icon-green { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.card h2 .icon-red { background: rgba(239, 68, 68, 0.15); color: var(--danger-light); }
.card h2 .icon-purple { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.card h2 .icon-cyan { background: rgba(6, 182, 212, 0.15); color: var(--accent); }

/* ===== Form groups ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.form-row > input,
.form-row > select {
  flex: 1;
  min-width: 140px;
}

/* ===== Messages ===== */
.msg {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  display: none;
  font-weight: 500;
}

.msg.success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success-light);
  border: 1px solid rgba(16, 185, 129, 0.25);
  display: block;
}

.msg.error {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger-light);
  border: 1px solid rgba(239, 68, 68, 0.25);
  display: block;
}

/* ===== Provider Cards ===== */
.provider-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.provider-card {
  flex: 1;
  min-width: 140px;
  padding: 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-elevated);
}

.provider-card:hover:not(.locked) {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.provider-card.active {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.08);
}

.provider-card.locked {
  border-color: var(--border);
  opacity: 0.4;
  cursor: not-allowed;
}

.provider-icon { font-size: 1.8rem; margin-bottom: 8px; }
.provider-name { font-weight: 700; font-size: 1rem; margin-bottom: 4px; color: var(--text-bright); }
.provider-status {
  font-size: 0.78rem;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  display: inline-block;
  font-weight: 600;
}

.provider-card.active .provider-status {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-light);
}

.provider-card.locked .provider-status {
  background: rgba(107, 114, 128, 0.15);
  color: var(--text-muted);
}

.provider-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ===== Alfa Tabs ===== */
.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-sm);
  max-width: 420px;
}

.auth-tab {
  flex: 1;
  padding: 9px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition);
  width: auto;
}

.auth-tab:hover { color: var(--text); background: transparent; }
.auth-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* ===== Signup Steps ===== */
.signup-steps {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.signup-steps .step {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.signup-steps .step.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
  border-color: rgba(99, 102, 241, 0.3);
}

/* ===== Account Items ===== */
.account-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px;
  margin-bottom: 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: border-color var(--transition);
}

.account-item:hover { border-color: rgba(255, 255, 255, 0.12); }

.account-info {
  flex: 1;
  min-width: 0;
}

.account-info strong {
  display: block;
  color: var(--text-bright);
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.account-info span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 2px;
}

.balance {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--success-light);
  white-space: nowrap;
  padding-right: 16px;
  text-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.token-badge {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-weight: 700;
  margin-top: 6px;
  display: inline-block;
}

.token-ok {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success-light);
}

.token-missing {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger-light);
}

.acct-actions {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.acct-actions .btn {
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: 6px;
}

.acct-history {
  margin-top: 10px;
  padding: 10px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ===== Transaction items ===== */
.transaction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.transaction-item:last-child { border-bottom: none; }

.tx-type {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.tx-topup { background: rgba(16, 185, 129, 0.12); color: var(--success-light); }
.tx-payment { background: rgba(239, 68, 68, 0.12); color: var(--danger-light); }

.tx-date {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 32px;
  font-size: 0.9rem;
}

/* ===== Auth Page (Login/Register) ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 16px;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.12), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, 0.08), transparent 50%),
    var(--bg-body);
}

.auth-wrap {
  width: 100%;
  max-width: 920px;
}

.auth-head {
  text-align: center;
  margin-bottom: 28px;
}

.auth-head .logo-large {
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.3));
}

.auth-head h1 {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.auth-head p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.auth-columns {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.auth-panel {
  flex: 1 1 0;
  padding: 30px 28px;
  min-width: 0;
  transition: all var(--transition);
}

.auth-panel.focused {
  background: rgba(99, 102, 241, 0.04);
}

.auth-panel h2 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.panel-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.panel-badge-in {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-light);
}

.panel-badge-up {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-light);
}

.panel-sub {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 18px;
}

.panel-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.panel-foot a {
  color: var(--primary-light);
  font-weight: 700;
}

.panel-foot a:hover { color: var(--accent-light); }

.auth-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 1px;
  background: var(--border);
  margin: 24px 0;
}

.auth-divider span {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
}

/* ===== Password field ===== */
.pw-wrap { position: relative; }
.pw-wrap input { padding-left: 46px; }

.pw-toggle {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
}

.pw-toggle:hover { background: var(--bg-elevated); color: var(--primary-light); }
.pw-toggle.active { color: var(--primary-light); }

/* ===== Password strength ===== */
.pw-strength { margin-top: 10px; }

.strength-bar {
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  overflow: hidden;
}

.strength-bar .fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--radius-full);
  transition: width 0.3s ease, background 0.3s ease;
}

.strength-bar .fill.weak { background: var(--danger); }
.strength-bar .fill.medium { background: var(--warning); }
.strength-bar .fill.strong { background: var(--success); }
.strength-bar .fill.very-strong { background: #059669; }

.strength-label {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.req-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.req-list li {
  position: relative;
  padding-right: 22px;
  margin-bottom: 3px;
  transition: color var(--transition);
}

.req-list li::before {
  content: '\25CB';
  position: absolute;
  right: 0;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.85rem;
}

.req-list li.ok { color: var(--success-light); }
.req-list li.ok::before { content: '\2713'; color: var(--success); }

.req-star { color: var(--danger); font-weight: 700; }
.optional { color: var(--text-muted); font-weight: 400; font-size: 0.82rem; }

.field-hint {
  margin-top: 5px;
  font-size: 0.8rem;
  color: var(--text-muted);
  min-height: 1em;
}
.field-hint.ok { color: var(--success-light); font-weight: 600; }
.field-hint.error { color: var(--danger-light); font-weight: 600; }

/* ===== Radio ===== */
.radio-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.radio-inline input[type="radio"] {
  width: auto;
  margin: 0;
  accent-color: var(--primary);
}

.pw-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -4px;
  margin-bottom: 12px;
}
.pw-hint.ok { color: var(--success-light); }
.pw-hint.bad { color: var(--danger-light); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

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

.modal h3 {
  margin-bottom: 6px;
  font-size: 1.15rem;
}

.modal-sub {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.modal-actions .btn { flex: 1; }

/* ===== Responsive ===== */
@media (max-width: 720px) {
  .auth-columns { flex-direction: column; }
  .auth-divider {
    width: auto;
    height: 1px;
    margin: 0 24px;
  }
  .auth-divider span { position: relative; }
  .auth-head h1 { font-size: 1.6rem; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 1.1rem; }
}

@media (max-width: 600px) {
  .form-row { flex-direction: column; }
  .container { padding: 16px 12px; }
  .account-item { flex-direction: column; gap: 12px; }
  .balance { padding-right: 0; }
  .auth-panel { padding: 22px 18px; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-body); }
::-webkit-scrollbar-thumb { background: var(--bg-elevated); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Selection ===== */
::selection { background: var(--primary); color: #fff; }
