/* ══════════════════════════════════════════════════════════════
   Piscina Control — Frontend Scanner (shortcode)
   Diseño limpio para uso en móvil/tablet en la entrada
══════════════════════════════════════════════════════════════ */

.pc-front-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 540px;
    margin: 0 auto;
    padding: 12px;
    box-sizing: border-box;
}

/* ── Cabecera ──────────────────────────────────────────────── */
.pc-front-header {
    text-align: center;
    margin-bottom: 16px;
}
.pc-front-titulo {
    font-size: 1.3em;
    font-weight: 700;
    margin: 0 0 8px;
    color: #1e293b;
}
.pc-front-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-size: .9em;
    color: #475569;
}
.pc-front-badge {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: .82em;
    font-weight: 600;
}
.pc-front-badge--ok  { background: #dcfce7; color: #15803d; }
.pc-front-badge--err { background: #fee2e2; color: #b91c1c; }

/* ── Stats ─────────────────────────────────────────────────── */
.pc-front-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}
.pc-front-stat {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 4px;
    text-align: center;
}
.pc-front-stat--ab  { border-left: 3px solid #2563eb; }
.pc-front-stat--en  { border-left: 3px solid #7c3aed; }
.pc-front-stat--err { border-left: 3px solid #dc2626; }
.pc-front-stat-num  { font-size: 1.7em; font-weight: 700; line-height: 1; color: #1e293b; }
.pc-front-stat-lbl  { font-size: .65em; color: #64748b; margin-top: 3px; }

/* ── Área de resultado (zona prioritaria) ──────────────────── */
.pc-front-resultado {
    min-height: 100px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .3s, border-color .3s;
    padding: 16px;
}
.pc-front-result-ok  { background: #f0fdf4; border-color: #86efac; }
.pc-front-result-err { background: #fef2f2; border-color: #fca5a5; }

.pc-front-idle { text-align: center; color: #94a3b8; }
.pc-front-idle-icon { font-size: 2.2em; display: block; margin-bottom: 6px; }
.pc-front-idle p { margin: 0; font-size: .9em; }

.pc-front-cargando { text-align: center; }
.pc-front-spinner {
    width: 36px; height: 36px; margin: 0 auto 8px;
    border: 3px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: pc-spin .7s linear infinite;
}
@keyframes pc-spin { to { transform: rotate(360deg); } }

.pc-front-result-inner { text-align: center; width: 100%; }
.pc-front-result-icono { font-size: 3em; line-height: 1; margin-bottom: 8px; }
.pc-front-result-msg   { font-size: 1.2em; font-weight: 700; margin-bottom: 10px; color: #1e293b; }

.pc-front-det { background: rgba(255,255,255,.7); border-radius: 8px; padding: 10px 14px; text-align: left; }
.pc-front-det-row { display: flex; gap: 8px; font-size: .9em; padding: 3px 0; border-bottom: 1px solid rgba(0,0,0,.06); }
.pc-front-det-row:last-child { border-bottom: none; }
.pc-front-det-k { color: #64748b; min-width: 80px; }
.pc-front-det-v { font-weight: 600; color: #1e293b; }

/* ── Cámara ─────────────────────────────────────────────────── */
.pc-front-cam-section { margin-bottom: 16px; }

.pc-front-cam-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    max-height: 280px;
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
}

#pc-front-video {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

/* Marco visor */
.pc-front-visor {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 56%; aspect-ratio: 1;
    border: 3px solid rgba(255,255,255,.6);
    border-radius: 8px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s;
}
.pc-front-cam-active .pc-front-visor { opacity: 1; }

.pc-front-flash {
    position: absolute; inset: 0;
    background: rgba(22,163,74,.4);
    pointer-events: none;
    animation: pc-flash .4s forwards;
}
@keyframes pc-flash { to { opacity: 0; } }

.pc-front-cam-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 10px;
}
.pc-front-select {
    flex: 1;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 8px;
    font-size: .9em;
}

/* Botones */
.pc-front-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s, transform .1s;
}
.pc-front-btn:active { transform: scale(.97); }
.pc-front-btn--primary   { background: #2563eb; color: #fff; }
.pc-front-btn--secondary { background: #64748b; color: #fff; }
.pc-front-btn--manual    { background: #0f766e; color: #fff; padding: 10px 14px; }

/* Entrada manual */
.pc-front-manual {
    display: flex;
    gap: 8px;
}
.pc-front-manual input {
    flex: 1;
    height: 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 0 12px;
    font-size: .95em;
    font-family: monospace;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.pc-front-manual input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}

/* ── Últimas lecturas ───────────────────────────────────────── */
.pc-front-ultimas h3 {
    font-size: .95em;
    color: #64748b;
    margin: 0 0 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.pc-front-ultimas-lista {
    list-style: none;
    margin: 0;
    padding: 0;
}
.pc-front-ul-item {
    display: grid;
    grid-template-columns: 24px 56px 1fr;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
    font-size: .85em;
}
.pc-front-ul-ok  { background: #f0fdf4; }
.pc-front-ul-err { background: #fef2f2; }
.pc-front-ul-hora { color: #94a3b8; font-family: monospace; }
.pc-front-ul-desc { color: #374151; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-front-empty   { color: #94a3b8; font-style: italic; text-align: center; padding: .5em; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 360px) {
    .pc-front-stats { grid-template-columns: repeat(2, 1fr); }
    .pc-front-result-msg { font-size: 1.05em; }
}
