/* ==========================================================================
   Interfaz Independiente para Mac (mac.html)
   Diseño horizontal limpio inspirado en aplicaciones nativas de macOS
   ========================================================================== */

body.mac-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.mac-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 62px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.mac-topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.back-link:hover {
  background: var(--surface-muted);
}

.topbar-logos {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-logos img {
  height: 30px;
  width: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.group-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}

.group-pill-number {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.group-pill-subject {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.mac-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
}

/* Layout principal 2 columnas */
.mac-workspace {
  width: 100%;
  max-width: 1420px;
  margin: 0 auto;
  padding: 20px 24px 36px;
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* Barra lateral izquierda */
.mac-sidebar {
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.panel-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

/* Zona de escaneo */
.scanner-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--pendiente-bg);
  color: var(--text-secondary);
  border: none;
}

.scanner-status-pill .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-tertiary);
}

.scanner-status-pill.active {
  background: var(--presente-bg);
  color: var(--presente);
}

.scanner-status-pill.active .dot {
  background: var(--presente);
}

.scanner-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.scanner-input {
  flex: 1;
  height: 40px;
  padding: 0 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 15px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.scanner-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.scan-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.segmented-mini {
  display: inline-flex;
  background: var(--pendiente-bg);
  padding: 2px;
  border-radius: var(--radius-sm);
}

.segmented-mini button {
  border: none;
  background: transparent;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.segmented-mini button.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
}

/* Resumen numérico compacto */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  text-align: center;
}

.stat-cell {
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

.stat-label {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.stat-cell.presente .stat-value { color: var(--presente); }
.stat-cell.retardo .stat-value { color: var(--retardo); }
.stat-cell.ausente .stat-value { color: var(--ausente); }

/* Historial lateral */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  font-size: 13px;
  width: 100%;
}

.history-item:hover {
  background: var(--surface-muted);
  border-color: var(--border);
}

.history-item.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  font-weight: 600;
}

.history-counts {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.history-empty {
  font-size: 12px;
  color: var(--text-tertiary);
  padding: 6px 0;
}

/* Panel principal de lista */
.mac-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table-toolbar {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.search-input {
  width: 260px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface-muted);
  outline: none;
}

.search-input:focus {
  background: var(--surface);
  border-color: var(--accent);
}

.filter-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.filter-pill.active {
  background: var(--text);
  border-color: var(--text);
  color: #FFFFFF;
}

/* Tabla de estudiantes Mac */
.students-table {
  width: 100%;
  border-collapse: collapse;
}

.students-table thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}

.students-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color 0.1s ease;
}

.students-table tbody tr:last-child {
  border-bottom: none;
}

.students-table tbody tr:hover {
  background: #FAFAFC;
}

.students-table tbody tr.row-highlight {
  background: var(--accent-soft);
}

.students-table td {
  padding: 11px 16px;
  vertical-align: middle;
}

.col-nl {
  width: 54px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-tertiary);
}

.col-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.student-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  background: #D1D1D6;
}

.student-status-dot.presente { background: var(--presente); }
.student-status-dot.retardo { background: var(--retardo); }
.student-status-dot.ausente { background: var(--ausente); }

.col-account {
  width: 120px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
}

.col-actions {
  width: 256px;
  text-align: right;
}

.status-control {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

.status-btn {
  border: none;
  border-right: 1px solid var(--border);
  background: transparent;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background-color 0.1s ease, color 0.1s ease;
}

.status-btn:last-child {
  border-right: none;
}

.status-btn:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.status-btn.presente.selected {
  background: var(--presente);
  color: #FFFFFF;
}

.status-btn.retardo.selected {
  background: var(--retardo);
  color: #FFFFFF;
}

.status-btn.ausente.selected {
  background: var(--ausente);
  color: #FFFFFF;
}

.table-footer-bar {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.empty-state {
  padding: 40px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
}

@media (max-width: 1024px) {
  .mac-workspace {
    grid-template-columns: 290px minmax(0, 1fr);
    padding: 16px;
  }
  .group-pill-subject {
    display: none;
  }
}
