/**
 * AccountAddModal — Modern compact design
 * Inspired by Linear, Vercel, Stripe
 */

/* ═══════════════════════════════════════════
   OVERLAY
   ═══════════════════════════════════════════ */

.account-add-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.account-add-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* ═══════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════ */

.account-add-modal {
  background: #fff;
  border-radius: 10px;
  width: 92%;
  max-width: 400px;
  max-height: 88vh;
  overflow: hidden;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.04),
    0 8px 40px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.06);
  transform: scale(0.97) translateY(6px);
  transition: transform 0.15s ease;
}

.account-add-overlay.show .account-add-modal {
  transform: scale(1) translateY(0);
}

/* ═══════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════ */

.account-add-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
}

.account-add-header h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.account-add-header-icon {
  width: 24px;
  height: 24px;
  background: #2563eb;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-add-header-icon svg {
  width: 13px;
  height: 13px;
  stroke: white;
}

.account-add-close {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
  color: #94a3b8;
}

.account-add-close:hover {
  background: #f1f5f9;
  color: #475569;
}

.account-add-close svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
}

/* ═══════════════════════════════════════════
   BODY
   ═══════════════════════════════════════════ */

.account-add-body {
  padding: 12px;
  overflow-y: auto;
  max-height: calc(88vh - 52px);
  -webkit-overflow-scrolling: touch;
}

/* ═══════════════════════════════════════════
   ERROR
   ═══════════════════════════════════════════ */

.account-add-error {
  display: none;
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-size: 12px;
  margin-bottom: 10px;
  line-height: 1.4;
}

.account-add-error.show {
  display: block;
}

/* ═══════════════════════════════════════════
   STEPS
   ═══════════════════════════════════════════ */

.account-add-step {
  display: none;
}

.account-add-step.active {
  display: block;
}

/* ═══════════════════════════════════════════
   METHOD CARDS
   ═══════════════════════════════════════════ */

.account-add-method {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 5px;
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-add-method:hover {
  border-color: #bfdbfe;
  background: #fafafe;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.06);
}

.account-add-method:active {
  transform: scale(0.99);
}

.account-add-method.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.account-add-method.disabled .account-add-method-icon {
  filter: grayscale(1);
}

.account-add-method.disabled .account-add-method-desc {
  color: #94a3b8;
  font-style: italic;
}

.account-add-method-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.account-add-method-icon.extension {
  background: #2563eb;
}

.account-add-method-icon.extension svg {
  stroke: white;
}

.account-add-method-icon.manual {
  background: #f1f5f9;
}

.account-add-method-icon.manual svg {
  stroke: #64748b;
}

.account-add-method-icon.phone {
  background: #0ea5e9;
}

.account-add-method-icon.phone svg {
  stroke: white;
}

.account-add-method-icon.ton {
  background: #3b82f6;
}

.account-add-method-icon.ton svg {
  stroke: white;
}

.account-add-method-icon svg {
  width: 16px;
  height: 16px;
}

.account-add-method-content {
  flex: 1;
  min-width: 0;
}

.account-add-method-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.account-add-method-desc {
  margin: 2px 0 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.4;
}

.account-add-method-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.account-add-method-arrow {
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.12s;
}

.account-add-method:hover .account-add-method-arrow {
  opacity: 0.7;
}

.account-add-method-arrow svg {
  width: 14px;
  height: 14px;
  stroke: #94a3b8;
}

/* ═══════════════════════════════════════════
   RECOMMENDED METHOD
   ═══════════════════════════════════════════ */

.account-add-method.recommended {
  border-color: #bfdbfe;
  background: linear-gradient(135deg, #f8fafc 0%, #f0f0ff 100%);
  position: relative;
}

.account-add-method.recommended:hover {
  border-color: #60a5fa;
  background: linear-gradient(135deg, #f5f5ff 0%, #ebebff 100%);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.account-add-method-badge {
  position: absolute;
  top: -8px;
  right: 12px;
  background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.4;
}

.account-add-methods-subtitle {
  margin: 0 0 10px;
  color: #64748b;
  font-size: 13px;
}

/* Section divider — separates "connect existing" methods from "open new cabinet" cards. */
.account-add-method-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}
.account-add-method-divider::before,
.account-add-method-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e2e8f0 30%, #e2e8f0 70%, transparent);
}

/* ═══════════════════════════════════════════
   METHOD CARD META (time estimates)
   ═══════════════════════════════════════════ */

.account-add-method-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.account-add-method-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

.account-add-method-time svg {
  width: 12px;
  height: 12px;
  stroke: #94a3b8;
}

/* ═══════════════════════════════════════════
   METHOD CARD TAGS (non-recommended badges)
   ═══════════════════════════════════════════ */

.account-add-method-tag {
  position: absolute;
  top: -8px;
  right: 12px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.4;
}

.account-add-method-tag.muted-tag {
  background: #f1f5f9;
  color: #64748b;
}

.account-add-method-tag.ton-tag {
  background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
  color: white;
}

/* ═══════════════════════════════════════════
   MUTED METHOD (manual token)
   ═══════════════════════════════════════════ */

.account-add-method.muted {
  position: relative;
  opacity: 0.75;
  border-color: #f1f5f9;
}

.account-add-method.muted:hover {
  opacity: 1;
  border-color: #e2e8f0;
  background: #fafafa;
}

.account-add-method.muted .account-add-method-title {
  color: #475569;
}

/* ═══════════════════════════════════════════
   ACCENT STRIPES (visual differentiation)
   ═══════════════════════════════════════════ */

.account-add-method[data-method="extension"] {
  position: relative;
  border-left: 3px solid #2563eb;
}

.account-add-method[data-method="ton"] {
  position: relative;
  border-left: 3px solid #3b82f6;
}

/* ═══════════════════════════════════════════
   MOBILE BANNER
   ═══════════════════════════════════════════ */

.account-add-mobile-banner {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 12px;
}

.account-add-mobile-banner-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-add-mobile-banner-icon svg {
  width: 18px;
  height: 18px;
  stroke: #94a3b8;
}

.account-add-mobile-banner-text p {
  margin: 0;
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
}

.account-add-mobile-banner-hint {
  margin-top: 4px !important;
  font-size: 11px !important;
  color: #94a3b8 !important;
}

/* ═══════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════ */

.account-add-form-group {
  margin-bottom: 14px;
}

.account-add-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  margin-bottom: 5px;
  letter-spacing: 0.01em;
}

