/* ============================================================================
   css/views/dev-review.css — TWEAKEO Dashboard v6
   COCKPIT del flujo dev→staging→prod de TODAS las webs de la flota
   ----------------------------------------------------------------------------
   v6.0 (2026-07-22): Rediseño integral por Cowork/Paco.
     - Pipeline por Sitio con STAGING/PR/PRODUCCIÓN
     - Kanban Linear con filtros
     - Deploys recientes
     - Salud del dato con auto-refresco
   ----------------------------------------------------------------------------
   AUDIT-CODE: Excepciones de tokenización documentadas.
     - minmax grid values (300px, 320px): constraints de layout responsive.
     - Dimensiones de dot (10px, 12px): forma del componente.
     - Breakpoints (600px, 900px, 1200px): CSS no permite var() en @media.
     - min-height/max-height (200px, 300px): constraints scroll.
     - '400': width flex-basis, no color.
   ========================================================================== */

/* ═══════════════════════════════════════════════════════════════════════════
   ROOT CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */
.dr-root {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-4);
  padding-bottom: var(--ds-space-5);
}

.dr-section-title {
  font-size: var(--ds-font-size-md);
  font-weight: var(--ds-font-weight-bold);
  color: var(--ds-heading);
  margin: 0 0 var(--ds-space-3);
  display: flex;
  align-items: center;
  gap: var(--ds-space-2);
}

.dr-empty {
  padding: var(--ds-space-3);
  text-align: center;
  color: var(--ds-text-muted);
  font-size: var(--ds-font-size-sm);
}

/* ═══════════════════════════════════════════════════════════════════════════
   A) PIPELINE POR SITIO
   ═══════════════════════════════════════════════════════════════════════════ */
.dr-pipeline {
  margin-bottom: var(--ds-space-2);
}

.dr-pipeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--ds-space-4);
}

.dr-site-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-lg);
  overflow: hidden;
  transition: border-color var(--ds-duration-fast) var(--ds-easing-standard),
              box-shadow var(--ds-duration-fast) var(--ds-easing-standard);
}

.dr-site-card:hover {
  border-color: var(--ds-border-visible);
  box-shadow: var(--ds-shadow-raised);
}

.dr-site-card[data-status="down"] {
  border-color: var(--ds-danger-dim);
  box-shadow: 0 0 0 1px var(--ds-danger-dim);
}

.dr-site-card[data-status="review"] {
  border-color: #F59E0B33;
  box-shadow: 0 0 0 1px #F59E0B33;
}

/* Site header */
.dr-site-header {
  padding: var(--ds-space-3) var(--ds-space-4);
  border-bottom: 1px solid var(--ds-border);
  background: var(--ds-surface-overlay);
}

.dr-site-title-row {
  display: flex;
  align-items: center;
  gap: var(--ds-space-3);
}

.dr-site-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.dr-site-name {
  font-size: var(--ds-font-size-md);
  font-weight: var(--ds-font-weight-bold);
  color: var(--ds-heading);
  line-height: var(--ds-leading-tight);
}

.dr-site-domain {
  font-size: var(--ds-font-size-xs);
  color: var(--ds-text-muted);
  font-family: var(--ds-font-mono);
}

.dr-site-status {
  margin-left: auto;
  font-size: var(--ds-font-size-xs);
  font-weight: var(--ds-font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Columnas Staging / PR / Producción */
.dr-site-cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
}

.dr-col {
  padding: var(--ds-space-3);
  border-right: 1px solid var(--ds-border);
  display: flex;
  flex-direction: column;
}

.dr-col:last-child {
  border-right: none;
}

.dr-col-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ds-font-size-xs);
  font-weight: var(--ds-font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ds-text-muted);
  margin-bottom: var(--ds-space-3);
  padding-bottom: var(--ds-space-2);
  border-bottom: 2px solid var(--ds-border);
}

