/* =========================================================
   tab-asistencia.css
   ========================================================= */

.asis-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.asis-toolbar-left,
.asis-toolbar-right { display: flex; align-items: center; gap: 10px; }

.asis-count { font-size: 12px; color: #9aa4ad; }

.asis-btn {
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid rgba(124,255,178,0.3);
  background: rgba(124,255,178,0.06);
  color: #7cffb2;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.asis-btn:hover { background: rgba(124,255,178,0.12); border-color: rgba(124,255,178,0.6); }
.asis-btn-primary {
  background: rgba(124,255,178,0.14);
  border-color: rgba(124,255,178,0.55);
}

/* ── Export dropdown ─────────────────────────────────────── */
.export-wrap { position: relative; }
.export-menu {
  position: absolute;
  right: 0; top: calc(100% + 4px);
  background: #07090c;
  border: 1px solid rgba(124,255,178,0.25);
  border-radius: 8px;
  padding: 4px;
  z-index: 999;
  min-width: 120px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
}
.export-menu button {
  display: block; width: 100%;
  padding: 7px 12px;
  background: none; border: none;
  color: #e6e6e6; font-size: 13px;
  text-align: left; cursor: pointer;
  border-radius: 5px;
}
.export-menu button:hover { background: rgba(124,255,178,0.1); color: #7cffb2; }

/* ── Table ───────────────────────────────────────────────── */
.asis-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(124,255,178,0.12);
}
.asis-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}
.asis-table th {
  background: rgba(124,255,178,0.06);
  color: #7cffb2;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(124,255,178,0.12);
  white-space: nowrap;
  text-align: left;
}
.asis-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  color: #e6e6e6;
  vertical-align: middle;
}
.asis-table tr { height: 44px; }
.asis-table td { height: 44px; box-sizing: border-box; }
.asis-table tr:last-child td { border-bottom: none; }
.asis-table tr:hover td { background: rgba(124,255,178,0.04); }

