:root { --bg:#F5F3F1; --panel:#FFFFFF; --text:#0f172a; --muted:#475569; --border:#e6e6e6; --accent:#dc2626; --ok:#16a34a; }
/* Ensure padding and borders are included in element widths to avoid overlap */
*, *::before, *::after { box-sizing: border-box; }
body { margin:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans,
                 Helvetica Neue, Arial, "Apple Color Emoji", "Segoe UI Emoji"; background: var(--bg); color: var(--text); }
.brandbar { display:flex; align-items:center; padding: 12px 24px; }
.brandbar img { width: 4cm; height: auto; display:block; }
.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
h1 { margin: 0 0 12px; font-size: 22px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid.grid-equal { align-items: stretch; }
.grid.grid-equal > .card { height: 100%; display: flex; flex-direction: column; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display:flex; gap:8px; align-items:center; }
input[type=file] { padding: 10px; border: 1px dashed var(--border); background: transparent; border-radius: 8px; color:var(--text); width:100%; }
button { background: #1f2b53; border:1px solid var(--border); color:#ffffff; padding: 10px 14px; border-radius: 8px; cursor: pointer; }
button:hover { background:#243261; }
/* Lista compacta estilo explorador de archivos */
.uploads-panel { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; }
.uploads-panel .file-card { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  padding: 8px 10px; 
  border-radius: 6px; 
  background: transparent;
  border: none;
  transition: background 0.15s ease;
}
.uploads-panel .file-card:hover { background: rgba(31, 43, 83, 0.04); }
.uploads-panel .file-name { font-size: 13px; color:var(--text); margin: 0; word-break: break-word; flex: 1; }
.uploads-panel .file-icon { 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}
/* Estilos generales para file-card (preview de descripción y resultados) */
.file-card { 
  background: var(--panel); 
  border: 1px solid var(--border); 
  border-radius: 12px; 
  padding: 12px; 
}
.sep { height:1px; background: var(--border); margin: 16px 0; }
.status { font-size: 13px; min-height: 18px; }
.ok { color: var(--ok); }
.err { color: var(--accent); }

/* Timer de procesamiento JD */
.jd-timer-wrap, .cv-timer-wrap {
  margin-top: 12px;
  padding: 12px;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 4px;
  text-align: center;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.3s ease;
}
.jd-timer-wrap.visible, .cv-timer-wrap.visible {
  opacity: 1;
  max-height: 100px;
}
.jd-timer-label, .cv-timer-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.jd-timer-display, .cv-timer-display {
  font-size: 28px;
  font-weight: 700;
  color: #3b82f6;
  font-family: 'Courier New', monospace;
}
.upload-summary { font-size: 12px; padding: 6px 8px; border-radius: 4px; background: rgba(59, 130, 246, 0.08); color: var(--text); }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

/* Textarea de Descripción: tamaño fijo y sin resize */
#jd-text {
    width: 100%;
    min-height: 220px;
    max-height: 220px;
    resize: none;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    /* Prevent the textarea from exceeding its grid column width */
    box-sizing: border-box;
}

/* Preview del resumen: igual altura que el textarea */
#jd-preview { min-height: 220px; }

/* Resultados múltiples del análisis */
.results-list { display: flex; flex-direction: column; gap: 12px; }
.analysis-item { border: 1px solid var(--border); border-radius: 10px; background: rgba(15, 23, 42, 0.02); }
.analysis-item-header { 
  display: flex; 
  align-items: center; 
  gap: 8px; 
  padding: 12px; 
  cursor: pointer;
  user-select: none;
}
.analysis-item-header:hover { background: rgba(15, 23, 42, 0.04); border-radius: 10px; }
.analysis-item-chevron { 
  width: 20px; 
  height: 20px; 
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.analysis-item-chevron.expanded { transform: rotate(180deg); }
.analysis-item-title { font-weight: 400; font-size: 13px; color: var(--muted); flex: 1; margin: 0; }
.analysis-item-score { font-size: 16px; font-weight: 600; color: #059669; flex-shrink: 0; min-width: 40px; text-align: right; }
.analysis-item-status { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.analysis-item-body { 
  padding: 0 12px 12px 12px; 
  display: none;
}
.analysis-item-body.expanded { display: block; }
.analysis-item-text { white-space: pre-wrap; font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5; }

/* Estilos para análisis detallado con criterios */
.analysis-detailed {
  padding: 8px 0;
}

.analysis-header {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.analysis-header h3 {
  color: var(--text);
  margin: 0 0 4px;
}

.analysis-summary {
  margin: 8px 0;
  padding: 10px 12px;
  background: #f0f9ff;
  border-left: 3px solid #0284c7;
  border-radius: 4px;
  font-size: 13px;
  color: #0c4a6e;
  line-height: 1.5;
}

.analysis-criteria {
  margin-top: 12px;
}

.criterion-item {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
}

.criterion-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.criterion-item > div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.criterion-item > div:first-child > span:first-child {
  font-weight: 600;
  font-size: 13px;
  color: #1f2937;
}

.criterion-score {
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  margin-left: 8px;
}

.criterion-score.high {
  background: #dbeafe;
  color: #0c4a6e;
}

.criterion-score.medium {
  background: #fed7aa;
  color: #7c2d12;
}

.criterion-score.low {
  background: #fee2e2;
  color: #7f1d1d;
}

.criterion-item > div:last-child {
  font-size: 13px;
  color: #4b5563;
  line-height: 1.5;
  margin-top: 4px;
}
