/**
 * AccountAddModal Component Styles
 * Unified modal for adding accounts (Pro and Agency)
 */

/* ═══════════════════════════════════════════════════════════════
   MODAL OVERLAY
   ═══════════════════════════════════════════════════════════════ */

.account-add-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.account-add-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* ═══════════════════════════════════════════════════════════════
   MODAL CONTAINER
   ═══════════════════════════════════════════════════════════════ */

.account-add-modal {
  background: white;
  border-radius: 16px;
  width: 90%;
  max-width: 550px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.2s ease;
}

.account-add-overlay.show .account-add-modal {
  transform: scale(1) translateY(0);
}

/* ═══════════════════════════════════════════════════════════════
   MODAL HEADER
   ═══════════════════════════════════════════════════════════════ */

.account-add-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
}

.account-add-header h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1e293b;
}

.account-add-header-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-add-header-icon svg {
  width: 18px;
  height: 18px;
  stroke: white;
}

.account-add-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.account-add-close:hover {
  background: #e2e8f0;
}

.account-add-close svg {
  width: 18px;
  height: 18px;
  stroke: #64748b;
}

/* ═══════════════════════════════════════════════════════════════
   MODAL BODY
   ═══════════════════════════════════════════════════════════════ */

.account-add-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 80px);
}

/* ═══════════════════════════════════════════════════════════════
   ERROR ALERT
   ═══════════════════════════════════════════════════════════════ */

.account-add-error {
  display: none;
  padding: 12px 16px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  color: #dc2626;
  font-size: 14px;
  margin-bottom: 16px;
}

.account-add-error.show {
  display: block;
}

/* ═══════════════════════════════════════════════════════════════
   STEPS (hidden by default, shown when active)
   ═══════════════════════════════════════════════════════════════ */

.account-add-step {
  display: none;
}

.account-add-step.active {
  display: block;
}

/* ═══════════════════════════════════════════════════════════════
   METHOD OPTIONS (Extension, Manual, Phone)
   ═══════════════════════════════════════════════════════════════ */

.account-add-method {
  padding: 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 16px;
}

.account-add-method:hover {
  border-color: #c7d2fe;
  background: #fafafa;
}

