/* ==================================================================
   PlacaQR — hoja de estilos única.

   Diseñada para celular primero: una sola columna de 430px como máximo,
   objetivos táctiles de 48px, tipografía de 16px en los campos (bajo eso
   iOS hace zoom al enfocar) y nada que provoque scroll horizontal.
   ================================================================== */

:root {
    --verde:        #16a34a;
    --verde-osc:    #15803d;
    --verde-claro:  #dcfce7;
    --rojo:         #dc2626;
    --rojo-claro:   #fee2e2;
    --ambar:        #d97706;
    --ambar-claro:  #fef3c7;
    --azul:         #2563eb;
    --azul-claro:   #dbeafe;

    --texto:        #111827;
    --texto-suave:  #6b7280;
    --borde:        #e5e7eb;
    --fondo:        #f3f4f6;
    --panel:        #ffffff;

    --radio:        16px;
    --radio-sm:     10px;
    --sombra:       0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
    --sombra-alta:  0 10px 25px rgba(0, 0, 0, .10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--texto);
    background: var(--fondo);
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: var(--verde-osc); }


/* ---------------------------------------------------------------- */
/* Estructura                                                        */
/* ---------------------------------------------------------------- */

.envoltura {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--panel);
    box-shadow: var(--sombra-alta);
}

.contenido {
    padding: 20px 16px;
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

.barra {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 8px 16px;
    padding-top: calc(8px + env(safe-area-inset-top));
    background: var(--panel);
    border-bottom: 1px solid var(--borde);
}

.barra h1 {
    flex: 1;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -.01em;
}

.barra .volver {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin-left: -8px;
    border-radius: 50%;
    color: var(--texto);
    text-decoration: none;
    font-size: 1.4rem;
    line-height: 1;
}

.barra .volver:active { background: var(--fondo); }


/* ---------------------------------------------------------------- */
/* Tipografía                                                        */
/* ---------------------------------------------------------------- */

h2 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 8px;
}

h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
}

p { margin-bottom: 12px; }

p:last-child { margin-bottom: 0; }

.suave  { color: var(--texto-suave); }
.chico  { font-size: .875rem; }
.centro { text-align: center; }

.separador {
    height: 1px;
    margin: 24px 0;
    background: var(--borde);
    border: 0;
}


/* ---------------------------------------------------------------- */
/* Botones                                                           */
/* ---------------------------------------------------------------- */

.boton {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 52px;
    padding: 14px 20px;
    border: 0;
    border-radius: var(--radio);
    background: var(--verde);
    color: #fff;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s, transform .08s;
}

.boton:active { transform: scale(.985); background: var(--verde-osc); }

.boton[disabled] { opacity: .55; cursor: not-allowed; }

.boton + .boton { margin-top: 10px; }

.boton-secundario {
    background: var(--panel);
    color: var(--texto);
    border: 1.5px solid var(--borde);
}

.boton-secundario:active { background: var(--fondo); }

