/*
 * Pantallas de cuenta (_AccountLayout): ingreso, olvidé mi contraseña, definir y cambiar contraseña.
 * No depende de app.css ni de Bootstrap: solo de icons.min.css (Material Design Icons).
 * Celular primero; desde 900px pasa a dos columnas (marca | formulario).
 */

:root {
    /* Paleta de Factura24 (la del logo): grafito #232d34 y verde #1eb852 */
    --acc-brand: #232d34;
    --acc-brand-2: #2e3a43;
    --acc-brand-3: #161d22;
    --acc-on-brand: #ffffff;
    --acc-on-brand-muted: rgba(255, 255, 255, .75);
    --acc-accent: #1eb852;
    --acc-accent-hover: #189a44;
    --acc-on-accent: #ffffff;
    --acc-accent-ring: rgba(30, 184, 82, .25);
    --acc-bg: #ffffff;
    --acc-text: #1a1a1a;
    --acc-text-muted: #71717a;
    --acc-field: #f4f4f5;
    --acc-field-hover: #ececef;
    --acc-border: #e4e4e7;
    --acc-danger: #b91c1c;
    --acc-danger-bg: #fef2f2;
    --acc-danger-border: #fecaca;
    --acc-success: #15803d;
    --acc-success-bg: #ecfdf3;
    --acc-radius: 14px;
    --acc-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body.acc {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--acc-brand);
    color: var(--acc-text);
    font-family: var(--acc-font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }

/* ---------- Estructura (celular) ---------- */

.acc-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.acc-brand {
    position: relative;
    overflow: hidden;
    padding: calc(28px + env(safe-area-inset-top)) 24px 52px;
    color: var(--acc-on-brand);
    background:
        radial-gradient(110% 90% at 100% 0%, rgba(30, 184, 82, .28) 0%, rgba(30, 184, 82, 0) 55%),
        radial-gradient(90% 70% at 0% 100%, rgba(0, 0, 0, .35) 0%, rgba(0, 0, 0, 0) 65%),
        linear-gradient(160deg, var(--acc-brand-2) 0%, var(--acc-brand) 55%, var(--acc-brand-3) 100%);
}

/* Cuadrícula sutil de fondo */
.acc-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .06) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
    -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
    pointer-events: none;
}

.acc-brand-id {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.acc-logo {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    background: #ffffff;
    color: var(--acc-brand-2);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}

.acc-logo img { width: 100%; height: 100%; object-fit: contain; }
.acc-logo-initial { font-size: 22px; font-weight: 700; }

/* Logo de Factura24 (wordmark): reemplaza al cuadro con el logo y al nombre */
.acc-wordmark { display: block; height: 30px; width: auto; }

@media (min-width: 900px) {
    .acc-wordmark { height: 40px; }
}

.acc-app-name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.01em;
}

/* El claim solo se ve en escritorio */
.acc-brand-claim { display: none; }

.acc-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: -28px;
    position: relative;
    z-index: 1;
}

.acc-sheet {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--acc-bg);
    border-radius: 28px 28px 0 0;
    padding: 28px 24px calc(20px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .18);
    animation: acc-sheet-in .45s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes acc-sheet-in {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: none; opacity: 1; }
}

/* ---------- Encabezado de la pantalla ---------- */

.acc-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    margin: -6px 0 18px -6px;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: var(--acc-text-muted);
    text-decoration: none;
}
.acc-back:hover { background: var(--acc-field); color: var(--acc-text); }
.acc-back .mdi { font-size: 18px; }

.acc-hero-icon {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 38px;
    margin-bottom: 20px;
    animation: acc-pop .5s .15s cubic-bezier(.2, 1.4, .4, 1) both;
}
.acc-tone-success { background: var(--acc-success-bg); color: var(--acc-success); }
.acc-tone-danger { background: var(--acc-danger-bg); color: var(--acc-danger); }

