/* ==========================================================
   Fotos: zonas para subir imagen, botones y cámara.
   Se usa en el formulario del estudiante y en el panel del administrador.
   ========================================================== */

/* ---------- Carga de carnet ---------- */
.drop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem;
  aspect-ratio: 1.58; min-height: 150px; padding: 1rem; text-align: center; cursor: pointer;
  border: 2px dashed var(--line-2); border-radius: var(--r-m); background: var(--paper);
  transition: border-color .15s, background .15s; overflow: hidden;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .ico { width: 34px; height: 34px; color: var(--brand); }
.drop strong { font-size: .95rem; }
.drop small { color: var(--ink-3); font-size: .82rem; }
.drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.drop .change {
  position: absolute; left: .6rem; bottom: .6rem; padding: .25rem .65rem; border-radius: 999px;
  background: rgba(23, 32, 61, .85); color: #fff; font-size: .8rem; font-weight: 600; pointer-events: none;
}
.field.invalid .drop { border-color: var(--bad); background: var(--bad-soft); }
.drop-field .err { margin-top: .35rem; }

/* ---------- Fotos del carnet: subir o tomar ---------- */
.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .6rem; }
.photo-actions .btn { width: 100%; }

/* Hoja de respuestas: papel en vertical */
.drop.portrait { aspect-ratio: .74; max-width: 260px; min-height: 0; }
.photo-field { max-width: 100%; }

/* ---------- Cámara ---------- */
.cam { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; background: #000; color: #fff; }
.cam-head { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; padding-top: max(.8rem, env(safe-area-inset-top)); background: rgba(0,0,0,.6); }
.cam-x { all: unset; display: grid; place-items: center; width: 44px; height: 44px; cursor: pointer; border-radius: 50%; }
.cam-x:hover { background: rgba(255,255,255,.14); }
.cam-x:focus-visible { outline: 3px solid #fff; }
.cam-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #000; }
.cam-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.cam-guide {
  position: absolute; border: 3px solid var(--mark); border-radius: 14px;
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .55); pointer-events: none;
}
.cam-guide i { position: absolute; width: 26px; height: 26px; border: 5px solid #fff; }
.cam-guide i:nth-child(1) { top: -3px; left: -3px; border-right: 0; border-bottom: 0; border-top-left-radius: 14px; }
.cam-guide i:nth-child(2) { top: -3px; right: -3px; border-left: 0; border-bottom: 0; border-top-right-radius: 14px; }
.cam-guide i:nth-child(3) { bottom: -3px; left: -3px; border-right: 0; border-top: 0; border-bottom-left-radius: 14px; }
.cam-guide i:nth-child(4) { bottom: -3px; right: -3px; border-left: 0; border-top: 0; border-bottom-right-radius: 14px; }
.cam-hint {
  position: absolute; left: 50%; bottom: 1rem; transform: translateX(-50%); width: max-content; max-width: 92%;
  padding: .5rem .9rem; border-radius: 999px; background: rgba(0,0,0,.7); font-size: .92rem; text-align: center;
}
.cam-msg { position: absolute; left: 1rem; right: 1rem; top: 1rem; padding: .8rem 1rem; border-radius: var(--r-m); background: var(--bad); font-weight: 600; text-align: center; }
.cam-actions {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  padding: 1rem 1.2rem; padding-bottom: max(1rem, env(safe-area-inset-bottom)); background: rgba(0,0,0,.75);
}
.cam-btn { all: unset; cursor: pointer; padding: .7rem .4rem; font-weight: 600; font-size: .95rem; text-align: center; border-radius: var(--r-s); }
.cam-btn:first-child { justify-self: start; }
.cam-btn:last-child { justify-self: end; }
.cam-btn:hover { background: rgba(255,255,255,.12); }
.cam-btn:focus-visible, .cam-shutter:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.cam-shutter { all: unset; cursor: pointer; width: 72px; height: 72px; border-radius: 50%; border: 4px solid #fff; display: grid; place-items: center; }
.cam-shutter span { width: 54px; height: 54px; border-radius: 50%; background: #fff; transition: transform .1s; }
.cam-shutter:active span { transform: scale(.88); }
.cam-shutter[disabled] { opacity: .5; }

.drop.portrait img { object-fit: contain; background: #fff; }
