/* doc-automation.css — Estilos del módulo Document Automation
   Extiende variables y componentes de styles.css */

/* ── Drop zone grande ────────────────────────────────────────── */
.doc-drop-zone {
  border: 2px dashed var(--primary);
  border-radius: var(--radius-card);
  padding: 3.5rem 2rem;
  text-align: center;
  background: rgba(0,102,204,.04);
  transition: all .3s ease;
  cursor: pointer;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
}
.doc-drop-zone:hover,
.doc-drop-zone.dragover {
  border-color: var(--accent);
  background: rgba(0,200,150,.07);
  transform: translateY(-2px);
}
.doc-drop-zone .drop-icon { font-size: 3rem; color: var(--primary); }
.doc-drop-zone .drop-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.doc-drop-zone .drop-sub   { font-size: .88rem; color: var(--text-muted); }

/* ── Demo doc cards ──────────────────────────────────────────── */
.demo-doc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 12px;
}
.demo-doc-card:hover {
  border-color: var(--primary);
  background: rgba(0,102,204,.05);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.demo-doc-card .doc-icon { font-size: 1.8rem; flex-shrink: 0; }
.demo-doc-card .doc-name { font-weight: 600; font-size: .9rem; color: var(--text-primary); }
.demo-doc-card .doc-type { font-size: .78rem; color: var(--text-muted); }

/* ── Paneles de resultado ────────────────────────────────────── */
.result-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  overflow: hidden;
  height: 100%;
}
.result-panel .panel-header {
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border-color);
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: .88rem;
  color: var(--text-primary);
}
.result-panel .panel-header i { color: var(--primary); font-size: 1rem; }
.result-panel .panel-body { padding: 1.25rem; }

/* Texto extraído scrollable */
.extracted-text-box {
  max-height: 220px;
  overflow-y: auto;
  font-size: .82rem;
  font-family: 'Courier New', monospace;
  background: var(--bg-surface-2);
  border-radius: 8px;
  padding: 12px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border-color);
}

/* Tipo detectado — badge grande */
.doc-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,102,204,.1);
  color: var(--primary);
  border-radius: 50px;
  padding: 8px 20px;
  font-weight: 700;
  font-size: .95rem;
}
.confidence-bar { height: 8px; border-radius: 4px; background: var(--bg-surface-3); margin-top: 8px; }
.confidence-fill { height: 100%; border-radius: 4px; background: var(--primary); transition: width .6s ease; }

/* Tabla de campos */
.fields-table { width: 100%; font-size: .85rem; }
.fields-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-color); vertical-align: top; }
.fields-table td:first-child { font-weight: 600; color: var(--text-muted); width: 45%; }
.fields-table td:last-child { color: var(--text-primary); }
.fields-table tr:last-child td { border-bottom: none; }

/* Validaciones */
.validation-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: .85rem;
}
.validation-item:last-child { border-bottom: none; }
.val-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.val-pass    .val-icon { color: #28a745; }
.val-warning .val-icon { color: #ffc107; }
.val-fail    .val-icon { color: #dc3545; }
.val-rule    { font-weight: 600; color: var(--text-primary); }
.val-detail  { color: var(--text-muted); font-size: .8rem; }

/* Hallazgos */
.finding-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  font-size: .85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}
.finding-item:last-child { border-bottom: none; }
.finding-item i { color: #ffc107; flex-shrink: 0; margin-top: 2px; }

/* Próximo paso recomendado */
.next-action-card {
  border-radius: 14px;
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.next-action-card.priority-alta    { background: rgba(220,53,69,.08);  border: 1px solid rgba(220,53,69,.25); }
.next-action-card.priority-media   { background: rgba(255,193,7,.08);  border: 1px solid rgba(255,193,7,.25); }
.next-action-card.priority-baja    { background: rgba(40,167,69,.08);  border: 1px solid rgba(40,167,69,.25); }
.next-action-card .action-icon     { font-size: 2rem; flex-shrink: 0; }
.next-action-card .action-title    { font-weight: 700; font-size: 1rem; color: var(--text-primary); }
.next-action-card .action-reason   { font-size: .88rem; color: var(--text-muted); margin-top: 4px; }
.priority-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 700;
  margin-top: 6px;
}
.priority-alta  .priority-badge { background: rgba(220,53,69,.15);  color: #dc3545; }
.priority-media .priority-badge { background: rgba(255,193,7,.15);  color: #856404; }
.priority-baja  .priority-badge { background: rgba(40,167,69,.15);  color: #155724; }

/* ── Progress steps ──────────────────────────────────────────── */
.analysis-progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
}
.progress-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .9rem;
  color: var(--text-muted);
  transition: color .3s;
}
.progress-step.active  { color: var(--primary); font-weight: 600; }
.progress-step.done    { color: var(--accent-dark); }
.progress-step .step-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--border-color);
  flex-shrink: 0;
  transition: background .3s;
}
.progress-step.active .step-dot { background: var(--primary); }
.progress-step.done   .step-dot { background: var(--accent); }

/* ── Landing page ────────────────────────────────────────────── */
.flow-step-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 24px 20px;
  text-align: center;
  position: relative;
  transition: all .25s;
  height: 100%;
}
.flow-step-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary-light); }
.flow-step-number {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 800;
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.flow-step-icon { font-size: 2rem; margin-bottom: 10px; color: var(--primary); }
.flow-step-title { font-weight: 700; font-size: .95rem; color: var(--text-primary); margin-bottom: 6px; }
.flow-step-desc  { font-size: .83rem; color: var(--text-muted); }

.aws-service-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  transition: all .25s;
  height: 100%;
}
.aws-service-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #FF9900; }
.aws-logo { font-size: 2.2rem; margin-bottom: 10px; }
.aws-service-name { font-weight: 700; font-size: .9rem; color: var(--text-primary); margin-bottom: 4px; }
.aws-service-role { font-size: .8rem; color: var(--text-muted); }