@keyframes acc-pop {
    from { transform: scale(.6); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.acc-title {
    margin: 0;
    font-size: 28px;
    line-height: 1.2;
    font-weight: 750;
    letter-spacing: -.02em;
}

.acc-subtitle {
    margin: 8px 0 0;
    color: var(--acc-text-muted);
    font-size: 15px;
}

.acc-alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-top: 20px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--acc-danger-bg);
    border: 1px solid var(--acc-danger-border);
    color: var(--acc-danger);
    font-size: 14px;
    font-weight: 500;
    animation: acc-shake .35s ease both;
}
.acc-alert .mdi { font-size: 20px; line-height: 1; margin-top: 1px; }

@keyframes acc-shake {
    0%, 100% { transform: none; }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ---------- Formulario ---------- */

.acc-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 28px;
}

.acc-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    align-self: flex-start;
    max-width: 100%;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--acc-field);
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.acc-chip .mdi { color: var(--acc-text-muted); font-size: 18px; }

.acc-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
}

.acc-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
}
.acc-label-row .acc-label { margin: 0; }
.acc-field-group > .acc-label { margin-bottom: 8px; }

.acc-link {
    font-size: 14px;
    font-weight: 600;
    color: var(--acc-accent);
    text-decoration: none;
}
.acc-link:hover { text-decoration: underline; }

.acc-field {
    position: relative;
    display: flex;
    align-items: center;
}

.acc-field > .mdi {
    position: absolute;
    left: 16px;
    font-size: 21px;
    color: var(--acc-text-muted);
    pointer-events: none;
    transition: color .15s;
}

.acc-input {
    width: 100%;
    height: 54px;
    padding: 0 16px 0 48px;
    border: 1.5px solid transparent;
    border-radius: var(--acc-radius);
    background: var(--acc-field);
    color: var(--acc-text);
    font: inherit;
    font-size: 16px; /* 16px: evita el zoom automático de iOS al enfocar */
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
    -webkit-appearance: none;
    appearance: none;
}
.acc-input::placeholder { color: #a1a1aa; }
.acc-input:hover { background: var(--acc-field-hover); }
.acc-input:focus {
    background: var(--acc-bg);
    border-color: var(--acc-accent);
    box-shadow: 0 0 0 4px var(--acc-accent-ring);
}
.acc-field:focus-within > .mdi { color: var(--acc-text); }
.acc-field.has-toggle .acc-input { padding-right: 54px; }

.acc-toggle {
    position: absolute;
    right: 6px;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--acc-text-muted);
    font-size: 21px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.acc-toggle:hover { background: rgba(0, 0, 0, .05); color: var(--acc-text); }

/* Switch "Recordarme" */
.acc-switch {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    cursor: pointer;
    user-select: none;
}
.acc-switch input {
    -webkit-appearance: none;
    appearance: none;
    flex-shrink: 0;
    width: 46px;
    height: 28px;
    margin: 0;
    border-radius: 999px;
    background: #d4d4d8;
    position: relative;
    cursor: pointer;
    transition: background .2s;
    outline: none;
}
.acc-switch input::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}
.acc-switch input:checked { background: var(--acc-accent); }
.acc-switch input:checked::after { transform: translateX(18px); }
.acc-switch input:focus-visible { box-shadow: 0 0 0 4px var(--acc-accent-ring); }

/* Reglas de la contraseña (ayuda visual; la validación real la hace el service) */
.acc-rules {
    list-style: none;
    margin: -4px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 13px;
    color: var(--acc-text-muted);
}
.acc-rules li { display: inline-flex; align-items: center; gap: 6px; transition: color .15s; }
.acc-rules li .mdi { font-size: 16px; }
.acc-rules li.ok { color: var(--acc-success); }

/* Acciones: en celular quedan abajo, cerca del pulgar */
.acc-actions {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.acc-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 56px;
    border: 0;
    border-radius: var(--acc-radius);
    background: var(--acc-accent);
    color: var(--acc-on-accent);
    font: inherit;
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(30, 184, 82, .30);
    transition: background .15s, transform .1s, box-shadow .15s;
}
.acc-btn:hover { background: var(--acc-accent-hover); }
.acc-btn:active { transform: scale(.98); }
.acc-btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--acc-accent-ring); }

