/* ── Base / pantalla completa estilo app nativa ── */
:root {
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-bg: #f2f2f7;
    --ios-card: #ffffff;
    --ios-text: #1c1c1e;
    --ios-text-secondary: #8e8e93;
    --ios-separator: rgba(60, 60, 67, 0.13);
}



* { box-sizing: border-box; }

html, body {
    height: 100%;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--ios-bg);
    color: var(--ios-text);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

.ios-screen {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    padding: max(3rem, env(safe-area-inset-top)) 1.5rem max(2rem, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeInUp .5s ease;
}

.ios-screen form {
    width: 100%;
}

/* ── Icono de app (squircle) ── */
.ios-app-icon {
    width: 76px;
    height: 76px;
    border-radius: 20px;
    background: linear-gradient(160deg, var(--ios-blue), #0051d1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 122, 255, .35);
    margin-bottom: 1rem;
}

/* ── Títulos ── */
.ios-title {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-align: center;
    margin: 0 0 .3rem;
    color: var(--ios-text);
}

.ios-subtitle {
    font-size: .92rem;
    color: var(--ios-text-secondary);
    text-align: center;
    margin: 0 0 2rem;
    max-width: 300px;
}

/* ── Grupo estilo "grouped list" (Apple ID / Settings) ── */
.ios-group {
    background: var(--ios-card);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
    padding: 0 1rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.ios-field {
    position: relative;
    display: flex;
    align-items: center;
    padding: .9rem 0;
    border-bottom: 1px solid var(--ios-separator);
}

.ios-field input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1rem;
    color: var(--ios-text);
    padding: 0;
    min-width: 0;
}

.ios-field input::placeholder {
    color: var(--ios-text-secondary);
}

#qr-button {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    margin-left: .5rem;
    background: var(--ios-blue);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .15s ease, background-color .15s ease;
}

#qr-button:active {
    transform: scale(.9);
    background: #005bbb;
}

/* ── PIN ── */
.ios-pin-row {
    display: flex;
    justify-content: space-between;
    gap: .4rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--ios-separator);
}

.pin-digit {
    flex: 1;
    aspect-ratio: 1;
    max-width: 46px;
    font-size: 1.3rem;
    text-align: center;
    border: none;
    border-radius: 12px;
    background-color: var(--ios-bg);
    color: var(--ios-text);
    outline: none;
    transition: box-shadow .15s ease, background-color .15s ease;
}

.pin-digit:focus {
    box-shadow: 0 0 0 2px var(--ios-blue);
    background-color: #fff;
}

.pin-digit.filled {
    background-color: color-mix(in srgb, var(--ios-blue) 12%, #fff);
    box-shadow: 0 0 0 1.5px var(--ios-blue);
}

/* ── Fila con switch (Recordar mis datos) ── */
.ios-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .9rem 0;
    gap: 1rem;
}

.ios-toggle-row label[for] {
    font-size: .92rem;
    color: var(--ios-text);
    cursor: pointer;
}

/* Switch estilo iOS (UISwitch) */
.ios-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 27px;
    flex-shrink: 0;
    cursor: pointer;
}

.ios-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ios-switch-track {
    position: absolute;
    inset: 0;
    background: #e9e9eb;
    border-radius: 34px;
    transition: background-color .2s ease;
}

.ios-switch-track::before {
    content: "";
    position: absolute;
    height: 23px;
    width: 23px;
    left: 2px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .18);
    transition: transform .2s ease;
}

.ios-switch input:checked + .ios-switch-track {
    background: var(--ios-green);
}

.ios-switch input:checked + .ios-switch-track::before {
    transform: translateX(19px);
}

/* ── Botón principal ── */
.ios-btn-primary {
    display: block;
    width: 100%;
    padding: .95rem;
    background-color: var(--ios-blue);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 122, 255, .3);
    transition: transform .15s ease, background-color .15s ease;
}

.ios-btn-primary:active {
    transform: scale(.97);
    background-color: #005bbb;
}

/* ── Notas ── */
.ios-note {
    font-size: .78rem;
    color: var(--ios-text-secondary);
    text-align: center;
    line-height: 1.5;
    margin: .9rem 0 0;
}

.ios-note-muted {
    color: #c7c7cc;
}

/* ── Overlay del escáner QR ── */
.qr-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 3px solid #28a745;
    box-sizing: border-box;
    pointer-events: none;
}

.qr-scan-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(40, 167, 69, 0.8);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% { top: 0; }
    100% { top: 100%; }
}

/* ── Animación de entrada ── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
