/* Sweep Button Style (Desktop) */
.wallets-table .btn-sweep {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  padding: 0.55rem 1.2rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s;
  box-shadow: 0 2px 8px rgba(37,99,235,0.08);
  margin: 0 0.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}
.wallets-table .btn-sweep:disabled {
  background: #64748b;
  color: #cbd5e1;
  cursor: not-allowed;
  opacity: 0.7;
}
.wallets-table .btn-sweep:hover:not(:disabled) {
  background: #3b82f6;
  transform: translateY(-1px);
}
/* Ensure sweep confirmation modal is always above other modals */
#sweepWalletModal {
  z-index: 13000 !important;
}

/* Toast always above all modals */
.toast {
  z-index: 14000 !important;
}
/* Remove background from blockchain fetch icon button */
.btn-check-blockchain {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  color: inherit;
  padding: 0.2em 0.4em;
  font-size: 1.1em;
  cursor: pointer;
  transition: color 0.18s;
}
.btn-check-blockchain:focus {
  outline: 2px solid #2563eb;
}
/* Key Password Modal always above wallet detail modal */
.key-password-modal {
  z-index: 12000 !important;
}
.key-password-modal .modal-content {
  box-shadow: 0 24px 60px -10px rgba(0,0,0,0.7);
  border: 2px solid #2563eb;
}
@media (max-width: 640px) {
  .key-password-modal .modal-content {
    margin-top: 2.5rem !important;
    margin-bottom: 0.5rem;
    border-radius: 14px;
  }
}
/* ===== Wallet Detail Modal – Restyled 2025 ===== */
.wallet-detail-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);     /* slightly darker overlay */
  backdrop-filter: blur(4px);            /* nice touch when supported */
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.wallet-detail-modal.show,
.wallet-detail-modal.active {
  display: flex;
}

.wallet-detail-modal-content {
  background: #0f172a;                    /* slate-900 */
  color: #e2e8f0;
  border-radius: 16px;
  border: 1px solid #334155;
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 820px;
  max-height: 94vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wallet-detail-modal-large {
  max-width: 960px;
}

/* ── Header ─────────────────────────────────────── */
.wallet-detail-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #334155;
  flex-shrink: 0;
}

.wallet-detail-modal-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
}

.wallet-detail-modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  transition: all 0.2s;
}

