/* Burn bodega select dropdown styling */
.burn-bodega-select {
  margin-bottom: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 2px solid var(--accent, #8b1631);
  background: #fff6e5;
  color: var(--accent, #8b1631);
  font-weight: 600;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(139,22,49,0.08);
  outline: none;
  transition: border-color 0.2s;
}
.burn-bodega-select:focus {
  border-color: var(--muted, #c9aeb6);
  background: #fff6e5;
}
.utxo-checkbox {
  width: 15px !important;
  min-width: 15px !important;
  max-width: 15px !important;
  height: 15px !important;
  box-sizing: content-box !important;
  display: inline-block !important;
}
.utxo-checkbox {
  width: 15px !important;
  min-width: 15px !important;
  max-width: 15px !important;
  display: inline-block;
}
.coincontrol-utxo-row label.utxo-meta {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.utxo-checkbox {
  width: 15px;
  height: 15px;
  accent-color: #8b1631;
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 1px 4px rgba(80,0,40,0.08);
}
.coincontrol-utxo-row {
  background: #f5f5f5;
  border-radius: 6px;
  margin-bottom: 6px;
  padding: 4px 8px;
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Las siguientes propiedades deben ir dentro de un selector válido. Ejemplo: .coincontrol-utxo-row .utxo-meta */
.coincontrol-utxo-row .utxo-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.coincontrol-utxo-row .utxo-amount {
  font-weight: 600;
  font-size: 1.12em;
  color: #222;
  margin-right: 6px;
}
.coincontrol-utxo-row .utxo-meta {
  color: #888;
  font-size: 0.98em;
}
/* Estilo personalizado para input file y su botón */
input[type="file"] {
  color: #808080; /* Cambia el color del texto del input file */
}
input[type="file"]::file-selector-button {
  background: #fff;
  color: #8b1631; /* Color del texto del botón */
  border: 1px solid #f7931a;
  border-radius: 6px;
  padding: 4px 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
input[type="file"]::file-selector-button:hover {
  background: #f7931a;
  color: #fff;
}
.demo-menu { background:#132231; color:#fff; padding:8px 12px; position:fixed; top:0; left:0; right:0; z-index:1000; box-shadow:0 2px 10px rgba(0,0,0,0.2); }
.demo-menu ul { list-style:none; display:flex; gap:10px; margin:0; padding:0; }
.demo-menu .menu-btn { background:#fff1; color:#fff; border:1px solid #fff3; padding:6px 12px; border-radius:6px; cursor:pointer; }
.demo-menu .menu-btn:hover { background:#fff2; }
.firma-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap:12px; }
.firma-box { border:1px solid #ddd; border-radius:8px; padding:12px; background:#fff; }
.fieldset { border:1px dashed #999; padding:8px 12px; border-radius:8px; margin-bottom:12px; }
/* Tarjetas verticales para historial de la wallet */

/* Root vars to align with BlocksWine theme */
:root {
  --bg: #12060a;
  --card: #1b0710;
  --muted: #c9aeb6; /* soft muted text */
  --accent: #8b1631;
  --button-bg: #f7931a; /* primary button bg (orange) */
  --header-offset: 64px; /* Reduced so header sits compactly at top */
  --glass: rgba(255,255,255,0.03);
  --maxw: 1100px;
}

/* Modal de historial (loteModal) con fondo y borde naranja */
/* Modal contenido: uniformar con view.html (fondo blanco, borde naranja) */
#loteModal .modal-content {
  background-color: #fff; /* antes #E3CFC4 */
  border: 3px solid #f7931a;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(247, 147, 26, 0.3); /* mismo estilo de sombra themed */
  max-width: 600px;
  margin: 5% auto;
  padding: 20px 24px 16px; /* coherente con view */
  position: relative;
}

.historial-item {
  background-color: rgba(255, 255, 255, 0.726);
  border: 3px solid #f7931a;
  border-radius: 15px;
  box-shadow: 0 2px 8px #0001;
  margin-bottom: 16px;
  padding: 12px 16px;
  font-size: 0.98em;
  word-break: break-all;
}
.historial-item div {
  margin-bottom: 4px;
}
/* Estilo para la lista de selección de UTXO */
.utxo-select-list {
  max-height: 150px;
  overflow: auto;
  margin-bottom: 8px;
}
/* Estilo para contenedor de UTXO */
.utxo-container {
  background: #28A745;
  border-radius: 6px;
  margin-bottom: 4px;
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Estado visual para UTXO pendiente */
.utxo-container.is-pending { opacity: 0.6; }
.badge-pend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff3e2; /* soft orange */
  color: #a65b00;
  font-weight: 600;
  font-size: 12px;
  border: 1px solid #ffc37a;
}
.badge-pend::before {
  content: '⏳';
  font-size: 12px;
}
/* Copied from ../demo-wallet/style.css to ensure public/demo-wallet has the stylesheet */
body {
  /* Fondo repetitivo de cubos estilo Balena Etcher, igual que view.html */
  background-color: #3A1319;
  background-image:
    url('data:image/svg+xml;utf8,<svg width="192" height="192" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><polygon points="24,4 44,14 44,34 24,44 4,34 4,14" fill="%23FF9800" stroke="%23FF9800" stroke-width="2"/><polygon points="24,4 44,14 24,24 4,14" fill="%23FF9800" opacity="0.85"/><polygon points="24,24 44,14 44,34 24,44" fill="%23FFB74D" opacity="0.7"/><polygon points="24,24 24,44 4,34 4,14" fill="%23A0522D" opacity="0.7"/><rect x="21" y="12" width="6" height="20" rx="3" fill="white" opacity="0.25"/><rect x="23" y="8" width="2" height="6" rx="1" fill="white" opacity="0.25"/></svg>'),
    url('data:image/svg+xml;utf8,<svg width="192" height="192" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><polygon points="24,4 44,14 44,34 24,44 4,34 4,14" fill="%23FF9800" stroke="%23FF9800" stroke-width="2"/><polygon points="24,4 44,14 24,24 4,14" fill="%23FF9800" opacity="0.85"/><polygon points="24,24 44,14 44,34 24,44" fill="%23FFB74D" opacity="0.7"/><polygon points="24,24 24,44 4,34 4,14" fill="%23A0522D" opacity="0.7"/><rect x="21" y="12" width="6" height="20" rx="3" fill="white" opacity="0.25"/><rect x="23" y="8" width="2" height="6" rx="1" fill="white" opacity="0.25"/></svg>');
  background-repeat: repeat;
  background-size: 192px 192px, 192px 192px;
  background-position: 0 0, 96px 96px;
  margin: 0;
  min-height: 100vh;
  font-family: 'Press Start 2P', monospace, Arial, sans-serif;
  display: block;
  padding-top: 0;
}

/* Legibilidad mejorada: texto de párrafos en gris claro en lugar de negro puro */
.dashboard-card p,
main p,
body p,
/* Mejor legibilidad y contraste para tarjetas */
.dashboard-card {
  background-color: rgba(255, 255, 255, 0.90); /* Más opaco para mejor lectura */
  border: 2.5px solid #a0522d; /* Tono marrón oscuro, más elegante y legible */
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 6px 24px rgba(160, 82, 45, 0.18); /* Sombra más suave y cálida */
  backdrop-filter: blur(40px);
  transition: all 0.3s ease;
}


/* Asegurar contraste en títulos dentro de details/summary */
.dashboard-card summary { font-weight: 600; }

/* Títulos en naranja corporativo */
.dashboard-card h1,
.dashboard-card h2,
main h1,
main h2 {
  color: #f7931a;
}

.grid-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin: calc(var(--header-offset) + 64px) auto 56px; /* más separación bajo header fijo */
  min-height: calc(100vh - var(--header-offset) - 120px); /* deja espacio inferior y evita que quede demasiado arriba */
  width: 100%;
  max-width: 820px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: 0 6px 24px rgba(2, 6, 23, 0.6);
  align-content: start; /* evita estirado vertical y mantiene posicionamiento natural */
}

/* Centrar SOLO My BW-Wallet */
.grid-card > .view[data-view-section="my-wallet"] {
  width: 100%;
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  justify-self: center;
}

/* Alinear las demás cards hacia la derecha (cuando haya más de una columna disponible) */
.grid-card > .view:not([data-view-section="my-wallet"]) {
  justify-self: end;
}

/* Cuando la vista activa es New Wallet, expande el contenedor a toda la anchura para permitir alinear a la derecha de la pantalla */
body[data-view="new-wallet"] .grid-card {
  max-width: 100%;
}
/* Asegurar que la card New Wallet pega a la derecha del viewport con margen interno del contenedor */
body[data-view="new-wallet"] .grid-card > .view[data-view-section="new-wallet"] {
  max-width: 720px;
  margin-left: 24px; /* ahora se alinea desde la izquierda creando contraste con Sign & Verify */
  margin-right: auto;
  justify-self: start;
}
/* Extender mismo comportamiento para Sign & Verify */
body[data-view="sign-verify"] .grid-card { max-width: 100%; }
body[data-view="sign-verify"] .grid-card > .view[data-view-section="sign-verify"] {
  max-width: 760px;
  margin-left: auto;
  margin-right: 24px;
  justify-self: end;
}

/* Alinear específicamente la card New BW-Wallet al borde derecho y limitar su ancho */
.grid-card > .view[data-view-section="new-wallet"] {
  max-width: 640px; /* ancho contenido */
  margin-left: auto; /* empuja hacia la derecha dentro del grid */
  margin-right: 0;
  justify-self: end;
}

/* Responsive: reducir margen superior en pantallas bajas o muy estrechas */
@media (max-height: 780px) {
  .grid-card { margin: calc(var(--header-offset) + 32px) auto 44px; }
}
@media (max-height: 640px) {
  .grid-card { margin: calc(var(--header-offset) + 20px) auto 40px; }
}
@media (max-width: 640px) {
  .grid-card {
    margin: calc(var(--header-offset) + 28px) auto 48px;
    grid-template-columns: 1fr; /* fuerza una columna para legibilidad en móviles */
  }
  .grid-card > .view:not([data-view-section="my-wallet"]) {
    justify-self: center; /* en móviles, centrar también las otras para mejor UX */
  }
}


.dashboard-card {
  /* background-color: rgba(255, 255, 255, 0.726); */
  border: 3px solid #f7931a;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 8px 32px rgba(247, 147, 26, 0.3);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

button {
    background-color: #f7931a;
    /* width: 90%; */
    border: none;
    color: white;
    padding: 15px 32px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #e07d0b;
}

.field {
  display: block;
  margin-top: 8px;
  color: grey
}

/* Campo apilado vertical (etiqueta arriba, input debajo) */
.field.field-stack { font-weight:600; margin-top:14px; }
.field.field-stack + .input { margin-top:6px; }

.input {
  border: 2px solid #f7931a;
  padding: 12px;
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.9);
  color: #0b1220;
  font-weight: 500;
  width: 100%; /* Asegura que todos los inputs ocupen el ancho disponible */
}

/* Inputs compactos a media anchura */
.input.half {
  width: 50%;
  max-width: 420px;
}

@media (max-width: 640px) {
  .input.half { width: 100%; }
}

/* Apariencia de campo de solo salida (no editable) */
.readonly-field { display:flex; gap:8px; align-items:center; }
.readonly-field .input { flex:1; min-width:0; }
.input.readonly {
  background:#0b1b2b;
  color:#e5f1ff;
  border:1px dashed #2a3a4a;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}
.input.readonly:focus { outline:none; box-shadow:0 0 0 2px rgba(31,88,135,0.3); }
.input.readonly#senderPub:placeholder-shown {
  /* Cuando no está completado, que el input se funda con el fondo de la tarjeta */
  background: transparent !important; /* deja ver el fondo del contenedor */
}
.copy-btn {
  padding:8px 10px;
  font-size:12px;
  background:#274b6d;
  border:1px solid #3d678a;
  color:#fff;
  border-radius:6px;
  cursor:pointer;
}
.copy-btn:hover { background:#2e5a84; }

.textarea {
  width: 100%;
  height: 50px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: white;
  color: black
}


*{box-sizing:border-box}



.muted{color:var(--muted);margin-top:6px}

.output{
  background:rgba(255,255,255,0.02);
  padding:12px;
  border-radius:8px;
  margin-top:10px;
  white-space:pre-wrap; /* mantiene formato */
  word-break:break-word; /* permite cortar hex largos */
  overflow-x:auto; /* scroll horizontal si sigue siendo muy largo */
  max-width:100%;
  box-sizing:border-box;
}

/* Variante dentro de modal: mejorar legibilidad y asegurar wrapping */
.modal .output {
  background:rgba(255,255,255,0.08);
  border:1px solid rgba(247,147,26,0.25);
  word-break:break-all; /* fuerza corte en hex muy extensos */
  font-size:0.8rem;
  line-height:1.25;
}

/* Clase opcional por si en el futuro marcamos explícitamente hex largos */
.hex-long { word-break:break-all; }

/* .demo-footnote removed (no longer used) */

/* Toast sutil */
.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #132231;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
  font-size: 13px;
  z-index: 10000;
  opacity: 0.95;
}

/* Estilos para el modal reutilizable (genéricos) */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  overflow: auto;
  background: rgba(0,0,0,0.45);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #fff;
  margin: 5% auto;
  padding: 20px 24px 16px;
  border-radius: 15px; /* uniformar con view */
  max-width: 600px;
  box-shadow: 0 8px 32px rgba(247, 147, 26, 0.3);
  border: 3px solid #f7931a; /* aplicar también en genérico por consistencia */
  position: relative;
}

.modal .close {
  position: absolute;
  top: 15px;
  right: 20px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px; /* tamaño icónico */
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  user-select: none;
  border-radius: 50%;
  color: #f7931a;
  background-color: rgba(247, 147, 26, 0.1);
  transition: all 0.3s ease;
  box-shadow: 0 0 0 0 rgba(247,147,26,0.3);
}

.modal .close:hover {
  background-color: #f7931a;
  color: #fff;
  box-shadow: 0 4px 14px rgba(247,147,26,0.4);
  transform: scale(1.08);
}

#modalTitle {
  margin-top: 0;
  margin-bottom: 18px;
  font-size: 1.4em;
  font-weight: 600;
}

/* ====== Unified header, container, nav + btn styles to match BlocksWine ====== */
.site-header {
  position: fixed; /* header fijo, pegado arriba y a todo lo ancho */
  top: 0; left: 0; right: 0;
  width: 100vw;
  backdrop-filter: blur(8px) saturate(110%);
  -webkit-backdrop-filter: blur(8px) saturate(110%);
  background: linear-gradient(180deg, rgba(18,6,10,0.70), rgba(18,6,10,0.30));
  background-color: rgba(18,6,10,0.60);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  height: var(--header-offset);
  min-height: var(--header-offset);
  padding: 0;
  z-index: 1000;
}
.site-header.scrolled {
  background: linear-gradient(180deg, rgba(18,6,10,0.70), rgba(18,6,10,0.30));
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 320ms ease, box-shadow 320ms ease;
}
.site-header .container {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 8px 18px;
  max-width: 100% !important;
  width: 100% !important;
}
.site-header>.container { max-width: 100%; width: 100%; }
.container { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.logo { font-weight: 700; letter-spacing: .6px; font-size: 1.5rem; line-height: 1; color: #f7931a; }
.logo-icon { width: 48px; height: auto; margin-right: 12px; vertical-align: middle; }
.logo-icon.white { filter: invert(1) brightness(1.4) contrast(1.05); background: rgba(255,255,255,0.12); padding: 6px; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,0.35); }
.rotatable { transition: transform 420ms cubic-bezier(.2,.9,.2,1); will-change: transform; }
.rotatable:hover { transform: scale(1.08) rotate(8deg); }

.nav { margin-left: auto; display: flex; gap: 2px; }
.nav .nav-list {
  list-style: none;
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
}
.nav a { color: var(--muted); text-decoration: none; }

.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  background: var(--button-bg);
  color: #08101a;
  border: 1px solid rgba(0,0,0,0.08);
  cursor: pointer;
  transition: all 0.25s ease;
}
.btn:hover, .btn:focus {
  background: linear-gradient(180deg, #8b1631 0%, #6a0f22 100%);
  color: #fff;
  outline: none;
}
.btn.active {
  background: linear-gradient(180deg, #8b1631 0%, #6a0f22 100%);
  color: #fff;
  border: 1px solid rgba(139, 22, 49, 0.9);
}

/* Estado deshabilitado común para botones */
button:disabled,
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(8%);
}

/* Botón para cambiar / deshacer la wallet importada */
.btn.wallet-reset {
  background: #274b6d;
  color: #fff;
  border: 1px solid #3d678a;
  position: relative;
}
.btn.wallet-reset:hover { background:#2e5a84; }
.btn.wallet-reset:active { transform: translateY(1px); }


/* Estado visual cuando la wallet se ha importado correctamente */
.btn.wallet-loaded,
button.wallet-loaded {
  background: linear-gradient(180deg,#6a0f22 0%, #4e0918 100%) !important;
  color:#fff !important;
  border:1px solid rgba(106,15,34,0.9) !important;
  box-shadow:0 6px 18px rgba(106,15,34,0.45);
}
button.wallet-loaded:hover {
  background: linear-gradient(180deg,#6a0f22 0%, #5c0d1d 100%) !important;
  transform: translateY(-1px);
}

/* Badge para indicar wallet cargada */
.wallet-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #6a0f22;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
  border: 1px solid rgba(106,15,34,0.8);
  box-shadow: 0 4px 12px rgba(106,15,34,0.35);
  margin-left: 8px;
}

/* Resaltar input de public key cuando se ha cargado la wallet */
.input.readonly.wallet-loaded {
  background: #6a0f22 !important;
  color: #fff !important;
  border: 2px solid rgba(106,15,34,0.9) !important;
}

/* Keep content below sticky header y evitar centrado involuntario del header */
/* (Removed duplicate body override; merged into main body rule above) */
main { margin-top: calc(var(--header-offset) + 12px); }

#modalBody, #modalHistorial, #modalFooter {
  margin-bottom: 12px;
}

#modalHistorial table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95em;
}

#modalHistorial th, #modalHistorial td {
  border: 1px solid #ddd;
  padding: 6px 8px;
  text-align: left;
}
@media (max-width:520px) {
  .dashboardcard {
    padding: 16px
  }

  .card-header h1 {
    font-size: 1.2rem
  }
}
