/* ══════════════════════════════════════════════════════
   PRODUCTIVIDAD.CSS · Puerto de Chancay
══════════════════════════════════════════════════════ */

/* ── PERIOD SELECTOR ── */
.period-selector {
  display: flex;
  background: var(--gris-fondo);
  border: 1px solid var(--gris-borde);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.period-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--fuente);
  color: var(--gris-texto);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.period-btn:hover  { color: var(--texto-main); background: rgba(0,0,0,0.04); }
.period-btn.active {
  background: var(--blanco);
  color: var(--azul-medio);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* ── TEAM SELECTOR BAR ── */
.team-selector-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 4px;
  flex-wrap: wrap;
}

.team-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--blanco);
  border: 1.5px solid var(--gris-borde);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 200px;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.team-tab:hover {
  border-color: rgba(24,95,165,0.25);
  box-shadow: 0 4px 14px rgba(0,0,0,0.07);
  transform: translateY(-1px);
}
.team-tab.active {
  border-color: var(--tab-color, var(--azul-medio));
  background: var(--tab-bg, rgba(24,95,165,0.04));
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.team-tab-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.team-tab-info  { flex: 1; min-width: 0; }
.team-tab-name  {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--texto-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team-tab-meta  {
  display: block;
  font-size: 11px;
  color: var(--gris-texto);
  margin-top: 2px;
}
.team-tab-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gris-borde);
  border-radius: 0 0 14px 14px;
}
.team-tab-fill {
  height: 100%;
  border-radius: 0 0 14px 14px;
  transition: width 0.4s ease;
}

/* ── LAYOUT PRINCIPAL ── */
.prod-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
  align-items: start;
}
.prod-main { display: flex; flex-direction: column; gap: 20px; }
.prod-side  { display: flex; flex-direction: column; gap: 20px; }

/* ── CARD HELPERS ── */
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--gris-borde);
  gap: 12px;
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--texto-main);
}
.card-sub {
  font-size: 12px;
  color: var(--gris-texto);
  margin-top: 2px;
}
.card-body { padding: 16px 20px; }

.mt-20 { margin-top: 20px; }

/* ── TEAM SUMMARY CARD ── */
.team-summary-card {
  background: var(--blanco);
  border: 1px solid var(--gris-borde);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.summary-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--gris-borde);
}
.summary-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.summary-info  { flex: 1; min-width: 0; }
.summary-name  {
  font-size: 17px;
  font-weight: 700;
  color: var(--texto-main);
  margin: 0 0 3px;
}
.summary-desc  {
  font-size: 12.5px;
  color: var(--gris-texto);
  margin: 0;
}
.eficiencia-badge {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.summary-metrics {
  display: flex;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--gris-borde);
}
.metric-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}
.metric-val {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}
.metric-lbl {
  font-size: 11px;
  color: var(--gris-texto);
  font-weight: 500;
}
.metric-sep {
  width: 1px;
  height: 36px;
  background: var(--gris-borde);
  flex-shrink: 0;
}

.summary-progress { padding: 16px 22px; }
.progress-header  {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.progress-label { font-size: 12px; color: var(--gris-texto); font-weight: 500; }
.progress-pct   { font-size: 13px; font-weight: 700; }
.progress-track {
  height: 8px;
  background: var(--gris-borde);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}

/* ── BAR CHART ── */
.bar-chart        { width: 100%; overflow-x: auto; }
.bar-chart-inner  { min-width: 100%; padding: 8px 0 0; }

.bar-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding-bottom: 24px;
  position: relative;
}

.bar-col {
  flex: 1;
  min-width: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  position: relative;
}
.bar-col:hover .bar-tooltip {
  opacity: 1;
  transform: translateY(-4px);
}

.bar-tooltip {
  position: absolute;
  top: -44px;
  background: var(--texto-main);
  color: #fff;
  font-size: 11px;
  padding: 5px 8px;
  border-radius: 7px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s;
  z-index: 10;
  text-align: center;
  line-height: 1.4;
}
.bar-tooltip::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--texto-main);
}

.bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  padding: 0 1px;
}
.bar-fill {
  width: 100%;
  border-radius: 4px 4px 0 0;
  min-height: 3px;
  transition: height 0.4s ease;
}
.bar-fill.bar-zero {
  background: var(--gris-borde) !important;
  min-height: 3px;
}
.bar-label {
  font-size: 9.5px;
  color: var(--gris-texto);
  margin-top: 4px;
  white-space: nowrap;
  text-align: center;
  position: absolute;
  bottom: 0;
}

/* ── MEMBERS LIST ── */
.members-list {
  padding: 8px 0;
  max-height: 320px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gris-borde) transparent;
}
.members-empty {
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--gris-texto);
}

.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  transition: background 0.15s;
}
.member-row:hover { background: var(--gris-fondo); }

.member-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.member-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.member-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--texto-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-cargo {
  font-size: 11px;
  color: var(--gris-texto);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-progress-track {
  height: 4px;
  background: var(--gris-borde);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 2px;
}
.member-progress-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.member-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
}
.member-stat-val {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}
.member-stat-lbl {
  font-size: 10px;
  color: var(--gris-texto);
}

/* ── ACTIVITY FEED ── */
.activity-feed {
  padding: 8px 20px 16px;
  max-height: 360px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--gris-borde) transparent;
}
.feed-empty {
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: var(--gris-texto);
}

.feed-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gris-borde);
  position: relative;
}
.feed-item:last-child { border-bottom: none; }

.feed-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--azul-medio);
  flex-shrink: 0;
  margin-top: 5px;
}

.feed-content { flex: 1; min-width: 0; }

.feed-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
}
.feed-tipo {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--texto-main);
}
.feed-badge { font-size: 10px; padding: 2px 8px; }

.feed-desc {
  font-size: 12px;
  color: var(--gris-texto);
  margin: 0 0 5px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.feed-meta {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: var(--gris-texto);
  align-items: center;
}

/* ── TABLA COMPARATIVA ── */
.cell-team {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cell-team-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.rank-icon {
  font-size: 16px;
  line-height: 1;
}

.efic-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}
.efic-track {
  flex: 1;
  height: 6px;
  background: var(--gris-borde);
  border-radius: 99px;
  overflow: hidden;
}
.efic-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.4s ease;
}
.efic-pct {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}

.row-active-team {
  background: rgba(24,95,165,0.03) !important;
}
.row-active-team:hover {
  background: rgba(24,95,165,0.06) !important;
}

/* ── BADGES EXTRA ── */
.badge-green  { background: #D1FAE5; color: #065F46; }
.badge-orange { background: #FEF3C7; color: #92400E; }
.badge-gray   { background: #F1F5F9; color: #64748B; }
.badge-blue   { background: #DBEAFE; color: #1D4ED8; }

/* ── UTILITY ── */
.fw-600   { font-weight: 600; }
.text-xs  { font-size: 11px; }
.text-muted { color: var(--gris-texto); }
.d-block  { display: block; }

/* ── NO TEAMS STATE ── */
.no-teams-msg {
  padding: 16px 20px;
  font-size: 13px;
  color: var(--gris-texto);
  background: var(--gris-fondo);
  border: 1px dashed var(--gris-borde);
  border-radius: 12px;
  margin-bottom: 24px;
}
.no-teams-msg a {
  color: var(--azul-medio);
  font-weight: 600;
  text-decoration: none;
}
.no-teams-msg a:hover { text-decoration: underline; }

.no-teams-full {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 20px;
  text-align: center;
}
.no-teams-full h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--texto-main);
  margin: 0;
}
.no-teams-full p {
  font-size: 13.5px;
  color: var(--gris-texto);
  margin: 0;
  max-width: 340px;
}

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .prod-layout {
    grid-template-columns: 1fr;
  }
  .prod-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
}

@media (max-width: 700px) {
  .prod-side {
    grid-template-columns: 1fr;
  }
  .team-selector-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .team-tab {
    min-width: 160px;
  }
  .summary-metrics {
    flex-wrap: wrap;
    gap: 16px;
  }
  .metric-sep { display: none; }
  .metric-item { min-width: 45%; }
  .period-selector {
    flex-wrap: wrap;
  }
}
