/* === Estilos para modales de resultados (migrados de styles.css) === */
.modal-result {
    font-size: 0.9rem;
    line-height: 1.6;
}

.modal-result.success {
    border-left: 4px solid #28a745;
}

.modal-result.warning {
    border-left: 4px solid #ffc107;
}

.modal-result.error {
    border-left: 4px solid #dc3545;
}

.modal-result.development {
    border-left: 4px solid #6f42c1;
}

.modal-result.loading {
    border-left: 4px solid #007bff;
}
/* Bloques migrados de styles.css relacionados con modales. */

/* Estilos para modales - Consistente con el diseño del proyecto */
.modal {
    display: flex; /* visible by default; hidden via .hidden */
    align-items: center;
    justify-content: center;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    animation: fadeIn 0.3s ease-in-out;
}

.modal.hidden,
.modal.sec009-hidden {
    display: none !important;
}

.modal-content {
    background-color: #220F17;
    margin: auto;
    padding: 30px;
    border: none;
    border-radius: 15px;
    width: 100%;
    max-width: 700px;
    box-sizing: border-box !important;
    box-shadow: 0 8px 32px rgba(247, 147, 26, 0.3);
    position: relative;
    animation: slideIn 0.3s ease-out;
    backdrop-filter: blur(10px);
    color: #ffffff;
}

@media (max-width: 700px) {
    .modal-content {
        padding: 24px 16px !important;
        margin: 16px auto !important;
        width: min(94vw, 700px) !important;
        max-width: 94vw !important;
        min-width: 0 !important;
        border-radius: 12px !important;
        box-sizing: border-box !important;
    }
}

.modal-content h2 {
    color: #FFC48C;
    text-align: center;
    margin-bottom: 20px;
    border-bottom: none;
    padding-bottom: 10px;
}

.close {
    color: #FFC48C;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background-color: rgba(255, 196, 140, 0.12) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    flex-shrink: 0;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: #fff;
    background-color: #6B0F0F;
    transform: scale(1.1);
    text-decoration: none;
}

/* Animaciones para los modales */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

/* Estilos para formularios dentro de modales */
.modal-content input,
.modal-content select,
.modal-content textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

/* Dedicated style for the passphrase input shown via modal */
#passphraseModalInput {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #ddd;
    background: #fff;
    color: #222;
    font-size: 16px;
    box-sizing: border-box;
}

#passphraseModalInput::placeholder {
    color: #6c757d;
    opacity: 0.9;
}

.modal-content input:focus,
.modal-content select:focus,
.modal-content textarea:focus {
    border-color: #FFC48C;
    outline: none;
    box-shadow: 0 0 8px rgba(255, 196, 140, 0.25);
}

.modal-content button {
    width: 100%;
    margin-top: 10px;
    font-size: 16px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Contenido específico de modales */
.modal-body {
    max-height: 65vh;
    overflow-y: auto;
    margin-top: 20px;
    color: #e9e3e3;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #6B0F0F;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #8B1E3F;
}

/* Estilo para información en modales */
.modal-info {
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 196, 140, 0.25);
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    word-break: break-all;
    color: #ffffff;
}