.account-add-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  color: #0f172a;
  transition: border-color 0.12s, box-shadow 0.12s;
  box-sizing: border-box;
  background: #fff;
}

.account-add-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.account-add-input::placeholder {
  color: #cbd5e1;
}

.account-add-hint {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 4px;
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */

.account-add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.account-add-btn {
  padding: 7px 14px;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.12s;
  letter-spacing: -0.005em;
}

.account-add-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.account-add-btn-secondary {
  background: #f1f5f9;
  color: #475569;
}

.account-add-btn-secondary:hover:not(:disabled) {
  background: #e2e8f0;
}

.account-add-btn-primary {
  background: #2563eb;
  color: white;
}

.account-add-btn-primary:hover:not(:disabled) {
  background: #1d4ed8;
}

.account-add-btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.account-add-btn svg {
  width: 14px;
  height: 14px;
}

.account-add-btn-primary svg {
  stroke: white;
}

.account-add-btn-secondary svg {
  stroke: #475569;
}

/* ═══════════════════════════════════════════
   CABINET LIST
   ═══════════════════════════════════════════ */

.account-add-cabinets {
  max-height: 260px;
  overflow-y: auto;
}

.account-add-cabinet {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.12s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-add-cabinet:hover {
  border-color: #bfdbfe;
  background: #fafafe;
}

.account-add-cabinet:active {
  transform: scale(0.99);
}

.account-add-cabinet.loading {
  pointer-events: none;
  opacity: 0.6;
}

.account-add-cabinet-avatar {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2563eb;
  color: white;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}

.account-add-cabinet-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 7px;
  object-fit: cover;
}

.account-add-cabinet-info {
  flex: 1;
  min-width: 0;
}

.account-add-cabinet-name {
  font-weight: 500;
  font-size: 13px;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-add-cabinet-meta {
  font-size: 11px;
  color: #94a3b8;
}

.account-add-cabinet-arrow svg {
  width: 14px;
  height: 14px;
  stroke: #bfdbfe;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   EXTENSION STATES
   ═══════════════════════════════════════════ */

.account-add-extension-state {
  text-align: center;
  padding: 16px 0;
}

.account-add-extension-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 10px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-add-extension-icon.install {
  background: #2563eb;
}

.account-add-extension-icon.warning {
  background: #fef3c7;
}

.account-add-extension-icon.success {
  background: #dcfce7;
}

.account-add-extension-icon svg {
  width: 20px;
  height: 20px;
}

.account-add-extension-icon.install svg {
  stroke: white;
}

.account-add-extension-icon.warning svg {
  stroke: #d97706;
}

.account-add-extension-icon.success svg {
  stroke: #16a34a;
}

.account-add-extension-checking-spinner {
  width: 32px;
  height: 32px;
  margin: 0 auto 12px;
  animation: account-add-spin 1s linear infinite;
}

.account-add-extension-checking-spinner svg {
  width: 32px;
  height: 32px;
  stroke: #2563eb;
}

.account-add-extension-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
}

.account-add-extension-desc {
  margin: 0 0 14px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.4;
}

.account-add-extension-hint {
  margin-top: 14px;
  padding: 8px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 7px;
  font-size: 12px;
  color: #92400e;
  line-height: 1.4;
}

.account-add-extension-connected {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.account-add-extension-connected-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
}

.account-add-extension-connected-text {
  color: #166534;
  font-weight: 500;
  font-size: 12px;
}

/* ═══════════════════════════════════════════
   PHONE AUTH
   ═══════════════════════════════════════════ */

.account-add-phone-waiting {
  text-align: center;
  padding: 12px 0;
}

.account-add-phone-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 10px;
  animation: account-add-spin 1.5s linear infinite;
}

.account-add-phone-spinner svg {
  width: 28px;
  height: 28px;
  stroke: #2563eb;
}

.account-add-phone-status {
  padding: 8px 12px;
  background: #f0f9ff;
  border: 1px solid #e0f2fe;
  border-radius: 7px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #0369a1;
  font-size: 12px;
}

.account-add-phone-status svg {
  width: 14px;
  height: 14px;
  stroke: #0369a1;
  flex-shrink: 0;
}

.account-add-phone-header-icon {
  width: 34px;
  height: 34px;
  background: #0ea5e9;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
}

.account-add-phone-header-icon svg {
  width: 18px;
  height: 18px;
  stroke: white;
}

.account-add-phone-notice {
  font-size: 11px;
  color: #78716c;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 7px;
  padding: 8px 10px;
  margin-top: 10px;
  line-height: 1.5;
}

.account-add-phone-notice strong {
  color: #92400e;
}

/* ═══════════════════════════════════════════
   SUCCESS STATE
   ═══════════════════════════════════════════ */

.account-add-success {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 7px;
  color: #166534;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 12px;
}

.account-add-success svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  stroke: #16a34a;
}

