/* ======================================
   APP ASISTENCIA - Estilos Mobile-First
   ====================================== */

.attendance-app {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* Header */
.attendance-header {
  position: sticky;
  top: 0;
  z-index: 10;
}

.attendance-header .btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: var(--cl-tx-tt);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.attendance-header .btn-icon:hover {
  background: var(--bg-alt);
}

/* Tabs */
.attendance-tabs {
  border-bottom: 1px solid var(--bc-in);
}

.attendance-tab {
  flex: 1;
  padding: 12px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.937rem;
  font-weight: 500;
  color: var(--cl-tx-stt);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.attendance-tab.active {
  color: var(--cl-bl-pr);
  border-bottom-color: var(--cl-bl-pr);
}

.attendance-tab:hover {
  background: var(--bg-alt);
}

/* Vista Marcar */
.mark-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 0;
}

.mark-time-display {
  padding: 24px 0;
}

.mark-type-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 16px 20px;
  border: 2px solid var(--bc-in);
  border-radius: 12px;
  background: var(--bg-wt-tpr-10);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.mark-type-btn:hover {
  border-color: var(--btn-color, var(--cl-bl-pr));
  background: color-mix(in srgb, var(--btn-color, var(--cl-bl-pr)) 8%, transparent);
}

.mark-type-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.mark-type-btn.marked,
.mark-type-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  border-color: var(--cl-br-in);
  background: var(--cl-bg-alt);
}

.mark-type-btn.marked .mark-type-icon {
  color: #22c55e;
}

.mark-type-icon {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--btn-color, var(--cl-bl-pr)) 15%, transparent);
}

.mark-type-label {
  font-size: 1.062rem;
  font-weight: 600;
  color: var(--cl-tx-tt);
}

/* Flujo de marcación */
.mark-flow {
  max-width: 480px;
  margin: 0 auto;
}

/* GPS Status */
.gps-status {
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--bg-alt);
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border: 2px solid var(--bc-in);
  border-top-color: var(--cl-bl-pr);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Location Status */
.location-status {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  width: 100%;
}

.location-valid {
  background: color-mix(in srgb, #22c55e 12%, transparent);
  color: #22c55e;
}

.location-warning {
  background: color-mix(in srgb, #f59e0b 12%, transparent);
  color: #f59e0b;
}

.location-invalid {
  background: color-mix(in srgb, #ef4444 12%, transparent);
  color: #ef4444;
}

/* Camera */
.camera-container {
  width: 100%;
  max-width: 400px;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.camera-container video {
  width: 100%;
  display: block;
  aspect-ratio: 4/3;
  object-fit: cover;
}

/* Photo Preview */
.photo-preview-img {
  width: 100%;
  max-width: 400px;
  border-radius: 12px;
  aspect-ratio: 4/3;
  object-fit: cover;
}

/* Action Buttons */
.mark-action-btn {
  padding: 14px 24px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.mark-action-btn.primary {
  background: var(--cl-bl-pr);
  color: white;
}

.mark-action-btn.primary:hover {
  opacity: 0.9;
}

.mark-action-btn.primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.mark-action-btn.secondary {
  background: var(--bg-alt);
  color: var(--cl-tx-tt);
  border: 1px solid var(--bc-in);
}

.mark-action-btn.secondary:hover {
  background: var(--bc-in);
}

/* Historial */
.history-list {
  max-width: 480px;
  margin: 0 auto;
}

.history-card {
  transition: transform 0.15s;
}

.history-card:active {
  transform: scale(0.99);
}

/* Error icon */
.error-icon {
  padding: 16px;
}

/* Admin Panel Styles */
.attendance-admin-tabs {
  border-bottom: 1px solid var(--bc-in);
  margin-bottom: 16px;
}

.attendance-admin-tabs .tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.937rem;
  font-weight: 500;
  color: var(--cl-tx-stt);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.attendance-admin-tabs .tab-btn.active {
  color: var(--cl-bl-pr);
  border-bottom-color: var(--cl-bl-pr);
}

/* Type badges */
.type-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.type-badge.type-ingreso { background: #dcfce7; color: #166534; }
.type-badge.type-inicio-de-almuerzo { background: #fef3c7; color: #92400e; }
.type-badge.type-fin-de-almuerzo { background: #ffedd5; color: #9a3412; }
.type-badge.type-salida { background: #fecaca; color: #991b1b; }
.type-badge.type-permiso { background: #ede9fe; color: #5b21b6; }

/* Location cards (admin) */
.location-card {
  transition: transform 0.15s, box-shadow 0.15s;
}

.location-card:hover {
  transform: translateY(-2px);
}

.btn-sm {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 0.812rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-sm:hover {
  opacity: 0.85;
}

.btn-sm.btn-secondary {
  background: var(--bg-alt);
  color: var(--cl-tx-tt);
  border: 1px solid var(--bc-in);
}

.btn-sm.btn-danger {
  background: #fecaca;
  color: #991b1b;
}

/* Photo thumbnail (admin table) */
.photo-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.15s;
}

.photo-thumb:hover {
  transform: scale(1.1);
}

/* Photo modal overlay */
.photo-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  cursor: pointer;
}

.photo-modal-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
}

/* Responsive */
@media (max-width: 480px) {
  .mark-type-btn {
    min-height: 56px;
    padding: 12px 16px;
  }
}