/* Monitor modal content helpers */
.monitor-card {
    background: #2F1D25;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 196, 140, 0.25);
}
.monitor-title { color: #FFC48C; margin-top: 0; }
.monitor-list { color: #ffffff; margin: 0; padding-left: 20px; }
.monitor-link { color: #63b3ed; }
.status-online { color: #48bb78; }
.status-standalone { color: #ed8936; }
.monitor-sublist { list-style: none; margin-left: 8px; }
.monitor-subitems { margin: 6px 0 0 12px; color: #cfe8de; }
.modal-actions { text-align: center; margin-top: 20px; }

.modal-info p {
    margin: 5px 0;
    line-height: 1.4;
}

.modal-info strong {
    color: #FFC48C;
}

.modal-info code {
    background-color: rgba(0, 0, 0, 0.35);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: #FFC48C;
    word-break: break-all;
}

/* Estilos para botones dentro de modales que siguen el tema del proyecto */
.modal-content button {
    background-color: #f7931a;
    border: none;
    color: white;
    padding: 12px 24px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    margin: 8px 4px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 80px;
}

.modal-content button:hover {
    background-color: #6B0F0F;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 15, 15, 0.4);
}

.modal-content button:active {
    transform: translateY(0);
}

/* Botones de acción específicos */
.modal-content button[type="submit"] {
    background-color: #28a745;
    width: 100%;
    margin-top: 15px;
    padding: 15px;
    font-size: 16px;
}

.modal-content button[type="submit"]:hover {
    background-color: #218838;
}

.modal-content button.cancel-btn {
    background-color: #dc3545;
}

.modal-content button.cancel-btn:hover {
    background-color: #c82333;
}

/* Mejoras para elementos de lista en modales */
.modal-content ul {
    list-style-type: none;
    padding: 0;
}

.modal-content li {
    background-color: rgba(247, 147, 26, 0.05);
    border: 1px solid rgba(247, 147, 26, 0.2);
    border-radius: 6px;
    padding: 10px;
    margin: 8px 0;
    word-break: break-all;
}

/* Mejoras para código y elementos pre */
.modal-content pre,
.modal-content code {
    background-color: #220F17;
    color: #ffffff;
    border-radius: 6px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    overflow-x: auto;
    border: 1px solid rgba(255, 196, 140, 0.35);
}

/* JSON/pre blocks that use a light background should explicitly set dark text */
.json-display,
.json-display pre {
    background: #2F1D25 !important;
    color: #ffffff;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid rgba(255, 196, 140, 0.35);
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
}

/* Transaction item styles */
.tx-item { list-style: none; }
.tx-label { color: #333; font-weight: 700; }
.tx-id {
    color: #fff !important;
    background: #3A2324 !important;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    word-break: break-all;
}
.tx-copy-btn { padding: 6px 10px; font-size: 0.9rem; }

.modal-content code {
    padding: 2px 6px;
    display: inline;
}

/* Estados de carga para modales */
.modal-loading {
    text-align: center;
    padding: 20px;
}

.modal-loading::after {
    content: "⏳";
    font-size: 24px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 🎉 Estilos para modal de éxito */
.modal-success {
    text-align: center;
    padding: 20px;
}

.success-icon {
    font-size: 48px;
    margin-bottom: 15px;
    animation: bounceIn 0.6s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

.modal-success h3 {
    color: #28a745;
    margin: 10px 0;
    font-weight: 600;
}

.modal-success p {
    color: #2d3748;
    margin: 8px 0;
    font-weight: 500;
}

.modal-success strong {
    color: #1a202c;
    font-weight: 600;
}

.modal-success code {
    background: #2d3748;
    color: #e2e8f0;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 500;
}

.status-success {
    color: #28a745;
    font-weight: bold;
    background: #d4edda;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.modal-details {
    margin-top: 15px;
    border-top: 1px solid #dee2e6;
    padding-top: 15px;
}

.modal-details summary {
    cursor: pointer;
    color: #007bff;
    font-size: 14px;
    margin-bottom: 10px;
}

.json-display {
    background: #2d3748;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 6px;
    font-size: 11px;
    overflow-x: auto;
    max-height: 300px;
    white-space: pre-wrap;      /* Permite saltos de línea automáticos */
    word-break: break-all;      /* Rompe palabras largas */
    overflow-wrap: anywhere;    /* Rompe donde sea necesario */
}

/* Ajuste específico para transacciones dentro de modales */
.modal-content .transaction,
.modal-content .transaction-modal-item,
.modal-content .monitor-card {
    max-width: calc(100% - 20px);
    margin: 8px auto;
    overflow: hidden;
}

/* Responsive para el modal QR */
@media (max-width: 768px) {
    .qr-container {
        flex-direction: column;
        text-align: center;
    }
    .qr-info {
        min-width: 100%;
    }
    .qr-actions {
        flex-direction: column;
        align-items: center;
    }
    .qr-actions .dashboard-btn {
        width: 100%;
        max-width: 250px;
    }
}

/* Eliminar scroll horizontal en el modal de wallet */
#walletModalBody, .modal-body {
  overflow-x: hidden !important;
  max-width: 100%;
  box-sizing: border-box;
}

/* Utilidad global: romper palabras muy largas (hex, hashes, pubkeys) para evitar overflow en modales */
.break-anywhere,
.modal .modal-content,
.modal .modal-content * {
    overflow-wrap: anywhere;
    word-break: break-word;
    line-break: anywhere;
}

.modal-content, .modal-content * {
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
}

@media (max-width: 600px) {
  .modal-content, .modal-content * {
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: auto;
  }
}

/* Helpers para modales sin inline styles (CSP style-src 'self' compliant) */
.sec009-text-center,
.modal-text-center {
  text-align: center;
}

.sec009-mine-icon {
  font-size: 2em;
  margin-bottom: 10px;
}

/* Acciones y Botones en Modales */
.modal-actions-center {
  text-align: center;
  margin-top: 16px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.modal-actions-right {
  text-align: right;
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-box-wide {
  max-width: 720px !important;
  margin-top: 40px !important;
}

.modal-side-panel {
  background: #220F17;
  color: #fff;
  box-shadow: rgba(0, 0, 0, 0.25) 0px 8px 24px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  padding: 16px;
  max-width: 600px;
  width: min(42vw, 600px);
  max-height: 80vh;
  overflow: auto;
  display: block;
  margin: 48px auto 0 auto;
}

.modal-pre-block {
  white-space: pre-wrap;
  margin: 0;
  word-break: break-all;
}

.modal-table-full {
  width: 100%;
  border-collapse: collapse;
}

.modal-table-label-col {
  width: 28%;
  padding: 6px;
  font-weight: 600;
}

.modal-table-cell {
  padding: 6px;
}

.modal-table-header {
  padding: 6px;
  font-weight: 600;
}

.modal-separator {
  margin-top: 12px;
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-text-break {
  word-break: break-all;
}

.modal-monospace {
  word-break: break-all;
  font-family: monospace;
}

.modal-balance-value {
  color: #f7931a;
  font-weight: bold;
  font-size: 18px;
}

.modal-code-box {
  word-break: break-all;
  font-family: monospace;
  background: #1a1320;
  color: #fff;
  padding: 10px;
  border-radius: 5px;
  font-size: 12px;
}

/* Grupos de Formulario en Modales */
.modal-form-group {
  margin: 15px 0;
}

.modal-form-label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.modal-form-input {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  margin-bottom: 15px;
  box-sizing: border-box;
}

.modal-input-dark {
  background: #220F17 !important;
  color: #fff !important;
}

.modal-btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-btn-flex {
  flex: 1;
  min-width: 150px;
}

.modal-btn-full {
  width: 100%;
}

.modal-privkey-alert {
  color: #e53e3e;
  font-weight: bold;
}

.modal-privkey-btn {
  margin: 8px 0 0 0;
  padding: 4px 12px;
  font-size: 1em;
}

.modal-privkey-value {
  display: none;
  word-break: break-all;
  background: #f8f8f8;
  color: #222;
  padding: 6px 10px;
  border-radius: 6px;
  margin-left: 8px;
}

/* Espaciados auxiliares en Modales */
.modal-mt-12 {
  margin-top: 12px;
}

.modal-mt-15 {
  margin-top: 15px;
}

.modal-mt-20 {
  margin-top: 20px;
}

.modal-ml-10 {
  margin-left: 10px;
}

.modal-top-layer {
  z-index: 25000 !important;
}

.modal-offset-right {
  margin-left: 24px !important;
}

.modal-offset-top {
  margin-top: 24px !important;
}

.modal-align-top {
  align-items: flex-start !important;
}

/* Botellas en Modal UTXO */
.utxo-bottle-btn {
  width: 48px !important;
  height: 68px !important;
  min-width: 48px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 3px !important;
  background: rgba(22, 6, 10, 0.6) !important;
  border: 1px solid rgba(247, 147, 26, 0.3) !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
}

.utxo-bottle-btn:hover {
  background: rgba(247, 147, 26, 0.2) !important;
  border-color: #f7931a !important;
  transform: scale(1.05) !important;
  box-shadow: 0 0 12px rgba(247, 147, 26, 0.35) !important;
}

.utxo-bottle-img {
  height: 60px !important;
  width: auto !important;
  max-width: 40px !important;
  object-fit: contain !important;
  display: block !important;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6)) !important;
}

/* Monitoring Modal CSP Helpers */
.monitor-scroll-info {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
  box-sizing: border-box;
}

.monitor-card-item {
  min-width: 0;
  word-break: break-word;
}

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

.monitor-title-nomargin {
  margin: 0;
}

.monitor-badge-role {
  background: #3b82f6;
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
}

.monitor-badge-subrole {
  font-size: 10px;
  background: #1e40af;
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}

.monitor-list-clean {
  margin-left: 12px;
  list-style: none;
  padding-left: 0;
}

.monitor-peer-row {
  margin-bottom: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  border-left: 3px solid #10b981;
}

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

.monitor-peer-details {
  font-size: 12px;
  margin-top: 4px;
  line-height: 1.5;
}

.monitor-pending-title {
  margin-top: 6px;
}

.monitor-socket-item {
  font-size: 12px;
  margin-bottom: 4px;
  color: #cbd5e1;
}

.monitor-details-item {
  margin-bottom: 4px;
}

.monitor-details-list {
  margin-left: 12px;
}

.text-muted-slate {
  color: #94a3b8;
}

.text-muted-dark {
  color: #666666;
}

.text-warning-amber {
  color: #f59e0b;
}

.text-light-slate {
  color: #cbd5e1;
}

.text-error-red {
  color: #b71c1c;
}

/* Utilidades para Winelover & QR Proof */
.w-25 {
  width: 25% !important;
}

.w-50 {
  width: 50% !important;
}

.text-center-muted-empty {
  text-align: center;
  padding: 24px;
  color: var(--color-text-secondary, #999);
}

.qr-test-container {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 8px;
  box-sizing: border-box;
}

.qr-input-full {
  width: 100%;
  min-width: 0;
  word-break: break-all;
}

.qr-file-full {
  width: 100%;
  min-width: 0;
}

.qr-download-btn {
  background: #1976d2;
  color: #fff;
  padding: 10px 24px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1em;
  text-decoration: none;
  display: inline-block;
}

.qr-modal-preview {
  max-width: 250px;
  margin: 20px 0;
}

.tx-success-banner {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.tx-confirmed-pill {
  background: #46A24A;
  border: 1px solid #19af26;
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 15px;
  font-size: 0.9em;
}

.tx-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 0.9em;
}

.tx-grid-form-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.tx-grid-form-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
}

.tx-code-pill {
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.8em;
}

.tx-input-readonly {
  background: #f8f9fa !important;
  color: #6c757d !important;
}

.tx-textarea-full {
  width: 100%;
  min-width: 350px;
  max-width: 100%;
}

.tx-submit-btn {
  background: linear-gradient(135deg, #F7931A, #A0522D);
  color: white;
  padding: 12px 30px;
  border: none;
  border-radius: 8px;
  font-size: 1.1em;
  cursor: pointer;
  transition: all 0.3s;
}

.tx-title-nomargin {
  margin: 0 0 15px 0;
}

.modal-text-left {
  text-align: left;
}