/* ═══════════════════════════════════════════
   HELP BOX
   ═══════════════════════════════════════════ */

.account-add-help {
  margin-top: 16px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid #f1f5f9;
}

.account-add-help h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}

.account-add-help ol {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.7;
}

.account-add-help code {
  background: #e2e8f0;
  padding: 1px 4px;
  border-radius: 3px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
}

/* ═══════════════════════════════════════════
   SPINNER
   ═══════════════════════════════════════════ */

@keyframes account-add-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.account-add-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: account-add-spin 0.6s linear infinite;
}

.account-add-spinner.dark {
  border-color: rgba(0, 0, 0, 0.08);
  border-top-color: #2563eb;
}

/* ═══════════════════════════════════════════
   SEARCH
   ═══════════════════════════════════════════ */

.account-add-search {
  margin-bottom: 8px;
}

.account-add-search input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
  color: #0f172a;
}

.account-add-search input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.account-add-search input::placeholder {
  color: #cbd5e1;
}

/* ═══════════════════════════════════════════
   PRO REQUIRED
   ═══════════════════════════════════════════ */

.account-add-pro-required {
  text-align: center;
  padding: 16px 8px;
}

.account-add-pro-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.08));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-add-pro-icon svg {
  width: 20px;
  height: 20px;
}

.account-add-pro-title {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.account-add-pro-desc {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 14px;
  line-height: 1.5;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.account-add-btn-upgrade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.12s;
}

.account-add-btn-upgrade:hover {
  background: #1d4ed8;
}

.account-add-btn-upgrade svg {
  stroke: white;
}

.account-add-btn-ghost {
  background: transparent;
  color: #64748b;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.12s;
}

.account-add-btn-ghost:hover {
  color: #0f172a;
}

/* ═══════════════════════════════════════════
   RECOMMENDATION HINT
   ═══════════════════════════════════════════ */

.account-add-recommendation {
  font-size: 12px;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 8px 10px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.account-add-recommendation strong {
  color: #2563eb;
  font-weight: 600;
}

/* ═══════════════════════════════════════════
   SECURITY BADGE
   ═══════════════════════════════════════════ */

.account-add-security {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #fafffe;
  border-top: 1px solid #f1f5f9;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 12px;
}

.account-add-security svg {
  color: #22c55e;
  stroke: #22c55e;
  flex-shrink: 0;
  width: 12px;
  height: 12px;
}

.account-add-security a {
  color: #2563eb;
  text-decoration: none;
  white-space: nowrap;
  margin-left: auto;
  font-weight: 500;
}

.account-add-security a:hover {
  text-decoration: underline;
}

/* ═══════════════════════════════════════════
   MOBILE (≤640px)
   ═══════════════════════════════════════════ */

@media (max-width: 640px) {
  .account-add-modal {
    width: 94%;
    max-height: 92vh;
    border-radius: 10px;
  }

  .account-add-body {
    max-height: calc(92vh - 48px);
  }

  .account-add-actions {
    flex-direction: column-reverse;
    gap: 6px;
  }

  .account-add-btn {
    width: 100%;
    padding: 9px 14px;
  }
}
