/* keystore.css */
.keystore-header {
  padding-top: 18px;
  text-align: center;
}

.keystore-header h2 {
  margin: 0 0 8px 0;
  color: #f7931a;
  font-size: 1.6rem;
  font-weight: 700;
}

.keystore-header-nav {
  display: flex;
  justify-content: center;
  margin: 4px 0 14px 0;
}

.keystore-cellar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  background: rgba(197, 168, 128, 0.12);
  border: 1px solid rgba(197, 168, 128, 0.35);
  border-radius: 20px;
  color: #c5a880;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.keystore-cellar-link:hover {
  background: rgba(197, 168, 128, 0.25);
  border-color: #f7931a;
  color: #f7931a;
  transform: translateY(-1px);
}

.keystore-subtitle {
  color: #e0d0d5;
  font-size: 0.95rem;
  margin: 0 0 20px 0;
  text-align: center;
  line-height: 1.4;
}

/* Forzar hover correcto en botón primary */
.keystore-btn.primary:hover {
  background: #6B0F0F !important;
  color: #fff !important;
  border: 1.5px solid #6B0F0F !important;
}

.keystore-btn.btn-gold-action {
  background: #c5a880 !important;
  color: #11070e !important;
  font-weight: 700 !important;
  border: 1.5px solid #c5a880 !important;
}

.keystore-btn.btn-gold-action:hover {
  background: #d4bc99 !important;
  color: #11070e !important;
  border-color: #d4bc99 !important;
}

.modal-actions .keystore-btn {
  min-width: 120px;
  width: 120px;
  height: 44px;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-break: anywhere;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Subir la card para que quede bien posicionada */
.keystore-container {
  margin-top: 16px;
  height: auto;
  min-height: 0;
  width: 100vw;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  background-color: #1a0b10;
  background-image: none;
}

.keystore-card {
  background: #220F17;
  border: 1px solid rgba(247, 147, 26, 0.2);
  border-radius: 16px;
  padding: 28px 32px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.5), 0 0 24px rgba(247, 147, 26, 0.15);
  backdrop-filter: blur(12px);
  transition: all 0.3s ease;
  min-width: 340px;
  max-width: 520px;
  width: 90%;
  margin: 20px auto;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* Loading Box */
.keystore-loading-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 28px 16px;
  color: #f7931a;
  font-size: 1rem;
}

.wallet-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(247, 147, 26, 0.2);
  border-top-color: #f7931a;
  border-radius: 50%;
  animation: walletSpin 0.8s linear infinite;
  display: inline-block;
}

@keyframes walletSpin {
  to { transform: rotate(360deg); }
}

/* Sections */
.wallet-view-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
}

/* Badges */
.wallet-badge-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.wallet-status-badge {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.wallet-status-badge.badge-active {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border-color: rgba(46, 204, 113, 0.4);
}

.wallet-status-badge.badge-ready {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
  border-color: rgba(46, 204, 113, 0.5);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(46, 204, 113, 0.2);
}

.wallet-status-badge.badge-locked {
  background: rgba(243, 156, 18, 0.18);
  color: #f39c12;
  border-color: rgba(243, 156, 18, 0.5);
  font-weight: 700;
  box-shadow: 0 0 12px rgba(243, 156, 18, 0.15);
}

.wallet-status-badge.badge-session-unlocked {
  background: rgba(52, 152, 219, 0.15);
  color: #3498db;
  border-color: rgba(52, 152, 219, 0.4);
}

.wallet-status-badge.badge-session-locked {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
  border-color: rgba(243, 156, 18, 0.4);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: currentColor;
  display: inline-block;
}

/* Address Card */
.wallet-address-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(247, 147, 26, 0.25);
  border-radius: 12px;
  padding: 14px 16px;
  width: 100%;
  box-sizing: border-box;
}

.wallet-field-label {
  font-size: 0.8rem;
  color: #a09095;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.wallet-address-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.active-wallet-balance-badge {
  font-size: 0.82rem;
  font-weight: 600;
  color: #c5a880;
  background: rgba(197, 168, 128, 0.12);
  border: 1px solid rgba(197, 168, 128, 0.3);
  padding: 3px 10px;
  border-radius: 12px;
}

.wallet-address-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.wallet-code-preview {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.95rem;
  color: #f7931a;
  word-break: break-all;
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid rgba(247, 147, 26, 0.15);
  flex: 1;
}

.keystore-btn-icon {
  background: rgba(247, 147, 26, 0.12);
  border: 1px solid rgba(247, 147, 26, 0.35);
  color: #f7931a;
  font-size: 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  padding: 8px 10px;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.keystore-btn-icon:hover {
  background: rgba(247, 147, 26, 0.25);
  border-color: #f7931a;
}

.copy-feedback-text {
  font-size: 0.8rem;
  color: #2ecc71;
  margin-top: 6px;
  display: block;
  text-align: right;
  font-weight: 500;
}

/* Unlock Box */
.wallet-unlock-box {
  background: rgba(243, 156, 18, 0.08);
  border: 1px dashed rgba(243, 156, 18, 0.4);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.unlock-info {
  font-size: 0.9rem;
  color: #f0e6e8;
  margin: 0;
  line-height: 1.4;
}

/* Actions Section */
.wallet-actions-section {
  width: 100%;
  margin-top: 4px;
}

.wallet-section-subtitle {
  font-size: 0.82rem;
  color: #a09095;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 10px;
  text-align: center;
}

.wallet-quick-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.wallet-quick-grid .keystore-btn {
  flex: 1;
  min-width: 130px;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

/* Multi-Wallet Section */
.multi-wallet-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(247, 147, 26, 0.2);
  width: 100%;
}

.multi-wallet-header {
  text-align: left;
  margin-bottom: 12px;
}

.multi-wallet-note {
  font-size: 0.85rem;
  color: #a09095;
  margin: 4px 0 0 0;
}

.multi-wallet-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.multi-wallet-item {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}

.multi-wallet-item:hover {
  border-color: rgba(247, 147, 26, 0.4);
  background: rgba(0, 0, 0, 0.45);
}

.multi-wallet-item.is-active {
  border-color: rgba(46, 204, 113, 0.5);
  background: rgba(46, 204, 113, 0.06);
  box-shadow: 0 0 10px rgba(46, 204, 113, 0.1);
}

.multi-wallet-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.multi-wallet-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #f7931a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.multi-wallet-addr {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.84rem;
  color: #c0b0b5;
  word-break: break-all;
}

.multi-wallet-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.multi-wallet-balance {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e5c9a0;
}

.multi-wallet-active-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: #2ecc71;
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid rgba(46, 204, 113, 0.35);
  border-radius: 12px;
  padding: 2px 10px;
}

