* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', sans-serif;
    background: #f0f2f5;
}
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    width: 85%;
    max-width: 300px;
    text-align: center;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    margin: 15px 0;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 16px;
}

.modal-content button {
    width: 100%;
    padding: 12px;
    background: #2f6bcf;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
}

.popup {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #2ecc71;
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    font-weight: bold;
    opacity: 0;
    transition: 0.3s;
    z-index: 999;
}

.popup.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* CONTENEDOR APP */
.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}
/* LOADING SPINNER */
.loader {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top: 2px solid white;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.8s linear infinite;
    margin-left: 5px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Para amarillo (spinner oscuro) */
.yellow .loader {
    border: 2px solid rgba(0,0,0,0.2);
    border-top: 2px solid black;
}
/* HEADER */
.header {
    background: #2f6bcf;
    color: white;
    padding: 15px;
    padding-top: env(safe-area-inset-top);
    display: flex;
    align-items: center;
}

.header h1 {
    flex: 1;
    text-align: center;
    font-size: 16px;
}

/* CONTENIDO SCROLLEABLE */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

/* ICONOS */
.actions {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 15px;
}

.icon {
    font-size: 24px;
}

/* IMAGEN */
.image-container {
    position: relative;
    width: 100%;
    max-width: 220px;
    margin: auto;
}

.image-container img {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    object-fit: cover;
    background: #ddd;
}

/* BADGE */
.badge {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: #27ae60;
    color: white;
    padding: 6px 14px;
    border-radius: 10px;
    font-size: 13px;
}

/* DNI */
h2 {
    text-align: center;
    margin: 15px 0;
}

/* INFO */
.info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item {
    background: white;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
}

/* BOTON */
.btn {
    width: 100%;
    padding: 14px;
    margin-top: 20px;
    background: linear-gradient(135deg, #2f6bcf, #1e4fa3);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    font-size: 15px;
}

/* FOOTER FIJO */
.status {
    display: flex;
    padding: 10px;
    gap: 8px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    background: white;
}

.box {
    flex: 1;
    padding: 10px;
    text-align: center;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    color: white;
}
/* BADGE DINÁMICO */
.badge {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: bold;
    white-space: nowrap;
}

/* ESTADOS */
.badge.ok {
    background: #2ecc71;
    color: white;
}

.badge.alert {
    background: #e74c3c;
    color: white;
}

/* MENSAJE ALERTA */
.alert-box {
    margin-top: 15px;
    padding: 12px;
    border-radius: 10px;
    text-align: center;
    font-weight: bold;
    display: none;
}

.alert-box.red {
    background: #e74c3c;
    color: white;
}

/* BOTON PDF */
.btn-pdf {
    margin-top: 10px;
    padding: 10px;
    background: black;
    color: white;
    border: none;
    border-radius: 8px;
    width: 100%;
}
.red { background: #e74c3c; }
.yellow { background: #f1c40f; color: black; }
.green { background: #2ecc71; }

/* 📱 AJUSTES EXTRA MOBILE */
@media (max-width: 400px) {
    h2 { font-size: 16px; }
    .item { font-size: 13px; }
}