.account-add-method.disabled {
  opacity: 0.5;
  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: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.account-add-method-icon.extension {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
}

.account-add-method-icon.extension svg {
  stroke: white;
}

.account-add-method-icon.manual {
  background: #f1f5f9;
  color: #64748b;
}

.account-add-method-icon.manual svg {
  stroke: #64748b;
}

.account-add-method-icon.phone {
  background: linear-gradient(135deg, #0088cc 0%, #0077b5 100%);
  color: white;
}

.account-add-method-icon.phone svg {
  stroke: white;
}

.account-add-method-icon.ton {
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: white;
}

.account-add-method-icon.ton svg {
  stroke: white;
}

.account-add-method-icon svg {
  width: 24px;
  height: 24px;
}

.account-add-method-content {
  flex: 1;
}

.account-add-method-title {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

.account-add-method-desc {
  margin: 0;
  font-size: 13px;
  color: #64748b;
}

.account-add-method-arrow {
  flex-shrink: 0;
}

.account-add-method-arrow svg {
  width: 20px;
  height: 20px;
  stroke: #94a3b8;
}

/* ═══════════════════════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════════════════════ */

.account-add-form-group {
  margin-bottom: 16px;
}

.account-add-form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  margin-bottom: 8px;
}

.account-add-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.account-add-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.account-add-hint {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-top: 6px;
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════════════════ */

.account-add-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

.account-add-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.account-add-btn:disabled {
  opacity: 0.6;
  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: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
}

.account-add-btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.account-add-btn svg {
  width: 16px;
  height: 16px;
}

.account-add-btn-primary svg {
  stroke: white;
}

.account-add-btn-secondary svg {
  stroke: #475569;
}

/* ═══════════════════════════════════════════════════════════════
   CABINET LIST
   ═══════════════════════════════════════════════════════════════ */

.account-add-cabinets {
  max-height: 300px;
  overflow-y: auto;
}

.account-add-cabinet {
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-add-cabinet:hover {
  border-color: #6366f1;
  background: #f8fafc;
}

.account-add-cabinet.loading {
  pointer-events: none;
  opacity: 0.7;
}

.account-add-cabinet-avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  font-weight: 600;
  font-size: 14px;
  flex-shrink: 0;
}

.account-add-cabinet-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
}

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

.account-add-cabinet-name {
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-add-cabinet-meta {
  font-size: 12px;
  color: #64748b;
}

.account-add-cabinet-arrow svg {
  width: 20px;
  height: 20px;
  stroke: #6366f1;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   EXTENSION STATES
   ═══════════════════════════════════════════════════════════════ */

.account-add-extension-state {
  text-align: center;
  padding: 20px 0;
}

.account-add-extension-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-add-extension-icon.install {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.account-add-extension-icon.warning {
  background: #fef3c7;
}

.account-add-extension-icon.success {
  background: #dcfce7;
}

.account-add-extension-icon svg {
  width: 32px;
  height: 32px;
}

.account-add-extension-icon.install svg {
  stroke: white;
}

.account-add-extension-icon.warning svg {
  stroke: #f59e0b;
}

.account-add-extension-icon.success svg {
  stroke: #22c55e;
}

/* Extension checking spinner */
.account-add-extension-checking-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  animation: account-add-spin 1s linear infinite;
}

.account-add-extension-checking-spinner svg {
  width: 48px;
  height: 48px;
  stroke: #6366f1;
}

.account-add-extension-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
}

.account-add-extension-desc {
  margin: 0 0 20px;
  color: #64748b;
  font-size: 14px;
}

.account-add-extension-hint {
  margin-top: 20px;
  padding: 12px;
  background: #fef3c7;
  border-radius: 8px;
  font-size: 13px;
  color: #92400e;
}

.account-add-extension-connected {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.account-add-extension-connected-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
}

.account-add-extension-connected-text {
  color: #166534;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   PHONE AUTH STATES
   ═══════════════════════════════════════════════════════════════ */

.account-add-phone-waiting {
  text-align: center;
  padding: 20px 0;
}

.account-add-phone-spinner {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  animation: account-add-spin 2s linear infinite;
}

.account-add-phone-spinner svg {
  width: 64px;
  height: 64px;
  stroke: #6366f1;
}

.account-add-phone-status {
  padding: 12px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #0369a1;
}

.account-add-phone-status svg {
  width: 18px;
  height: 18px;
  stroke: #0369a1;
  flex-shrink: 0;
}

/* Phone auth header icon */
.account-add-phone-header-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #0088cc 0%, #0077b5 100%);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.account-add-phone-header-icon svg {
  width: 28px;
  height: 28px;
  stroke: white;
}

/* ═══════════════════════════════════════════════════════════════
   SUCCESS STATE
   ═══════════════════════════════════════════════════════════════ */

.account-add-success {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  color: #166534;
  font-size: 14px;
  margin-bottom: 16px;
}

.account-add-success svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: #166534;
}

/* ═══════════════════════════════════════════════════════════════
   HELP BOX
   ═══════════════════════════════════════════════════════════════ */

.account-add-help {
  margin-top: 24px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.account-add-help h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.account-add-help ol {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: #64748b;
  line-height: 1.8;
}

.account-add-help code {
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* ═══════════════════════════════════════════════════════════════
   LOADING SPINNER
   ═══════════════════════════════════════════════════════════════ */

@keyframes account-add-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.account-add-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: account-add-spin 0.8s linear infinite;
}

.account-add-spinner.dark {
  border-color: rgba(0, 0, 0, 0.1);
  border-top-color: #6366f1;
}

/* ═══════════════════════════════════════════════════════════════
   SEARCH INPUT
   ═══════════════════════════════════════════════════════════════ */

.account-add-search {
  margin-bottom: 12px;
}

.account-add-search input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}

.account-add-search input:focus {
  outline: none;
  border-color: #6366f1;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   PRO REQUIRED STEP (for TON cabinets)
   ═══════════════════════════════════════════════════════════════ */

.account-add-pro-required {
  text-align: center;
  padding: 24px 16px;
}

.account-add-pro-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.account-add-pro-icon svg {
  width: 48px;
  height: 48px;
}

.account-add-pro-title {
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 12px;
}

.account-add-pro-desc {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 24px;
  line-height: 1.5;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.account-add-btn-upgrade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.account-add-btn-upgrade:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.account-add-btn-ghost {
  background: transparent;
  color: #64748b;
  border: none;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s;
}

.account-add-btn-ghost:hover {
  color: #1e293b;
}

@media (max-width: 640px) {
  .account-add-modal {
    width: 95%;
    max-height: 95vh;
  }

  .account-add-body {
    padding: 16px;
  }

  .account-add-method {
    padding: 12px;
    gap: 12px;
  }

  .account-add-method-icon {
    width: 40px;
    height: 40px;
  }

  .account-add-method-icon svg {
    width: 20px;
    height: 20px;
  }

  .account-add-actions {
    flex-direction: column-reverse;
  }

  .account-add-btn {
    width: 100%;
  }

  .account-add-pro-icon {
    width: 64px;
    height: 64px;
  }

  .account-add-pro-icon svg {
    width: 36px;
    height: 36px;
  }

  .account-add-pro-title {
    font-size: 18px;
  }
}
