/* components.css — botones, lista de archivos, progreso, modales, explorador */

/* ---------- Botones ---------- */

.btn {
  height: 40px;
  font-size: 15px;
  border: none;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-gray {
  background: var(--gray-btn);
}

.btn-gray:hover:not(:disabled) {
  background: var(--gray-btn-hover);
}

.btn-convert {
  width: 100%;
  height: 50px;
  font-size: 18px;
  font-weight: 700;
  background: var(--convert);
}

.btn-convert:hover:not(:disabled) {
  background: var(--convert-hover);
}

/* ---------- Lista de archivos ---------- */

.file-list {
  height: 150px;
  overflow-y: auto;
  border-radius: 4px;
}

.file-item {
  font-size: 11px;
  text-align: left;
  padding: 2px 4px;
  word-break: break-all;
}

.file-list-empty {
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
  padding: 20px 0;
}

/* ---------- Progreso ---------- */

.progress-bar {
  height: 20px;
  background: var(--track);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  border-radius: 10px;
  transition: width 0.2s ease;
}

.progress-label {
  font-size: 14px;
  text-align: center;
  min-height: 18px;
}

/* ---------- Modales (messagebox) ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-box {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  max-width: 460px;
  width: calc(100% - 48px);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.modal-title {
  font-size: 14px;
  font-weight: 700;
  padding: 12px 16px;
  border-bottom: 1px solid var(--panel-border);
}

.modal-body {
  padding: 16px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-line;
  overflow-y: auto;
}

.modal-actions {
  padding: 12px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--panel-border);
}

.modal-btn {
  min-width: 90px;
  height: 32px;
  font-size: 13px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #ffffff;
  background: var(--accent);
}

.modal-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.modal-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.modal-btn.modal-btn-secondary {
  background: var(--gray-btn);
}

.modal-btn.modal-btn-secondary:hover:not(:disabled) {
  background: var(--gray-btn-hover);
}

/* ---------- Explorador ficticio ---------- */

.explorer-box {
  width: 560px;
  max-width: calc(100% - 48px);
  height: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.explorer-title {
  font-size: 14px;
  font-weight: 700;
  padding: 12px 16px 4px;
}

.explorer-help {
  font-size: 11px;
  color: var(--text-secondary);
  padding: 0 16px 8px;
  border-bottom: 1px solid var(--panel-border);
}

.explorer-pathbar {
  display: flex;
  gap: 8px;
  padding: 10px 16px 4px;
}

.explorer-pathbar input {
  flex: 1;
  height: 30px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--pill-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 0 8px;
}

.explorer-pathbar input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.explorer-path-error {
  font-size: 11px;
  color: var(--error);
  padding: 4px 16px 0;
  min-height: 0;
}

.explorer-path-error .explorer-suggestion {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.explorer-tree {
  flex: 1;
  overflow: auto;
  padding: 8px 8px 8px 16px;
  font-size: 13px;
}

.explorer-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.explorer-row:hover {
  background: var(--pill-bg);
}

.explorer-row.selected {
  background: var(--accent);
  color: #ffffff;
}

.explorer-row.disabled-row {
  opacity: 0.45;
  cursor: default;
}

.explorer-row.disabled-row:hover {
  background: transparent;
}

.explorer-toggle {
  width: 16px;
  flex: none;
  text-align: center;
  font-size: 10px;
  color: var(--text-secondary);
}

.explorer-row.selected .explorer-toggle {
  color: #ffffff;
}

.explorer-children {
  margin-left: 18px;
}

.explorer-children.collapsed {
  display: none;
}

.explorer-empty {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 4px 8px 8px 22px;
  cursor: default;
}

.explorer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--panel-border);
}

.explorer-actions-buttons {
  display: flex;
  gap: 8px;
  flex: none;              /* los botones nunca se apilan: la ruta es la que cede */
}

.explorer-selection-info {
  flex: 1;
  min-width: 0;            /* permite que el ellipsis funcione sin empujar los botones */
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- Visor de PDF simulado ---------- */

/* Encima de cualquier ventana previa (el explorador usa z-index 100) */
.pdfview-overlay {
  z-index: 200;
}

.pdfview-nav-label {
  color: #f1f1f1;
  font-size: 12px;
  white-space: nowrap;
}

.pdfview-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.pdfview-nav:disabled:hover {
  background: transparent;
}

.explorer-row.pdf-row {
  color: var(--text);
}

.pdfview-box {
  width: 720px;
  max-width: calc(100% - 32px);
  height: 90vh;
  display: flex;
  flex-direction: column;
  background: #525659;                /* gris típico de visores PDF */
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.pdfview-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #323639;
  color: #f1f1f1;
}

.pdfview-title {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pdfview-hint {
  flex: 1;
  font-size: 11px;
  color: #b8bcc0;
  text-align: right;
}

.pdfview-close {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #f1f1f1;
  font-size: 15px;
  cursor: pointer;
}

.pdfview-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.pdfview-body {
  flex: 1;
  overflow: auto;
  padding: 18px;
  display: flex;
  justify-content: center;
}

.pdfview-nodata {
  color: #e8e8e8;
  font-size: 13px;
  padding: 40px;
}

/* Página A4 con el estilo de la plantilla SUNAT (ebxml21.css):
   Verdana, fondos de sección #b6cbeb, bordes #4682b4 */
.pdf-page {
  background: #ffffff;
  color: #1a1a1a;
  width: 620px;
  min-height: 840px;
  height: fit-content;
  padding: 32px 36px;
  font-family: Verdana, Geneva, sans-serif;
  font-size: 11px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

.pdf-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.pdf-emisor-nombre {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.pdf-ruc-box {
  border: 2px solid #4682b4;
  border-radius: 6px;
  text-align: center;
  padding: 10px 16px;
  min-width: 210px;
  font-weight: 700;
}

.pdf-ruc-num {
  font-size: 12px;
}

.pdf-ruc-tipo {
  background: #b6cbeb;
  margin: 6px -6px;
  padding: 3px 0;
  font-size: 12px;
}

.pdf-ruc-serie {
  font-size: 13px;
}

.pdf-section {
  border: 1px solid #4682b4;
  border-radius: 4px;
  margin-bottom: 12px;
  overflow: hidden;
}

.pdf-section > div {
  padding: 3px 10px;
}

.pdf-section-title {
  background: #b6cbeb;
  font-weight: 700;
}

.pdf-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.pdf-table th {
  background: #b6cbeb;
  border: 1px solid #4682b4;
  padding: 4px 8px;
  text-align: left;
}

.pdf-table td {
  border: 1px solid #4682b4;
  padding: 4px 8px;
}

.pdf-num {
  text-align: right;
}

.pdf-totals {
  text-align: right;
  margin-bottom: 12px;
  line-height: 1.7;
}

.pdf-total {
  font-weight: 700;
  font-size: 12px;
}

.pdf-detraccion {
  font-size: 10px;
}

.pdf-footer-note {
  margin-top: 16px;
  text-align: center;
  font-size: 9px;
  color: #777777;
}
