/* Specific styles for camera + face screens. Follows preto+dourado design system. */

.container.narrow { max-width: 980px; }

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: border-color 200ms ease, color 200ms ease;
}
.back-link:hover { color: var(--gold); border-color: var(--border-strong); }

.enroll-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
@media (min-width: 900px) {
  .enroll-grid { grid-template-columns: 360px 1fr; }
}

.card-static {
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.field-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

select, input[type="text"] {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 200ms ease;
}
select:focus { border-color: var(--gold); }
select option { background: #0a0a0a; color: var(--text); }

.btn-primary, .btn-secondary {
  font-family: 'Manrope', sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease, opacity 200ms ease;
}
.btn-primary {
  background: var(--gold);
  color: #1a1305;
  border: 1px solid var(--gold);
}
.btn-primary:hover:not(:disabled) { background: var(--gold-light); border-color: var(--gold-light); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { color: var(--gold); border-color: var(--gold); }
.btn-secondary.active { color: var(--gold); border-color: var(--gold); background: rgba(212,175,55,0.05); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.camera-card { padding: 18px; }
.camera-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.camera-wrap video {
  width: 100%; height: 100%; object-fit: cover;
  transform: scaleX(-1); /* mirror selfie */
}
.face-overlay {
  position: absolute;
  border: 2px solid var(--gold);
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.0);
  transition: opacity 150ms ease;
  transform-origin: top left;
  /* note: mirrored — left/top still works because we mirror video CSS, not overlay box math */
}

.camera-actions {
  display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px;
}

.hint-row {
  display: flex; gap: 16px; margin-top: 12px;
  font-size: 11px; color: var(--muted);
  letter-spacing: 0.06em; text-transform: uppercase;
}

.muted-text { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

.info-list {
  margin: 12px 0 0; padding: 0; list-style: none;
  font-size: 13px; color: var(--text);
}
.info-list li { padding: 6px 0; border-bottom: 1px dashed var(--border); }
.info-list li:last-child { border-bottom: 0; }

.seg {
  display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 4px;
}
.seg-btn {
  background: transparent; border: 0; color: var(--muted);
  padding: 8px 16px; font-family: inherit;
  font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
  cursor: pointer; transition: background 200ms ease, color 200ms ease;
}
.seg-btn.active { background: rgba(212,175,55,0.1); color: var(--gold); }

.kv {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px dashed var(--border);
  font-size: 12px;
}
.kv span { color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.kv strong { color: var(--text); font-weight: 500; }

.history {
  margin-top: 10px; display: flex; flex-direction: column; gap: 6px;
}
.hist-row {
  display: grid; grid-template-columns: 90px 1fr auto auto;
  align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}
.hist-tipo {
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; font-size: 10.5px;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(212,175,55,0.08); color: var(--gold);
  text-align: center;
}
.hist-tipo.saida { background: rgba(192,57,43,0.1); color: #d97565; }
.hist-meta { color: var(--muted); font-size: 11px; }

.pill {
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border);
}
.pill.ok { color: var(--gold); border-color: var(--border-strong); }
.pill.warn { color: #e0a833; border-color: rgba(224,168,51,0.4); }

.table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  text-align: left; padding: 14px 18px;
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 500;
  background: rgba(0,0,0,0.3);
  border-bottom: 1px solid var(--border);
}
.table tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:hover td { background: rgba(212,175,55,0.025); }
.table a { color: var(--gold); text-decoration: none; }
.table a:hover { text-decoration: underline; }

/* =====================================================================
   Profile photo card + modal
   ===================================================================== */

.profile-photo-card {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 4px;
}

.avatar-preview {
  width: 96px;
  height: 96px;
  flex-shrink: 0;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-dark));
  color: #1a1305;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 0.02em;
  border: 2px solid var(--border-strong);
  box-shadow: var(--shadow-gold);
}
.avatar-preview img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.profile-photo-body { flex: 1; min-width: 0; }
.profile-photo-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Modal overlay */
.photo-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.photo-modal[hidden] { display: none; }

.photo-modal-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow), var(--shadow-gold);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.photo-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.photo-modal-head strong {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.photo-modal-camera {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}
.photo-modal-camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.photo-modal-frame {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 2px dashed rgba(212, 175, 55, 0.55);
  pointer-events: none;
}

#photo-preview-stage {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border-strong);
}
#photo-preview { width: 100%; height: 100%; object-fit: cover; display: block; }

.photo-modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.photo-modal-actions button { min-height: 44px; }

@media (max-width: 768px) {
  .profile-photo-card {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 16px;
    padding: 20px;
  }
  .avatar-preview {
    align-self: center;
    width: 110px;
    height: 110px;
    font-size: 34px;
  }
  .profile-photo-actions { justify-content: center; }
  .photo-modal-actions { justify-content: stretch; }
  .photo-modal-actions button { flex: 1; }
}

/* Admin filter/tool row */
.admin-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.admin-filters, .admin-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-tools a { text-decoration: none; }

/* =====================================================================
   MOBILE — face/camera/admin specific
   ===================================================================== */

@media (max-width: 768px) {
  .container.narrow { padding: 24px 16px 100px; }

  /* Back link smaller + tap-friendly */
  .back-link {
    padding: 8px 12px;
    font-size: 10.5px;
    letter-spacing: 0.06em;
  }

  .enroll-grid { gap: 14px; }
  .card-static { padding: 18px; }

  /* Bigger camera on mobile (portrait-friendly aspect) */
  .camera-wrap { aspect-ratio: 3 / 4; }

  /* Stack buttons full width with 48px tap target */
  .camera-actions { flex-direction: column; gap: 10px; }
  .camera-actions button {
    width: 100%;
    min-height: 48px;
    padding: 14px 18px;
    font-size: 13px;
  }

  /* Bigger generic buttons for tap */
  .btn-primary, .btn-secondary {
    min-height: 46px;
    padding: 12px 18px;
    font-size: 12px;
  }

  /* Inputs: 16px font-size avoids iOS zoom-on-focus */
  select, input[type="text"], input[type="email"], input[type="password"] {
    font-size: 16px;
    padding: 12px 14px;
    min-height: 46px;
  }

  .seg { width: 100%; }
  .seg-btn { flex: 1; padding: 12px 8px; font-size: 11px; min-height: 44px; }

  .field-label { font-size: 10.5px; }
  .hint-row { flex-direction: column; gap: 4px; font-size: 10.5px; }

  /* KV rows: stack label/value on extra-tight screens? keep inline but smaller */
  .kv { padding: 9px 0; font-size: 11.5px; gap: 8px; }
  .kv strong { text-align: right; word-break: break-word; }

  /* History rows: bigger taps, more breathing room */
  .hist-row {
    grid-template-columns: 80px 1fr;
    grid-template-rows: auto auto;
    gap: 4px 10px;
    padding: 10px 12px;
    font-size: 12px;
  }
  .hist-row .hist-tipo { grid-row: 1 / 3; align-self: center; }
  .hist-time { grid-column: 2; }
  .hist-meta { grid-column: 2; font-size: 10.5px; }
  .hist-row .pill { grid-column: 2; justify-self: start; margin-top: 2px; }

  /* Admin table → switch to card-list layout on mobile */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td {
    display: block;
    width: 100%;
  }
  .table tbody tr {
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: rgba(212, 175, 55, 0.02);
  }
  .table tbody td {
    border: 0;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
  }
  .table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    flex-shrink: 0;
  }

  /* Hero heading inside narrow container */
  .hero h1 { font-size: 24px; }

  .info-list { font-size: 12.5px; }
}

/* Tiny phones */
@media (max-width: 380px) {
  .enroll-grid { gap: 12px; }
  .card-static { padding: 14px; }
  .camera-wrap { aspect-ratio: 1 / 1.2; }
}

@media (max-width: 768px) {
  .admin-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .admin-filters, .admin-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .admin-filters button, .admin-tools a, .admin-tools button {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 11px;
    text-align: center;
  }
}