.acc-btn-secondary {
    background: var(--acc-field);
    color: var(--acc-text);
    box-shadow: none;
}
.acc-btn-secondary:hover { background: var(--acc-field-hover); }

/* Enviando: spinner y sin doble envío */
.acc-btn.is-loading { pointer-events: none; color: transparent; }
.acc-btn.is-loading::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2.5px solid var(--acc-on-accent);
    border-right-color: transparent;
    animation: acc-spin .7s linear infinite;
}
@keyframes acc-spin { to { transform: rotate(360deg); } }

.acc-footer {
    margin-top: 28px;
    text-align: center;
    font-size: 12px;
    color: #a1a1aa;
}
.acc-footer a { color: inherit; }

/* ---------- Registro de empresa (Registro/Index, Registro/Confirmar) ---------- */

.acc-alt {
    margin: 22px 0 0;
    text-align: center;
    font-size: 14px;
    color: var(--acc-text-muted);
}

.acc-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.acc-fila > * { min-width: 0; }
@media (max-width: 380px) { .acc-fila { grid-template-columns: 1fr; } }

.acc-ayuda { margin: 6px 2px 0; font-size: 13px; color: var(--acc-text-muted); }

.acc-seccion {
    margin: 6px 0 -6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--acc-text-muted);
}

/* Datos que trajo ARCA, para confirmar */
.acc-resumen {
    margin: 24px 0 0;
    padding: 16px 18px;
    border: 1px solid var(--acc-border);
    border-radius: var(--acc-radius);
    display: grid;
    gap: 10px;
}
.acc-resumen div { display: grid; gap: 2px; }
.acc-resumen dt { font-size: 12px; font-weight: 600; color: var(--acc-text-muted); }
.acc-resumen dd { margin: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.acc-plan {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--acc-success-bg);
    color: var(--acc-success);
    font-size: 14px;
    font-weight: 600;
}

/* Trampa para robots: un campo que una persona no ve ni completa */
.acc-trampa { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Pantallas medianas: la hoja centrada ---------- */

@media (min-width: 600px) and (max-width: 899.98px) {
    .acc-brand { padding-left: 0; padding-right: 0; display: flex; justify-content: center; }
    .acc-sheet { max-width: 520px; margin: 0 auto; padding-left: 40px; padding-right: 40px; }
}

/* ---------- Escritorio: dos columnas ---------- */

@media (min-width: 900px) {
    body.acc { background: var(--acc-bg); }

    .acc-shell {
        flex-direction: row;
    }

    .acc-brand {
        flex: 0 0 44%;
        max-width: 640px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 48px 56px;
    }

    .acc-brand::before { mask-image: none; -webkit-mask-image: none; opacity: .8; }

    .acc-brand-claim {
        display: block;
        position: relative;
        max-width: 440px;
    }
    .acc-brand-claim h2 {
        margin: 0;
        font-size: 40px;
        line-height: 1.1;
        font-weight: 750;
        letter-spacing: -.03em;
    }
    .acc-brand-claim p {
        margin: 16px 0 0;
        font-size: 17px;
        color: var(--acc-on-brand-muted);
    }

    .acc-main {
        margin-top: 0;
        align-items: center;
        justify-content: center;
        padding: 48px;
        overflow-y: auto;
    }

    .acc-sheet {
        flex: 0 0 auto;
        max-width: 420px;
        padding: 0;
        border-radius: 0;
        box-shadow: none;
        animation-name: acc-fade-in;
    }

    @keyframes acc-fade-in {
        from { transform: translateY(8px); opacity: 0; }
        to { transform: none; opacity: 1; }
    }

    .acc-form { flex: 0 0 auto; }
    .acc-actions { margin-top: 8px; }
    .acc-footer { margin-top: 48px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