.doc-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 50px;
  padding: 8px 16px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 4px;
  transition: all .2s;
}
.doc-type-chip:hover { border-color: var(--primary); color: var(--primary); background: rgba(0,102,204,.05); }

/* ── Responsive ──────────────────────────────────────────────── */
/* Prevent horizontal scroll globally */
html, body { overflow-x: hidden; max-width: 100%; }
.content-area, .main-content { overflow-x: hidden; max-width: 100%; }
.result-panel { overflow: hidden; min-width: 0; }
.extracted-text-box { word-break: break-word; overflow-wrap: break-word; white-space: pre-wrap; }
/* JSON viewer: scrollable horizontally inside its box, never overflows parent */
.panel-body.p-0 { overflow: hidden; }
pre[id="jsonViewer"], pre.json-viewer {
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
  box-sizing: border-box;
  word-break: normal;
}
.fields-table { width: 100%; table-layout: fixed; word-break: break-word; }
.fields-table td:first-child { width: 40%; }
.filters-bar { flex-wrap: wrap; }
.filters-bar input, .filters-bar select { min-width: 0; }
/* Ensure Bootstrap rows don't overflow */
.row { --bs-gutter-x: 1.5rem; margin-right: 0; margin-left: 0; }
.row > * { min-width: 0; }

@media (max-width: 768px) {
  .result-grid { grid-template-columns: 1fr !important; }
  .doc-drop-zone { padding: 2rem 1rem; }
  /* Stack ALL col-md-* panels on mobile */
  .row.g-3 > [class*="col-md-"],
  .row.g-4 > [class*="col-md-"],
  .row.mb-3 > [class*="col-md-"],
  .row.mb-4 > [class*="col-md-"] {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
  }
  /* Topbar title truncation */
  .topbar h2 { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
  /* JSON viewer scrollable */
  pre[id="jsonViewer"], pre.json-viewer { font-size: .7rem; max-height: 260px; }
  /* Stat cards */
  .stat-card { padding: .8rem 1rem; }
  .stat-value { font-size: 1.4rem; }
  /* Filters stack */
  .filters-bar { gap: .5rem; }
  .filters-bar input, .filters-bar select { width: 100% !important; max-width: 100% !important; }
  /* Landing */
  .lp-section { padding: 48px 0; }
  .arch-flow { flex-direction: column; }
  .arch-arrow { transform: rotate(90deg); }
  /* Breadcrumb doc info */
  #docNameDisplay { font-size: .85rem; }
  #docKeyDisplay { font-size: .72rem; word-break: break-all; }
  /* Tables scrollable on mobile */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Next action card */
  .next-action-card { flex-direction: column; }
  /* Topbar actions */
  .topbar-actions { gap: .4rem; }
  .topbar-actions .search-box { display: none; }
}

/* ── Landing page shared styles ─────────────────────────────── */
.lp-label {
  display: inline-block;
  background: rgba(0,102,204,.1);
  color: var(--primary);
  border-radius: 50px;
  padding: 4px 14px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.lp-label-green { background: rgba(8,189,186,.12); color: #0d9488; }

.lp-section { padding: 80px 0; }
.lp-section-title { font-size: clamp(1.6rem,3vw,2.2rem); font-weight: 800; color: var(--text-primary); line-height: 1.2; margin-bottom: 12px; }
.lp-section-subtitle { font-size: 1rem; color: var(--text-muted); max-width: 540px; }

.lp-hero-visual {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 1.75rem;
}

.lp-cta-section {
  background: linear-gradient(135deg, var(--primary-dark,#000024) 0%, var(--primary,#0066cc) 100%);
  color: white;
  padding: 80px 0;
  text-align: center;
}
.lp-cta-section .lp-section-title { color: white; }
.lp-cta-section .lp-section-subtitle { color: rgba(255,255,255,.75); }

.btn-hero-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: white; color: var(--primary);
  padding: 12px 28px; border-radius: 50px;
  font-weight: 700; font-size: .95rem;
  text-decoration: none; transition: all .2s;
  border: none;
}
.btn-hero-primary:hover { background: #f0f9ff; color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.2); }

.btn-hero-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: white;
  padding: 12px 28px; border-radius: 50px;
  font-weight: 600; font-size: .95rem;
  text-decoration: none; transition: all .2s;
  border: 2px solid rgba(255,255,255,.4);
}
.btn-hero-secondary:hover { border-color: white; color: white; background: rgba(255,255,255,.1); }

.pain-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.5rem;
  height: 100%;
  transition: all .25s;
}
.pain-card:hover { border-color: #ef4444; box-shadow: 0 4px 20px rgba(239,68,68,.1); }
.pain-icon { font-size: 2rem; margin-bottom: .75rem; }
.pain-card h5 { font-weight: 700; font-size: .95rem; margin-bottom: .4rem; }
.pain-card p { font-size: .85rem; color: var(--text-muted); margin: 0; }

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 2rem;
  text-align: center;
  height: 100%;
}
.metric-number { font-size: 3rem; font-weight: 900; line-height: 1; margin-bottom: .5rem; }
.metric-label { font-size: .9rem; color: var(--text-muted); }

.site-footer {
  background: #000024;
  color: rgba(255,255,255,.6);
  padding: 2rem 0;
  text-align: center;
  font-size: .85rem;
}