.keystore-btn-sm {
  background: rgba(247, 147, 26, 0.15);
  border: 1px solid rgba(247, 147, 26, 0.4);
  color: #f7931a;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.keystore-btn-sm:hover {
  background: #f7931a;
  color: #11070e;
}

.badge-sm {
  font-size: 0.75rem !important;
  padding: 2px 8px !important;
}

/* Danger Zone */
.wallet-danger-zone {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.keystore-btn-link {
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 0.86rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 8px;
  transition: color 0.2s;
}

.keystore-btn-link:hover {
  color: #f7931a;
}

.keystore-btn-link.danger {
  color: #e74c3c;
}

.keystore-btn-link.danger:hover {
  color: #ff6b6b;
}

/* Wallet Direct 2-Button Setup Actions */
.wallet-setup-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 10px 0;
  width: 100%;
}

.setup-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 6px 0;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: rgba(247, 147, 26, 0.2);
}

.divider-text {
  font-size: 0.8rem;
  color: #a09095;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.selected-file-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(247, 147, 26, 0.12);
  border: 1px solid rgba(247, 147, 26, 0.35);
  padding: 8px 14px;
  border-radius: 8px;
  margin: 0 auto 16px auto;
  max-width: 90%;
  box-sizing: border-box;
}

.file-icon {
  font-size: 1.2rem;
}

.file-name {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.9rem;
  color: #f7931a;
  word-break: break-all;
}

.text-center {
  text-align: center;
}

.tab-note {
  font-size: 0.92rem;
  color: #d8c8cc;
  line-height: 1.45;
  margin: 0 0 10px 0;
}

.full-width {
  width: 100% !important;
}

/* Created success box */
.created-success-box {
  background: rgba(46, 204, 113, 0.12);
  border: 1px solid rgba(46, 204, 113, 0.35);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.created-success-msg {
  color: #2ecc71;
  font-weight: 600;
  margin: 0;
  font-size: 0.95rem;
}

.created-actions-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.cancel-setup-box {
  text-align: center;
  margin-top: 8px;
}

/* Botones Base */
.keystore-btn {
  padding: 12px 20px;
  border-radius: 8px;
  border: 1.5px solid transparent;
  background: #f7931a;
  color: #220F17;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.95rem;
}

.keystore-btn.primary {
  background: #f7931a;
  color: #220F17 !important;
}

.keystore-btn.primary:hover {
  background: #6B0F0F !important;
  color: #fff !important;
  border-color: #6B0F0F !important;
}

.keystore-btn:hover {
  background: #e68515;
}

.keystore-btn.danger {
  background: #c0392b;
  color: #fff !important;
}

.keystore-btn.danger:hover {
  background: #962d22 !important;
  border-color: #962d22 !important;
}

.keystore-btn:disabled {
  background: #555 !important;
  color: #888 !important;
  cursor: not-allowed;
  border-color: transparent !important;
}

.keystore-status {
  color: #f7931a;
  font-size: 0.92rem;
  min-height: 24px;
  text-align: center;
  margin-top: 14px;
  line-height: 1.4;
}

/* Utility: Hidden and layout helper classes */
.sec009-hidden,
.modal.sec009-hidden {
  display: none !important;
}

.sec009-modal-actions-end {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #220F17;
  border: 1px solid rgba(247, 147, 26, 0.3);
  border-radius: 14px;
  padding: 26px 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  min-width: 300px;
  max-width: 400px;
  width: 90%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.modal-content h3 {
  color: #f7931a;
  margin: 0 0 8px 0;
  font-size: 1.25rem;
  text-align: center;
}

.modal-content h3.danger-title {
  color: #e74c3c !important;
}

.modal-subtitle {
  color: #ccc;
  font-size: 0.9rem;
  margin: 0 0 16px 0;
  text-align: center;
  line-height: 1.4;
}

.modal-content label {
  color: #f0e0e5;
  font-size: 0.88rem;
  margin-bottom: 6px;
  display: block;
}

.modal-content input[type="password"] {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(247, 147, 26, 0.4);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  margin-bottom: 16px;
  width: 100%;
  box-sizing: border-box;
  font-size: 1rem;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Responsive */
@media (max-width: 700px) {
  body { justify-content: flex-start; align-items: stretch; }
  .keystore-container { width: 100%; padding: 0 4vw; margin-top: 80px; }
  .keystore-card { max-width: 100%; width: 100%; min-width: 0; margin: 12px 0; padding: 20px 16px; }
  .wallet-quick-grid { flex-direction: column; }
  .wallet-quick-grid .keystore-btn { width: 100%; }
  .created-actions-row { flex-direction: column; }
  .created-actions-row .keystore-btn { width: 100%; }
}
