/* Animal Smart Matcher — Capa visual v4.6.0
 *
 * Contiene:
 *   1. El buscador público [visual_search] (subida de foto + resultados).
 *   2. El panel del escáner masivo dentro del admin.
 *
 * La píldora 👁 de "huella visual" de las tarjetas NO está aquí: vive en
 * frontend.css junto al resto de píldoras (.asm-pill-*), que es el CSS que se
 * carga en las fichas.
 *
 * Mobile-first: todo a ancho completo en móvil con objetivos táctiles de 44px,
 * y a partir de 640px se reorganiza en filas.
 */

/* ══════════════════════════════════════════════════════════════════════════
   1. Buscador público
   ══════════════════════════════════════════════════════════════════════════ */
.asm-visual-search {
    max-width: 860px;
    margin: 2.5em auto;
    padding: 0 16px;
    font-size: 16px;
}

.asm-vs-header { text-align: center; margin-bottom: 22px; }
.asm-vs-title  { font-size: 1.5em; font-weight: 800; color: #111827; margin: 0 0 10px; letter-spacing: -.02em; }
.asm-vs-intro  { color: #4b5563; margin: 0 0 10px; line-height: 1.6; }
.asm-vs-privacy {
    display: inline-block;
    font-size: .82em;
    color: #065f46;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    padding: 7px 12px;
    margin: 0;
}

.asm-vs-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    padding: 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .07);
}

/* ── Zona de arrastre ── */
.asm-vs-dropwrap { position: relative; }

/* El input nativo cubre toda la zona: da clic, teclado y "arrastrar" gratis,
   sin necesidad de sincronizar un input fantasma por JS. */
.asm-vs-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.asm-vs-dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 210px;
    padding: 28px 18px;
    border: 3px dashed #c4b5fd;
    border-radius: 18px;
    background: linear-gradient(135deg, #faf5ff, #f5f3ff);
    text-align: center;
    transition: border-color .2s ease, background .2s ease, transform .2s ease;
}

.asm-vs-dropzone.is-dragging {
    border-color: #6d28d9;
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    transform: scale(1.01);
}

.asm-vs-icon { font-size: 46px; width: 46px; height: 46px; color: #7c3aed; }
.asm-vs-droptext { margin: 0; font-size: 1.02em; color: #374151; }
.asm-vs-hint { margin: 0; font-size: .8em; color: #9ca3af; }

.asm-vs-preview { margin-top: 10px; }
.asm-vs-preview img {
    max-width: 100%;
    max-height: 320px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    display: block;
}

/* ── Botones ── */
.asm-vs-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.asm-vs-btn,
.asm-vs-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;          /* objetivo táctil cómodo */
    padding: 12px 22px;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.asm-vs-btn {
    background: linear-gradient(135deg, #6d28d9, #7c3aed);
    color: #fff;
    box-shadow: 0 6px 18px rgba(109, 40, 217, .28);
}
.asm-vs-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(109, 40, 217, .34); }
.asm-vs-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }

.asm-vs-btn-secondary {
    background: #fff;
    color: #6d28d9;
    border-color: #ddd6fe;
}
.asm-vs-btn-secondary:hover { background: #f5f3ff; }

/* ── Estado y resultados ── */
.asm-vs-status {
    margin-top: 16px;
    padding: 13px 16px;
    border-radius: 12px;
    background: #ede9fe;
    color: #5b21b6;
    font-size: .93em;
    font-weight: 600;
    text-align: center;
}

.asm-vs-results { margin-top: 26px; }
.asm-vs-results-title { font-size: 1.18em; font-weight: 800; color: #111827; margin: 0 0 16px; }
.asm-vs-empty {
    text-align: center;
    color: #6b7280;
    font-style: italic;
    padding: 26px 16px;
    background: #f9fafb;
    border-radius: 14px;
    margin: 0;
}

/* Rejilla propia por si el tema no define .asm-grid con auto-fill */
.asm-vs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* ══════════════════════════════════════════════════════════════════════════
   2. Escáner masivo (admin)
   ══════════════════════════════════════════════════════════════════════════ */
#asm-visual-scanner .asm-batch-bar {
    height: 14px;
    background: #f3f4f6;
    border-radius: 999px;
    overflow: hidden;
    margin: 14px 0;
    border: 1px solid #e5e7eb;
}
#asm-visual-scanner .asm-batch-bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #6d28d9, #a855f7);
    transition: width .4s ease;
}

#asm-visual-scanner .asm-batch-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0;
}
#asm-visual-scanner .asm-stat {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 7px 12px;
    font-size: 13px;
    color: #374151;
}
#asm-visual-scanner .asm-stat strong { color: #6d28d9; }
#asm-visual-scanner .asm-stat-pct { background: #ede9fe; border-color: #ddd6fe; color: #5b21b6; }

#asm-visual-scanner .asm-batch-controls { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }

#asm-visual-scanner .asm-batch-thumb { margin: 12px 0; }
#asm-visual-scanner .asm-batch-thumb img {
    max-width: 190px;
    border-radius: 10px;
    display: block;
    margin-bottom: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}
#asm-visual-scanner .asm-batch-thumb span { font-size: 12px; color: #6b7280; }

#asm-visual-scanner .asm-batch-log {
    max-height: 230px;
    overflow-y: auto;
    background: #1f2937;
    border-radius: 10px;
    padding: 10px 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.65;
}
#asm-visual-scanner .asm-batch-line { color: #d1d5db; }
#asm-visual-scanner .asm-batch-line.is-ok   { color: #6ee7b7; }
#asm-visual-scanner .asm-batch-line.is-skip { color: #fcd34d; }
#asm-visual-scanner .asm-batch-line.is-fail { color: #fca5a5; }

/* ══════════════════════════════════════════════════════════════════════════
   3. A partir de tablet
   ══════════════════════════════════════════════════════════════════════════ */
@media (min-width: 640px) {
    .asm-visual-search { padding: 0; }
    .asm-vs-card { padding: 30px; }
    .asm-vs-actions { flex-direction: row; }
    .asm-vs-btn { flex: 1; }
    .asm-vs-btn-secondary { flex: 0 0 auto; }
}

/* Respeta a quien prefiere menos movimiento */
@media (prefers-reduced-motion: reduce) {
    .asm-vs-dropzone,
    .asm-vs-btn,
    .asm-vs-btn-secondary,
    #asm-visual-scanner .asm-batch-bar span { transition: none; }
}
