/* ============================================================================
   DAPA WALLET STYLES
   Following XELIS Genesix design patterns
   ============================================================================ */

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

:root {
  --primary: #667eea;
  --primary-dark: #5a67d8;
  --secondary: #764ba2;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --dark: #1a1a2e;
  --darker: #16213e;
  --light: #f7f7f7;
  --border: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: linear-gradient(135deg, var(--darker) 0%, var(--dark) 100%);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================================
   LOADING SCREEN
   ============================================================================ */

.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--darker) 0%, var(--dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.loading-content {
  text-align: center;
  max-width: 600px;
  padding: 20px;
}

.logo-large {
  font-size: 72px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
  letter-spacing: 2px;
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.2); }
}

.loading-subtitle {
  font-size: 20px;
  color: var(--text-secondary);
  margin-bottom: 60px;
  font-weight: 300;
  letter-spacing: 1px;
}

.precomputed-box {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 30px;
}

.precomputed-box h3 {
  font-size: 24px;
  margin-bottom: 10px;
  color: var(--primary);
}

.loading-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 30px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin: 20px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 0.3s ease;
  border-radius: 4px;
}

.progress-text {
  font-size: 32px;
  font-weight: bold;
  color: var(--primary);
  margin: 10px 0 20px;
}

.table-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin: 20px 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
}

.loading-message {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 15px 0;
}

.info-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 20px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

/* ============================================================================
   MAIN APP LAYOUT
   ============================================================================ */

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 30px;
}

.logo {
  font-size: 28px;
  font-weight: bold;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

.network-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 14px;
}

.network-badge.connected {
  border-color: var(--success);
}

.network-badge.disconnected {
  border-color: var(--danger);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.network-badge.connected .status-dot {
  background: var(--success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.content {
  flex: 1;
  padding: 20px 0;
}

.content.centered {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn-primary, .btn-secondary, .btn-back, .icon-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-large {
  width: 100%;
  padding: 16px 24px;
  font-size: 16px;
}

.btn-back {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
}

.btn-back:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  padding: 10px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.icon-btn.danger {
  color: var(--danger);
}

.icon-btn.danger:hover {
  background: rgba(239, 68, 68, 0.1);
}

.button-group {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ============================================================================
   WALLET LIST
   ============================================================================ */

.wallet-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.wallet-list-header h2 {
  font-size: 32px;
  font-weight: 600;
}

.wallet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.wallet-card {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.wallet-card:hover {
  border-color: var(--primary);
  background: rgba(102, 126, 234, 0.1);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.wallet-card.unlock-card {
  cursor: default;
}

.wallet-card.unlock-card:hover {
  transform: none;
}

.wallet-icon {
  font-size: 48px;
  margin-bottom: 15px;
  text-align: center;
}

.wallet-card h3 {
  font-size: 20px;
  margin-bottom: 10px;
  text-align: center;
}

.wallet-address {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 15px;
}

.wallet-meta {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.badge {
  background: rgba(255, 255, 255, 0.1);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.card-actions {
  position: absolute;
  top: 15px;
  right: 15px;
}

/* ============================================================================
   FORMS
   ============================================================================ */

.form-card {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  max-width: 500px;
  width: 100%;
}

.form-card h2 {
  font-size: 28px;
  margin-bottom: 10px;
}

.form-description {
  color: var(--text-secondary);
  margin-bottom: 30px;
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input, .form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s;
}

.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

.error-message {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
}

.address-display {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 12px;
  word-break: break-all;
  margin-bottom: 15px;
  border: 1px solid var(--border);
}

/* ============================================================================
   EMPTY STATE
   ============================================================================ */

.empty-state {
  text-align: center;
  padding: 80px 20px;
  max-width: 600px;
  margin: 0 auto;
}

.empty-icon {
  font-size: 80px;
  margin-bottom: 24px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.empty-state h3 {
  font-size: 28px;
  margin-bottom: 12px;
  font-weight: 600;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-size: 16px;
  line-height: 1.5;
}

.button-group {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.button-group button {
  min-width: 180px;
}

/* ============================================================================
   WALLET CREATION SUCCESS
   ============================================================================ */

.create-success {
  max-width: 600px;
  width: 100%;
  text-align: center;
}

.success-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.create-success h2 {
  font-size: 28px;
  margin-bottom: 30px;
}

.warning-box {
  background: rgba(245, 158, 11, 0.1);
  border: 2px solid var(--warning);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 30px;
  text-align: left;
}

.warning-box strong {
  color: var(--warning);
  display: block;
  margin-bottom: 10px;
  font-size: 16px;
}

.warning-box p {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}

.seed-display {
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 30px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  text-align: left;
}

.seed-word {
  background: rgba(255, 255, 255, 0.05);
  padding: 10px 12px;
  border-radius: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.word-number {
  color: var(--text-muted);
  font-size: 12px;
  min-width: 20px;
}

.word-text {
  color: var(--text-primary);
  font-weight: 500;
  font-family: monospace;
}

/* ============================================================================
   FOOTER
   ============================================================================ */

.footer-actions {
  padding: 20px 0;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 15px;
  justify-content: center;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
  .app-container {
    padding: 15px;
  }

  .logo-large {
    font-size: 48px;
  }

  .header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .wallet-grid {
    grid-template-columns: 1fr;
  }

  .form-card {
    padding: 30px 20px;
  }

  .seed-display {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .button-group {
    flex-direction: column;
  }

  .wallet-list-header {
    flex-direction: column;
    gap: 15px;
    align-items: stretch;
  }

  .table-stats {
    grid-template-columns: 1fr;
  }
}

/* ============================================================================
   SETTINGS
   ============================================================================ */

.settings-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.settings-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

.settings-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
}

.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.settings-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.settings-info {
  flex: 1;
}

.settings-info strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.settings-info p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.settings-url {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  word-break: break-all;
}

.settings-section.danger {
  border-color: #ff4444;
  background: rgba(255, 68, 68, 0.05);
}

.settings-warning {
  color: var(--text);
}

.settings-warning p {
  margin: 8px 0;
  line-height: 1.5;
}

.settings-warning strong {
  color: #ff4444;
}

.btn-small {
  padding: 8px 16px;
  font-size: 14px;
  white-space: nowrap;
}

.network-badge.mainnet {
  background: var(--primary);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}

.network-badge.testnet {
  background: #ff9500;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
}

/* ============================================================================
   BACK BUTTON IN MODALS
   ============================================================================ */

.form-card .btn-back,
.create-success .btn-back {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 0;
  margin-bottom: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s;
}

.form-card .btn-back:hover,
.create-success .btn-back:hover {
  color: var(--primary);
}

.create-success .btn-back {
  margin-bottom: 16px;
  align-self: flex-start;
}

.create-success {
  display: flex;
  flex-direction: column;
  align-items: center;
}
