/* ===== Diseño pensado para adultos mayores: botones grandes, alto contraste, texto claro ===== */

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

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f4f6f4;
    color: #1a1a1a;
    font-size: 18px;
    line-height: 1.5;
    padding-bottom: 40px;
}

.contenedor {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
}

.encabezado {
    background: #2e7d32;
    color: white;
    padding: 20px;
    text-align: center;
}
.encabezado h1 { font-size: 24px; }
.encabezado p { font-size: 15px; opacity: 0.9; margin-top: 4px; }

.tarjeta {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Tarjetas que SIEMPRE deben verse angostas y centradas (formularios, pantalla de cámara) */
.tarjeta-angosta {
    max-width: 460px;
    margin: 0 auto 16px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 17px;
}

input[type="text"], input[type="tel"], input[type="password"], select {
    width: 100%;
    padding: 16px;
    font-size: 20px;
    border: 2px solid #ccc;
    border-radius: 12px;
    margin-bottom: 18px;
    -webkit-appearance: none;
}
input:focus, select:focus { border-color: #2e7d32; outline: none; }

.btn {
    display: block;
    width: 100%;
    padding: 18px;
    font-size: 20px;
    font-weight: 700;
    border-radius: 14px;
    border: none;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    margin-bottom: 14px;
}

.btn-primario { background: #2e7d32; color: white; }
.btn-primario:active { background: #1b5e20; }

.btn-secundario { background: #e8f5e9; color: #2e7d32; border: 2px solid #2e7d32; }

.btn-grande {
    padding: 28px;
    font-size: 24px;
}

.btn-camara {
    background: #1565c0;
    color: white;
}

.btn-ayuda {
    background: #fbc02d;
    color: #1a1a1a;
}

.mensaje-error {
    background: #ffebee;
    color: #c62828;
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 16px;
}

.mensaje-exito {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 16px;
}

.grid-clases {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.tarjeta-clase {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border: 2px solid transparent;
    cursor: pointer;
}
.tarjeta-clase.activa { border-color: #2e7d32; }
.tarjeta-clase.completada { border-color: #fbc02d; }
.img-wrap { position: relative; }
.insignia-completada {
    position: absolute;
    bottom: 6px;
    left: 6px;
    right: 6px;
    background: #fbc02d;
    color: #1a1a1a;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    padding: 4px 6px;
    border-radius: 8px;
}
.tarjeta-clase img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    background: #e8e8e8;
}
.tarjeta-clase .info-clase { padding: 10px 12px 14px; text-align: center; }
.tarjeta-clase .nombre-comun { font-weight: 700; font-size: 14.5px; line-height: 1.25; }
.tarjeta-clase .nombre-cientifico { font-size: 11.5px; color: #777; font-style: italic; margin-top: 2px; }
.tarjeta-clase .contador {
    display: inline-block;
    font-size: 12px;
    color: #2e7d32;
    font-weight: 700;
    margin-top: 8px;
    background: #e8f5e9;
    padding: 3px 10px;
    border-radius: 20px;
}

.barra-progreso-fondo {
    background: #e0e0e0;
    border-radius: 10px;
    height: 16px;
    overflow: hidden;
    margin: 8px 0;
}
.barra-progreso-relleno {
    background: #2e7d32;
    height: 100%;
    border-radius: 10px;
    transition: width 0.4s;
}

.fila-cola {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 15px;
}
.estado-icono { font-size: 22px; }

.texto-centro { text-align: center; }
.texto-chico { font-size: 14px; color: #666; }
.mt-20 { margin-top: 20px; }
.oculto { display: none !important; }

.galeria-mini {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
    margin-top: 8px;
    padding: 4px;
    background: #f4f6f4;
    border-radius: 10px;
}
.galeria-mini img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 6px;
    background: #ddd;
}

.flotante-ayuda {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #fbc02d;
    color: #1a1a1a;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    text-decoration: none;
    z-index: 100;
}

/* =====================================================
   IMPORTANTE: las reglas de escritorio van AL FINAL del
   archivo a propósito. En CSS, si dos reglas tienen la misma
   especificidad, gana la que esté escrita más abajo — por eso
   estas reglas deben ir después de las reglas generales de arriba,
   o si no, las generales las sobreescriben y nunca se ven.
   ===================================================== */

@media (min-width: 768px) {
    body { font-size: 17px; }

    .contenedor {
        max-width: 1100px;
        padding: 32px 24px;
    }

    .encabezado { padding: 30px 20px; }
    .encabezado h1 { font-size: 28px; }
    .encabezado p { font-size: 16px; }

    .tarjeta { padding: 40px; }

    .tarjeta-angosta {
        padding: 40px;
        text-align: center;
    }
    .tarjeta-angosta form { text-align: left; } /* los forms de login/registro mantienen texto normal */

    label { font-size: 16px; }
    input[type="text"], input[type="tel"], input[type="password"], select {
        font-size: 17px;
        padding: 14px 16px;
    }

    .btn {
        width: auto;
        min-width: 220px;
        display: inline-block;
        padding: 14px 28px;
        font-size: 17px;
        transition: transform 0.15s, box-shadow 0.15s;
    }
    .btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
    form .btn { width: 100%; display: block; }

    .btn-grande {
        padding: 20px 32px;
        font-size: 20px;
        width: 100%;
        display: block;
    }

    .grid-clases {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        gap: 16px;
    }
    .tarjeta-clase {
        transition: transform 0.15s, box-shadow 0.15s;
        border-radius: 12px;
    }
    .tarjeta-clase:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 18px rgba(0,0,0,0.12);
    }
    .tarjeta-clase .info-clase { padding: 10px 10px 12px; }
    .tarjeta-clase .nombre-comun { font-size: 13.5px; }
    .tarjeta-clase .nombre-cientifico { font-size: 11px; }
    .tarjeta-clase .contador { font-size: 11px; padding: 2px 8px; }

    .flotante-ayuda { width: 56px; height: 56px; font-size: 24px; }

    table { font-size: 15px; }
    th, td { padding: 14px 16px !important; }
}

@media (min-width: 1200px) {
    .contenedor { max-width: 1280px; }
    .grid-clases { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* Botón de cámara: solo en celular */
.solo-movil { display: block; }
@media (min-width: 768px) { .solo-movil { display: none !important; } }

/* Zona drag & drop en escritorio */
.zona-drop {
    border: 2px dashed #2e7d32;
    border-radius: 14px;
    padding: 32px;
    text-align: center;
    color: #2e7d32;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 14px;
    display: none;
}
.zona-drop.activa { background: #e8f5e9; }
@media (min-width: 768px) { .zona-drop { display: block; } }