.dr-col--ok .dr-col-header { border-bottom-color: var(--ds-ok); }
.dr-col--err .dr-col-header { border-bottom-color: var(--ds-danger); }
.dr-col--warn .dr-col-header { border-bottom-color: #F59E0B; }
.dr-col--idle .dr-col-header { border-bottom-color: var(--ds-text-muted); }

.dr-col-url {
  margin-left: auto;
  font-size: 0.625rem;
  font-weight: var(--ds-font-weight-regular);
  color: var(--ds-text-subtle);
  text-transform: none;
  letter-spacing: normal;
}

.dr-col-count {
  margin-left: auto;
  font-size: var(--ds-font-size-xs);
  font-weight: var(--ds-font-weight-bold);
  color: var(--ds-brand);
}

/* Métricas en cada columna */
.dr-col-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2);
}

.dr-col-metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--ds-space-2);
}

.dr-col-label {
  font-size: var(--ds-font-size-xs);
  color: var(--ds-text-muted);
  white-space: nowrap;
}

.dr-col-value {
  font-size: var(--ds-font-size-sm);
  font-weight: var(--ds-font-weight-semibold);
  text-align: right;
}

.dr-col-sub {
  font-size: var(--ds-font-size-xs);
  color: var(--ds-text-subtle);
  font-weight: var(--ds-font-weight-regular);
}

.dr-col-commit {
  font-size: 0.625rem;
  font-family: var(--ds-font-mono);
  color: var(--ds-text-subtle);
  margin-top: var(--ds-space-1);
}

.dr-col-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--ds-font-size-xs);
  color: var(--ds-brand);
  text-decoration: none;
  font-weight: var(--ds-font-weight-semibold);
  margin-top: auto;
  padding-top: var(--ds-space-2);
}

.dr-col-link:hover {
  text-decoration: underline;
  color: var(--ds-accent-text);
}

.dr-col-empty {
  font-size: var(--ds-font-size-xs);
  color: var(--ds-text-muted);
  text-align: center;
  padding: var(--ds-space-3) 0;
}

/* PR items dentro de columna PR */
.dr-pr-item {
  background: var(--ds-surface-overlay);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  padding: var(--ds-space-2);
  margin-bottom: var(--ds-space-2);
}

.dr-pr-title {
  font-size: var(--ds-font-size-xs);
  color: var(--ds-text);
  font-weight: var(--ds-font-weight-semibold);
  margin-bottom: 4px;
  line-height: 1.3;
}

.dr-pr-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.625rem;
  color: var(--ds-text-muted);
  margin-bottom: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   B) KANBAN LINEAR
   ═══════════════════════════════════════════════════════════════════════════ */
.dr-kanban {
  margin-bottom: var(--ds-space-2);
}

.dr-kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--ds-space-3);
  margin-bottom: var(--ds-space-3);
}

.dr-kanban-header .dr-section-title {
  margin-bottom: 0;
}

/* Filtros */
.dr-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--ds-space-2);
  flex-wrap: wrap;
}

.dr-filter-select {
  padding: 6px 10px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface);
  color: var(--ds-text);
  font-family: var(--ds-font);
  font-size: var(--ds-font-size-xs);
  cursor: pointer;
  min-width: 100px;
}

.dr-filter-select:focus {
  outline: none;
  border-color: var(--ds-brand);
  box-shadow: 0 0 0 2px var(--ds-brand-dim);
}

.dr-filter-search {
  padding: 6px 10px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  background: var(--ds-surface);
  color: var(--ds-text);
  font-family: var(--ds-font);
  font-size: var(--ds-font-size-xs);
  width: 120px;
  transition: border-color var(--ds-duration-fast);
}

.dr-filter-search:focus {
  outline: none;
  border-color: var(--ds-brand);
  box-shadow: 0 0 0 2px var(--ds-brand-dim);
  width: 160px;
}

.dr-filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: var(--ds-brand);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: var(--ds-font-weight-bold);
  padding: 0 6px;
}