.th-check   { width: 32px;  text-align: center; }
.th-name    { min-width: 140px; }
.th-time    { width: 70px;  white-space: nowrap; }
.th-custom  { min-width: 130px; position: relative; }
.th-add-col { width: 36px;  text-align: center; color: #7cffb2; cursor: pointer; opacity: 0.5; }
.th-add-col:hover { opacity: 1; }

.th-custom span { margin-right: 4px; }
.col-del-btn {
  background: none; border: none;
  color: #f87171; font-size: 10px;
  cursor: pointer; padding: 0 2px;
  opacity: 0; transition: opacity 0.15s;
  vertical-align: middle;
}
.th-custom:hover .col-del-btn { opacity: 1; }

.td-name  { font-weight: 500; }
.td-time  { color: #9aa4ad; font-size: 12px; }
.td-custom { }
.td-name span { line-height: 1.4; vertical-align: middle; }

.dim-row td { opacity: 0.5; }

/* ── Cell inputs ─────────────────────────────────────────── */
.cell-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(124,255,178,0.15);
  color: #e6e6e6;
  padding: 2px 4px;
  font-size: 12px;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.cell-input:focus {
  outline: none;
  border-color: rgba(124,255,178,0.5);
}
.cell-num  { width: 70px; }
.cell-time { width: 80px; }

.cell-cb-wrap { display: flex; justify-content: center; }
.cell-cb-wrap input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: #7cffb2; }

.cell-escala { display: flex; gap: 3px; flex-wrap: wrap; }
.escala-btn {
  width: 24px; height: 24px;
  border-radius: 5px;
  border: 1px solid rgba(124,255,178,0.2);
  background: transparent;
  color: #9aa4ad;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.12s;
  padding: 0;
}
.escala-btn:hover { border-color: rgba(124,255,178,0.5); color: #7cffb2; }
.escala-btn.active {
  background: rgba(124,255,178,0.18);
  border-color: #7cffb2;
  color: #7cffb2;
}

.cell-select {
  background: #05070a;
  border: 1px solid rgba(124,255,178,0.15);
  color: #e6e6e6;
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 12px;
  cursor: pointer;
  width: 100%;
}
.cell-select:focus { outline: none; border-color: rgba(124,255,178,0.5); }

/* ── Empty state ─────────────────────────────────────────── */
.asis-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #9aa4ad;
  text-align: center;
  gap: 10px;
}
.asis-empty span { font-size: 36px; }
.asis-empty p    { margin: 0; font-size: 13px; line-height: 1.6; }

/* ── Disconnected section ────────────────────────────────── */
.asis-disconnected { margin-top: 24px; }
.asis-table-dim th { color: #6b7280; background: rgba(255,255,255,0.02); }

/* ── Modal ───────────────────────────────────────────────── */
.asis-modal-bg {
  position: fixed; inset: 0;
  background: rgba(5,7,10,0.75);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.asis-modal {
  background: #07090c;
  border: 1px solid rgba(124,255,178,0.25);
  border-radius: 14px;
  padding: 24px 28px;
  width: 92%; max-width: 380px;
  box-shadow: 0 0 30px rgba(124,255,178,0.12);
  color: #e6e6e6;
  font-size: 14px;
}
.asis-modal h3 { margin: 0 0 16px; font-size: 16px; color: #7cffb2; }
.asis-modal label {
  display: block; margin-bottom: 12px;
  font-size: 12px; color: #9aa4ad; font-weight: 600;
}
.asis-modal label input,
.asis-modal label select,
.asis-modal label textarea {
  display: block; width: 100%; margin-top: 5px;
  padding: 8px 10px; box-sizing: border-box;
  background: #0a0f14; color: #e6e6e6;
  border: 1px solid rgba(124,255,178,0.2); border-radius: 7px;
  font-size: 13px;
}
.asis-modal label input:focus,
.asis-modal label select:focus,
.asis-modal label textarea:focus {
  outline: none; border-color: rgba(124,255,178,0.55);
}
.asis-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ── Classic theme ───────────────────────────────────────── */
.theme-classic .asis-btn            { border-color: #dcdfe4; background: #f5f7fa; color: #0e72ed; }
.theme-classic .asis-btn:hover      { background: #eef2ff; border-color: #0e72ed; }
.theme-classic .asis-btn-primary    { background: #eef2ff; border-color: #0e72ed; }
.theme-classic .asis-table th       { background: #f5f7fa; color: #0e72ed; border-color: #dcdfe4; }
.theme-classic .asis-table td       { border-color: #eef0f3; color: #1f2937; }
.theme-classic .asis-table-wrap     { border-color: #dcdfe4; }
.theme-classic .asis-count          { color: #6b7280; }
.theme-classic .export-menu         { background: #fff; border-color: #dcdfe4; }
.theme-classic .export-menu button  { color: #1f2937; }
.theme-classic .export-menu button:hover { background: #eef2ff; color: #0e72ed; }
.theme-classic .asis-modal          { background: #fff; border-color: #dcdfe4; color: #1f2937; }
.theme-classic .asis-modal h3       { color: #0e72ed; }
.theme-classic .asis-modal label    { color: #6b7280; }
.theme-classic .cell-input          { color: #1f2937; border-color: #dcdfe4; }
.theme-classic .cell-select         { background: #fff; color: #1f2937; border-color: #dcdfe4; }
.theme-classic .escala-btn          { border-color: #dcdfe4; color: #6b7280; }
.theme-classic .escala-btn.active   { background: #eef2ff; border-color: #0e72ed; color: #0e72ed; }

/* ── Mejoras v2 ──────────────────────────────────────────── */

/* z-index máximo para modales — encima del SDK */
.asis-modal-bg {
  z-index: 2147483647 !important;
}

/* Header de columna custom con controles */
.th-custom-inner {
  display: flex; align-items: center; gap: 4px; justify-content: space-between;
}
.th-label { flex: 1; }
.th-col-actions {
  display: flex; align-items: center; gap: 3px;
  opacity: 0; transition: opacity 0.15s;
}
.th-custom:hover .th-col-actions { opacity: 1; }

.col-action-btn {
  background: none; border: none; cursor: pointer;
  font-size: 11px; padding: 1px 3px; border-radius: 4px;
  color: #9aa4ad; line-height: 1;
  transition: color 0.12s, background 0.12s;
}
.col-action-btn:hover { color: #e6e6e6; background: rgba(255,255,255,0.08); }
.col-del-btn:hover    { color: #f87171 !important; }
.col-hide-cb { accent-color: #7cffb2; width: 12px; height: 12px; }

/* Columnas ocultas — aparecen como mini-pills en el header */
.th-hidden-col {
  background: rgba(255,255,255,0.02);
  color: #4b5563; font-size: 10px;
  cursor: pointer; white-space: nowrap;
  border-bottom: 1px dashed rgba(124,255,178,0.1);
  padding: 4px 8px;
  transition: color 0.15s;
}
.th-hidden-col:hover { color: #7cffb2; }

/* Celda texto con botón expand */
.cell-text-wrap {
  display: flex; align-items: center; gap: 4px;
}
.cell-text-wrap .cell-input { flex: 1; }
.cell-expand-btn {
  background: none; border: none; cursor: pointer;
  color: #6b7280; font-size: 13px; padding: 1px 4px;
  border-radius: 4px; flex-shrink: 0; line-height: 1;
  transition: color 0.12s;
}
.cell-expand-btn:hover { color: #7cffb2; }

/* Classic theme overrides nuevos */
.theme-classic .th-col-actions { opacity: 0; }
.theme-classic .th-custom:hover .th-col-actions { opacity: 1; }
.theme-classic .col-action-btn { color: #6b7280; }
.theme-classic .th-hidden-col  { color: #9ca3af; border-color: #dcdfe4; }
.theme-classic .th-hidden-col:hover { color: #0e72ed; }
.theme-classic .cell-expand-btn { color: #9ca3af; }
.theme-classic .cell-expand-btn:hover { color: #0e72ed; }

/* ── Plantillas ──────────────────────────────────────────── */
.asis-tpl-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.asis-tpl-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-radius: 8px;
  background: rgba(124,255,178,0.04); border: 1px solid rgba(124,255,178,0.12);
  transition: background 0.15s;
}
.asis-tpl-row:hover { background: rgba(124,255,178,0.08); }
.asis-tpl-name { font-weight: 600; font-size: 13px; color: #e6e6e6; }
.asis-tpl-desc { font-size: 11px; color: #9aa4ad; margin-top: 2px; }

/* ── Celda numérica con +/- ──────────────────────────────── */
.cell-num-wrap {
  display: flex; align-items: center; gap: 4px;
}
.cell-num-btn {
  width: 22px; height: 22px; border-radius: 5px;
  border: 1px solid rgba(124,255,178,0.25);
  background: rgba(124,255,178,0.06);
  color: #7cffb2; font-size: 14px; font-weight: 700;
  cursor: pointer; padding: 0; line-height: 1;
  transition: all 0.12s; display: flex; align-items: center; justify-content: center;
}
.cell-num-btn:hover { background: rgba(124,255,178,0.18); }
.cell-num-display {
  min-width: 36px; text-align: center; font-size: 13px;
  color: #e6e6e6; cursor: pointer; padding: 2px 4px;
  border-radius: 4px; transition: background 0.12s;
}
.cell-num-display:hover { background: rgba(124,255,178,0.08); }
.cell-num-inline { width: 60px !important; text-align: center; }

/* ── Classic theme para plantillas y numérico ────────────── */
.theme-classic .asis-tpl-row { background: #f5f7fa; border-color: #dcdfe4; }
.theme-classic .asis-tpl-row:hover { background: #eef2ff; }
.theme-classic .asis-tpl-name { color: #1f2937; }
.theme-classic .cell-num-btn { border-color: #dcdfe4; background: #f5f7fa; color: #0e72ed; }
.theme-classic .cell-num-btn:hover { background: #eef2ff; }
.theme-classic .cell-num-display { color: #1f2937; }

/* ── Drag & drop reorden ─────────────────────────────────── */
.td-name { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.td-drag-handle {
  color: #4b5563; font-size: 14px; cursor: grab;
  opacity: 0; transition: opacity 0.15s; flex-shrink: 0;
  user-select: none; padding: 0 2px;  line-height: 1;
  align-self: center;
  font-size: 12px;   
}
tr:hover .td-drag-handle { opacity: 1; }
.td-drag-handle:active { cursor: grabbing; }
tr.drag-dragging { opacity: 0.4; }
tr.drag-over td { background: rgba(124,255,178,0.08) !important; border-top: 2px solid #7cffb2; }
.theme-classic tr.drag-over td { background: #eef2ff !important; border-top: 2px solid #0e72ed; }