.wallet-detail-modal-close:hover {
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

/* ── Body ───────────────────────────────────────── */
.wallet-detail-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ── Sections & Grid ────────────────────────────── */
.wallet-detail-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.wallet-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.wallet-detail-item {
  background: var(--card-bg, #23262f);
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: all 0.22s ease;
  word-break: break-all;
  color: var(--text-color, #e2e8f0);
}

.wallet-detail-item:hover {
  border-color: var(--primary, #85d6ff);
  box-shadow: 0 10px 30px -8px var(--shadow, rgba(0,0,0,0.18));
  transform: translateY(-2px);
}

.wallet-detail-item label {
  color: var(--text-secondary, #b0b0b0);
  font-size: 0.93em;
  font-weight: 500;
}

.wallet-detail-item span,
.wallet-detail-item code {
  font-size: 1em;
  color: var(--text-color, #e2e8f0);
}

.wallet-detail-full-width {
  grid-column: 1 / -1;
}

/* ── Actions ────────────────────────────────────── */
.wallet-detail-form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid #334155;
  flex-shrink: 0;
  background: #0f172a;
}

/* Buttons */
.wallet-detail-btn-secondary {
  background: #15803d;                    /* green-700 */
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  padding: 0.75rem 1.4rem;
  cursor: pointer;
  transition: all 0.2s;
}

.wallet-detail-btn-secondary:hover {
  background: #16a34a;                    /* green-600 */
  transform: translateY(-1px);
}

/* View/Hide Private Key area */
.wallet-detail-key-hidden-box,
.wallet-detail-key-visible-box {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
}

.wallet-detail-lock-icon {
  font-size: 2.6rem;
  margin-bottom: 0.8rem;
  color: #64748b;
}

.wallet-detail-lock-text {
  color: #94a3b8;
  margin-bottom: 1.2rem;
}

.wallet-detail-btn-view-key,
.wallet-detail-btn-hide-key {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  padding: 0.75rem 1.4rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  transition: all 0.2s;
}

.wallet-detail-btn-view-key:hover,
.wallet-detail-btn-hide-key:hover {
  background: #3b82f6;
  transform: translateY(-1px);
}

/* Wallet Stats Card Grid - Restyled */
.wallet-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--card-bg, #23262f);
  border-radius: 14px;
  box-shadow: 0 2px 12px var(--shadow, rgba(0,0,0,0.10));
  border: 1.5px solid #334155;
  padding: 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: box-shadow 0.18s, transform 0.18s;
}
.stat-card h3 {
  color: var(--primary, #85d6ff);
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.stat-number {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-blue, #007aff);
  margin: 0;
  letter-spacing: 0.01em;
}
.stat-card:hover {
  box-shadow: 0 8px 32px var(--shadow, rgba(56,189,248,0.10));
  transform: translateY(-2px);
}

/* Wallets Table Modern Style - Restyled */
.table-container {
  background: var(--card-bg, #23262f);
  border-radius: 14px;
  box-shadow: 0 2px 12px var(--shadow, rgba(0,0,0,0.10));
  border: 1.5px solid #334155;
  overflow-x: auto;
  margin: 1.5rem 0;
}
.wallets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
  color: var(--text-color, #e2e8f0);
}
.wallets-table thead {
  background: #334155;
}
.wallets-table th, .wallets-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid #334155;
}
.wallets-table th {
  color: var(--primary, #85d6ff);
  font-weight: 700;
  font-size: 0.99rem;
  letter-spacing: 0.01em;
}
.wallets-table tbody tr:hover {
  background: rgba(0, 69, 109, 0.08);
}
.wallets-table td {
  font-size: 0.97rem;
  color: var(--text-color, #e2e8f0);
}
.wallets-table td code {
  background: var(--card-bg, #23262f);
  color: var(--accent-blue, #007aff);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-size: 0.97em;
}
@media (max-width: 640px) {
  .wallet-detail-modal {
    padding: 0.5rem;
  }

  .wallet-detail-modal-content {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
  }

  .wallet-detail-modal-body {
    padding: 1rem;
    gap: 1.5rem;
  }

  .wallet-detail-header {
    padding: 1rem 1.25rem;
  }

  .wallet-detail-form-actions {
    padding: 1rem 1.25rem;
  }

  /* Try 2 columns on small phones in landscape or bigger small screens */
  .wallet-detail-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
  }

  /* Force 1 column below ~420px (very small phones) */
  @media (max-width: 420px) {
    .wallet-detail-grid {
      grid-template-columns: 1fr;
    }
  }

  .wallet-detail-item {
    padding: 1rem;
  }

  .wallet-stats {
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
  }
  .stat-card {
    padding: 0.8rem 0.5rem;
  }
  .stat-card h3 {
    font-size: 0.93rem;
  }
  .stat-number {
    font-size: 1.05rem;
  }
  .table-container {
    border-radius: 0;
    margin: 0.7rem 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .wallets-table {
    min-width: 600px;
    font-size: 0.95rem;
    table-layout: auto;
    white-space: nowrap;
  }
  .wallets-table th, .wallets-table td {
    padding: 0.6rem 0.4rem;
    font-size: 0.95rem;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 140px;
  }
  .wallets-table th {
    font-size: 1.02rem;
    font-weight: 700;
    background: #334155;
    color: var(--primary, #85d6ff);
    letter-spacing: 0.01em;
    text-align: left;
  }
  .wallets-table td code {
    font-size: 0.95em;
  }
  .wallets-table td {
    vertical-align: middle;
  }
  .wallet-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
  }
  .wallet-actions button {
    min-width: 70px;
    font-size: 0.93rem;
    padding: 0.45rem 0.7rem;
    border-radius: 8px;
    border: none;
    background: #2563eb;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, transform 0.18s;
    box-shadow: 0 2px 8px rgba(37,99,235,0.08);
  }
  .wallet-actions button:disabled {
    background: #64748b;
    color: #cbd5e1;
    cursor: not-allowed;
    opacity: 0.7;
  }
  .wallet-actions button:hover:not(:disabled) {
    background: #3b82f6;
    transform: translateY(-1px);
  }
  #checkSelectedWalletsBtn {
    min-width: 32px !important;
    height: 32px !important;
    font-size: 1.1rem !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 8px rgba(37,99,235,0.08);
    padding: 0 !important;
    margin-right: 0.5rem;
    margin-top: 0.2rem;
    background: #2563eb !important;
    color: #fff !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #checkSelectedWalletsBtn i {
    font-size: 1.2rem !important;
  }
  #checkSelectedWalletsBtn {
    width: 100% !important;
    min-width: 0 !important;
    height: 40px !important;
    font-size: 1.15rem !important;
    border-radius: 10px !important;
    box-shadow: 0 2px 8px rgba(37,99,235,0.08);
    padding: 0 !important;
    margin: 0.5rem 0 0.7rem 0;
    background: #2563eb !important;
    color: #fff !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  #checkSelectedWalletsBtn i {
    font-size: 1.3rem !important;
  }
}

@media (max-width: 640px) {
  .toast {
    top: calc(env(safe-area-inset-top, 0px) + 4.5rem);
    width: calc(100% - 1.2rem);
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    z-index: 9999;
  }
  #checkSelectedWalletsBtn {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    font-size: 1.25rem !important;
    border-radius: 10px !important;
    margin: 0 0 0 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    float: none;
  }
  #wallet-btn-wrapper {
    width: 100%;
    display: flex;
    justify-content: flex-end !important;
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
  }
}