.boton-peligro  { background: var(--rojo); }
.boton-peligro:active { background: #b91c1c; }

.boton-wa       { background: #25d366; }
.boton-wa:active { background: #1da851; }

.boton-azul     { background: var(--azul); }
.boton-azul:active { background: #1d4ed8; }

.boton-chico {
    width: auto;
    min-height: 40px;
    padding: 8px 16px;
    font-size: .9rem;
    border-radius: var(--radio-sm);
}


/* ---------------------------------------------------------------- */
/* Formularios                                                       */
/* ---------------------------------------------------------------- */

.campo { margin-bottom: 18px; }

.campo label {
    display: block;
    margin-bottom: 6px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--texto);
}

.campo .ayuda {
    margin-top: 6px;
    font-size: .8rem;
    color: var(--texto-suave);
    line-height: 1.4;
}

input[type=text],
input[type=email],
input[type=tel],
input[type=search],
textarea,
select {
    width: 100%;
    min-height: 52px;
    padding: 14px 16px;
    border: 1.5px solid var(--borde);
    border-radius: var(--radio-sm);
    background: var(--panel);
    font-family: inherit;
    font-size: 16px;           /* no bajar: iOS hace zoom bajo 16px */
    color: var(--texto);
    transition: border-color .15s, box-shadow .15s;
}

textarea {
    min-height: 96px;
    resize: vertical;
    line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
    outline: 0;
    border-color: var(--verde);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, .15);
}

.obligatorio { color: var(--rojo); }


/* ---------------------------------------------------------------- */
/* Tarjetas y avisos                                                 */
/* ---------------------------------------------------------------- */

.tarjeta {
    padding: 16px;
    margin-bottom: 14px;
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    background: var(--panel);
    box-shadow: var(--sombra);
}

.aviso {
    display: flex;
    gap: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border-radius: var(--radio-sm);
    font-size: .925rem;
    line-height: 1.45;
}

.aviso-ok      { background: var(--verde-claro); color: #14532d; }
.aviso-error   { background: var(--rojo-claro);  color: #7f1d1d; }
.aviso-atencion{ background: var(--ambar-claro); color: #78350f; }
.aviso-info    { background: var(--azul-claro);  color: #1e3a8a; }

.etiqueta {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.etiqueta-perdido { background: var(--rojo-claro);  color: #991b1b; }
.etiqueta-casa    { background: var(--verde-claro); color: #166534; }


/* ---------------------------------------------------------------- */
/* Listado de placas                                                 */
/* ---------------------------------------------------------------- */

.placa-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    background: var(--panel);
    box-shadow: var(--sombra);
    color: inherit;
    text-decoration: none;
}

.placa-item:active { background: var(--fondo); }

.placa-item.perdida { border-color: var(--rojo); border-width: 2px; }

.retrato {
    flex: 0 0 auto;
    width: 60px;
    height: 60px;
    border-radius: 14px;
    object-fit: cover;
    background: var(--fondo);
}

.retrato-vacio {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    background: var(--verde-claro);
}

.placa-item .datos { flex: 1; min-width: 0; }

.placa-item .datos strong {
    display: block;
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.placa-item .flecha { color: var(--texto-suave); font-size: 1.3rem; }


/* ---------------------------------------------------------------- */
/* Página pública de la placa                                        */
/* ---------------------------------------------------------------- */

.foto-grande {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    background: var(--fondo);
}

.cintillo-perdido {
    padding: 14px 16px;
    background: var(--rojo);
    color: #fff;
    font-weight: 700;
    text-align: center;
    letter-spacing: .02em;
}

.dato {
    padding: 12px 0;
    border-bottom: 1px solid var(--borde);
}

.dato:last-child { border-bottom: 0; }

.dato .clave {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--texto-suave);
}

.dato .valor { font-size: 1.05rem; margin-top: 2px; }

.estado-gps {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-radius: var(--radio-sm);
    background: var(--fondo);
    font-size: .875rem;
    color: var(--texto-suave);
}


/* ---------------------------------------------------------------- */
/* QR                                                                */
/* ---------------------------------------------------------------- */

.caja-qr {
    padding: 20px;
    border: 1px solid var(--borde);
    border-radius: var(--radio);
    background: var(--panel);
    text-align: center;
}

.caja-qr svg,
.caja-qr img {
    width: 100%;
    max-width: 260px;
    height: auto;
    margin: 0 auto;
}

.token-url {
    margin-top: 12px;
    padding: 10px;
    border-radius: var(--radio-sm);
    background: var(--fondo);
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: .75rem;
    word-break: break-all;
    color: var(--texto-suave);
}


/* ---------------------------------------------------------------- */
/* Landing                                                           */
/* ---------------------------------------------------------------- */

.portada {
    position: relative;
    padding: 40px 20px 36px;
    background: linear-gradient(160deg, #16a34a 0%, #0d9488 100%);
    color: #fff;
    text-align: center;
}

.portada .marca {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.02em;
}

.portada h2 {
    margin: 18px 0 10px;
    font-size: 1.65rem;
    line-height: 1.25;
    color: #fff;
}

.portada p { color: rgba(255, 255, 255, .92); font-size: 1.02rem; }

.paso {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
}

.paso .numero {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--verde-claro);
    color: var(--verde-osc);
    font-weight: 700;
    font-size: .95rem;
}

.paso .texto strong { display: block; margin-bottom: 2px; }

.pie {
    padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
    background: var(--fondo);
    text-align: center;
    font-size: .8rem;
    color: var(--texto-suave);
    line-height: 1.7;
}

.pie a { color: var(--texto-suave); }


/* ---------------------------------------------------------------- */
/* Pantallas grandes: la columna de celular, centrada                */
/* ---------------------------------------------------------------- */

@media (min-width: 500px) {
    body { padding: 24px 0; }

    .envoltura {
        min-height: auto;
        border-radius: 24px;
        overflow: hidden;
    }
}
