/* /console/css/ai-progress.css
   AI Progress Report page styles
   Works with: /console/ai-progress.html + /console/js/ai-progress.js
*/

/* ------------------------------
   Base (safe defaults)
------------------------------ */
:root{
  /* These should already exist in shell.css; these are fallbacks */
  --card: #fff;
  --muted: rgba(15,23,42,.62);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);

  --line: rgba(229,231,235,1);
  --line-soft: rgba(226,232,240,.9);

  --focus: rgba(99,102,241,.55);
  --focus-ring: rgba(99,102,241,.12);
}

*{ box-sizing: border-box; }

.page{
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 14px;
}

.card{
  background: var(--card, #fff);
  border: 1px solid rgba(229,231,235,.9);
  border-radius: 14px;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.06));
  padding: 16px;
}

.panelTitle{
  font-weight: 900;
  font-size: 14px;
  margin: 0 0 10px;
}

/* ------------------------------
   Form controls
------------------------------ */
.row{ margin-bottom: 10px; }

.lbl{
  display:block;
  font-size: 12px;
  color: var(--muted, #6b7280);
  margin: 0 0 6px;
}

.inp{
  width: 100%;
  padding: 10px 10px;
  border: 1px solid var(--line, rgba(229,231,235,1));
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}

.inp:focus{
  border-color: var(--focus, rgba(99,102,241,.55));
  box-shadow: 0 0 0 3px var(--focus-ring, rgba(99,102,241,.12));
}

.inp:disabled,
.inp[aria-disabled="true"]{
  opacity: .75;
  cursor: not-allowed;
  background: rgba(249,250,251,1);
}

/* select arrow spacing consistency */
select.inp{
  padding-right: 36px;
}

.grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sep{
  border: none;
  border-top: 1px solid var(--line, rgba(229,231,235,1));
  margin: 12px 0;
}

/* GroupKey input + button row */
.groupKeyRow{
  display:flex;
  gap: 8px;
  align-items: center;
}

.groupKeyRow .inp{
  flex: 1 1 auto;
  min-width: 0;
}

/* help/meta small lines */
.small{ font-size: 12px; }
.muted{ color: var(--muted, #6b7280); }
.hint{ margin-top: 10px; }
.mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* ------------------------------
   Actions + status message
------------------------------ */
.actions{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.actions .btn{
  white-space: nowrap;
}

.msg{
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted, #6b7280);
  min-height: 18px;
  word-break: break-word;
}

/* Optional: if ai-progress.js sets classes for message types */
.msg.is-ok{ color: rgba(22,163,74,.95); }
.msg.is-warn{ color: rgba(245,158,11,.95); }
.msg.is-bad{ color: rgba(239,68,68,.95); }

/* ------------------------------
   KPIs
------------------------------ */
.kpis{
  margin-top: 12px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.kpi{
  border: 1px solid var(--line, rgba(229,231,235,1));
  border-radius: 12px;
  padding: 10px;
  background: rgba(249,250,251,.35);
}

.kpi .k{
  font-size: 12px;
  color: var(--muted, #6b7280);
}

.kpi .v{
  font-size: 18px;
  font-weight: 950;
  margin-top: 4px;
  letter-spacing: -0.2px;
}

/* ------------------------------
   Utilities
------------------------------ */
.box{
  border: 1px solid var(--line, rgba(229,231,235,1));
  border-radius: 10px;
  padding: 10px;
  background: rgba(249,250,251,1);
}

/* ------------------------------
   Right panel: Preview behavior
------------------------------ */
.panelRight{
  min-width: 0; /* critical for overflow handling in grid */
}

.reportOut{
  padding: 8px 2px;
  min-height: 280px;
}

.empty{
  padding: 14px;
  border: 1px dashed var(--line, rgba(229,231,235,1));
  border-radius: 12px;
  color: var(--muted, #6b7280);
  font-size: 13px;
}

/* ------------------------------
   Report (generated HTML) styling
------------------------------ */
.rWrap{ padding: 2px; }

.rHeader{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.rTitle{
  font-size: 18px;
  font-weight: 950;
  letter-spacing: -0.2px;
}

.rSub{
  font-size: 12px;
  color: var(--muted, #6b7280);
  margin-top: 4px;
}

.rBadges{
  display:flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line, rgba(229,231,235,1));
  background: rgba(249,250,251,1);
  font-size: 12px;
}

.badge-good{ border-color: rgba(16,185,129,.35); background: rgba(16,185,129,.10); }
.badge-warn{ border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.10); }
.badge-bad{  border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.10); }

.rSection{
  margin-top: 12px;
  border: 1px solid var(--line, rgba(229,231,235,1));
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.rSectionTitle{
  font-weight: 900;
  font-size: 13px;
  margin: 0 0 10px;
}

/* Table */
.rTableWrap{
  overflow: auto;
  border-radius: 10px;
  border: 1px solid var(--line, rgba(229,231,235,1));
}

.rTable{
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

.rTable th,
.rTable td{
  border-top: 1px solid var(--line, rgba(229,231,235,1));
  padding: 10px;
  font-size: 12px;
  vertical-align: top;
  background: #fff;
}

.rTable thead th{
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-weight: 900;
  background: rgba(249,250,251,1);
  border-top: none;
}

/* nicer first row */
.rTable tbody tr:first-child td{ border-top: none; }

.tTitle{ font-weight: 900; font-size: 12px; }
.tMeta{ margin-top: 4px; color: var(--muted, #6b7280); font-size: 12px; }
.tNote{ margin-top: 6px; white-space: pre-wrap; word-break: break-word; }

.ul{ margin: 6px 0 0 16px; padding: 0; }
.ul li{ margin: 4px 0; }

/* ------------------------------
   PDF helper (ai-progress.js toggles this)
------------------------------ */
.pdf-hide{ display:none !important; }

/* When printing, keep it clean */
@media print{
  .pdf-hide{ display:none !important; }
  .page{ max-width: none; padding: 0; grid-template-columns: 1fr; }
  .card{ box-shadow: none; }
  .rTableWrap{ overflow: visible; }
  .rTable{ min-width: 0; }
}

/* ------------------------------
   Responsive
------------------------------ */
@media (max-width: 980px){
  .page{ grid-template-columns: 1fr; }

  .groupKeyRow{
    flex-direction: column;
    align-items: stretch;
  }

  .rHeader{
    flex-direction: column;
    align-items: flex-start;
  }

  .rBadges{
    justify-content: flex-start;
  }
}

/* ------------------------------
   Reduced motion
------------------------------ */
@media (prefers-reduced-motion: reduce){
  .inp{ transition: none; }
}