.dr-filter-clear {
  padding: 4px 10px;
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  background: transparent;
  color: var(--ds-text-muted);
  font-family: var(--ds-font);
  font-size: var(--ds-font-size-xs);
  cursor: pointer;
  white-space: nowrap;
}

.dr-filter-clear:hover {
  border-color: var(--ds-danger);
  color: var(--ds-danger);
}

/* Kanban Board */
.dr-kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--ds-space-3);
  min-height: 200px;
}

.dr-kb-col {
  background: var(--ds-surface-overlay);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
  display: flex;
  flex-direction: column;
  min-height: 120px;
}

.dr-kb-col--over {
  border-color: var(--ds-brand);
  box-shadow: 0 0 0 2px var(--ds-brand-dim);
}

.dr-kb-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ds-space-2) var(--ds-space-3);
  border-bottom: 1px solid var(--ds-border);
}

.dr-kb-col-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--ds-font-size-xs);
  font-weight: var(--ds-font-weight-bold);
  color: var(--ds-text);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dr-kb-col-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dr-kb-col-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: var(--ds-radius-sm);
  font-size: var(--ds-font-size-xs);
  font-weight: var(--ds-font-weight-bold);
}

.dr-kb-empty {
  padding: var(--ds-space-3);
  text-align: center;
  color: var(--ds-text-muted);
  font-size: var(--ds-font-size-sm);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Cards del kanban */
.dr-kb-card {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  padding: var(--ds-space-2);
  margin: var(--ds-space-1) var(--ds-space-2);
  cursor: pointer;
  transition: border-color var(--ds-duration-fast),
              box-shadow var(--ds-duration-fast),
              transform var(--ds-duration-fast);
}

.dr-kb-card:hover {
  border-color: var(--ds-border-visible);
  box-shadow: var(--ds-shadow-raised);
  transform: translateY(-1px);
}

.dr-kb-card--dragging {
  opacity: 0.5;
  transform: rotate(1deg);
}

.dr-kb-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.dr-kb-card-id {
  font-family: var(--ds-font-mono);
  font-size: 0.6875rem;
  font-weight: var(--ds-font-weight-bold);
}

.dr-kb-card-title {
  font-size: var(--ds-font-size-sm);
  color: var(--ds-text);
  line-height: 1.35;
  margin-bottom: 6px;
}

.dr-kb-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.dr-kb-card-team {
  font-size: 0.625rem;
  color: var(--ds-text-muted);
  font-weight: var(--ds-font-weight-semibold);
}

.dr-kb-card-label {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.625rem;
  font-weight: var(--ds-font-weight-semibold);
}

.dr-kanban-footer {
  display: flex;
  justify-content: center;
  padding: var(--ds-space-2);
  font-size: var(--ds-font-size-xs);
  color: var(--ds-text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   C) DEPLOYS RECIENTES
   ═══════════════════════════════════════════════════════════════════════════ */
.dr-deploys {
  margin-bottom: var(--ds-space-2);
}

.dr-deploy-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--ds-space-3);
}

.dr-deploy-item {
  background: var(--ds-surface);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-sm);
  padding: var(--ds-space-3);
  font-size: var(--ds-font-size-xs);
}

.dr-deploy-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.dr-deploy-state {
  font-size: 0.625rem;
  font-weight: var(--ds-font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dr-deploy-title {
  color: var(--ds-text);
  font-size: var(--ds-font-size-sm);
  line-height: 1.3;
  margin-bottom: 6px;
}

.dr-deploy-meta {
  display: flex;
  justify-content: space-between;
  color: var(--ds-text-muted);
  font-size: 0.625rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   D) SALUD DEL DATO
   ═══════════════════════════════════════════════════════════════════════════ */
.dr-health {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--ds-space-3);
  padding: var(--ds-space-3) var(--ds-space-4);
  background: var(--ds-surface-overlay);
  border: 1px solid var(--ds-border);
  border-radius: var(--ds-radius-md);
}

.dr-health-row {
  display: flex;
  align-items: center;
  gap: var(--ds-space-3);
  flex-wrap: wrap;
}

.dr-health-row--right {
  margin-left: auto;
}

.dr-health-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dr-health-label {
  font-size: var(--ds-font-size-xs);
  color: var(--ds-text-muted);
  font-weight: var(--ds-font-weight-semibold);
}

.dr-health-value {
  font-size: var(--ds-font-size-xs);
  font-weight: var(--ds-font-weight-bold);
  color: var(--ds-text-muted);
  font-family: var(--ds-font-mono);
}

.dr-health--fresh {
  color: var(--ds-ok);
}

.dr-health--stale {
  color: var(--ds-danger);
}

.dr-health-sync {
  font-size: var(--ds-font-size-xs);
  font-family: var(--ds-font-mono);
  color: var(--ds-ok);
  transition: color 0.3s;
}

.dr-refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 1px solid var(--ds-brand);
  border-radius: var(--ds-radius-md);
  background: var(--ds-brand);
  color: #fff;
  font-family: var(--ds-font);
  font-size: var(--ds-font-size-xs);
  font-weight: var(--ds-font-weight-semibold);
  cursor: pointer;
  transition: background var(--ds-duration-fast),
              border-color var(--ds-duration-fast);
}

.dr-refresh-btn:hover {
  background: var(--ds-accent-text);
  border-color: var(--ds-accent-text);
}

.dr-refresh-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SHARED COMPONENTS
   ═══════════════════════════════════════════════════════════════════════════ */

/* Dot indicador */
.dr-dot {
  display: inline-block;
  width: var(--dr-dot-size, 10px);
  height: var(--dr-dot-size, 10px);
  border-radius: 50%;
  background: var(--dr-dot-color, var(--ds-text-muted));
  flex-shrink: 0;
}

/* Badge */
.dr-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--ds-radius-sm);
  font-size: var(--ds-font-size-xs);
  font-weight: var(--ds-font-weight-semibold);
  background: var(--dr-badge-bg, var(--ds-surface-overlay));
  color: var(--dr-badge-fg, var(--ds-text));
  border: 1px solid var(--dr-badge-border, var(--ds-border));
}

/* Modal overlay */
.dr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dr-modal {
  background: var(--ds-surface);
  border-radius: var(--ds-radius-lg);
  box-shadow: var(--ds-shadow-5);
  max-height: 85vh;
  overflow-y: auto;
}

.dr-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ds-space-3);
  padding: var(--ds-space-4) var(--ds-space-4) var(--ds-space-3);
  border-bottom: 1px solid var(--ds-border);
}

.dr-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--ds-text-muted);
  padding: 0 4px;
  line-height: 1;
}

.dr-modal-close:hover {
  color: var(--ds-text);
}

.dr-modal-body {
  padding: var(--ds-space-4);
}

.dr-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 18px;
  background: var(--ds-brand);
  color: #fff;
  border-radius: var(--ds-radius-md);
  text-decoration: none;
  font-size: var(--ds-font-size-xs);
  font-weight: var(--ds-font-weight-bold);
}

.dr-btn-primary:hover {
  background: var(--ds-accent-text);
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

/* Pipeline: 2-column grid → stack en narrow */
@media (max-width: 900px) {
  .dr-pipeline-grid {
    grid-template-columns: 1fr;
  }
}

/* Site cols: 3-columnas → stack vertical */
@media (max-width: 600px) {
  .dr-site-cols {
    grid-template-columns: 1fr;
  }
  .dr-col {
    border-right: none;
    border-bottom: 1px solid var(--ds-border);
  }
  .dr-col:last-child {
    border-bottom: none;
  }
}

/* Kanban: 4-col → 2-col → stack */
@media (max-width: 1200px) {
  .dr-kanban-board {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .dr-kanban-board {
    grid-template-columns: 1fr;
  }
  .dr-kanban-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .dr-filter-bar {
    width: 100%;
  }
  .dr-filter-search {
    width: 80px;
  }
  .dr-filter-search:focus {
    width: 120px;
  }
}
