/* ============================================================
   Teyuto Admin v2 — Pagine di accesso (login, recupero, registrazione)
   Caricato DOPO bootstrap/main/dashboard legacy: li neutralizza dove
   serve e porta le pagine sui token admin2 (tema scuro).
   Il markup e i selettori usati dal JS legacy restano gli stessi.
   ============================================================ */

.a2-auth {
    --auth-glow-1: color-mix(in srgb, var(--a2-blue-500) 22%, transparent);
    --auth-glow-2: color-mix(in srgb, var(--a2-violet-500) 20%, transparent);
    --auth-input-h: 44px;

    min-height: 100vh;
    margin: 0;
    background: var(--a2-bg) !important;
    color: var(--a2-text-1);
    font-family: var(--a2-font-sans);
    font-size: var(--a2-text-md);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

html:has(> .a2-auth) {
    background: var(--a2-bg);
    height: auto !important;
}

.a2-auth h1,
.a2-auth h2,
.a2-auth h3,
.a2-auth p,
.a2-auth label,
.a2-auth a {
    font-family: var(--a2-font-sans);
}

.a2-auth a {
    color: var(--a2-text-1);
    text-decoration: none;
    transition: color var(--a2-transition), opacity var(--a2-transition);
}

.a2-auth a:hover,
.a2-auth a:focus {
    color: var(--a2-accent);
    text-decoration: none;
    opacity: 1;
}

.a2-auth ::selection {
    background: var(--a2-accent-soft);
}

.a2-auth :focus-visible {
    outline: 2px solid var(--a2-accent);
    outline-offset: 2px;
}

/* ---------- Layout centrato (login, recupero) ---------- */
.a2-auth .auth-wrap {
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--a2-space-6);
    padding: var(--a2-space-7) var(--a2-space-4) var(--a2-space-5);
    overflow: hidden;
}

/* Glow del brand dietro la card + griglia puntinata che sfuma ai bordi */
.a2-auth .auth-wrap::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -220px;
    left: 50%;
    width: min(1100px, 160vw);
    height: 620px;
    transform: translateX(-50%);
    background:
        radial-gradient(closest-side at 35% 55%, var(--auth-glow-1), transparent),
        radial-gradient(closest-side at 65% 50%, var(--auth-glow-2), transparent);
    filter: blur(20px);
    pointer-events: none;
}

.a2-auth .auth-wrap::after {
    content: "";
    position: absolute;
    z-index: -2;
    inset: 0;
    background-image: radial-gradient(var(--a2-border-strong) 1px, transparent 1px);
    background-size: 22px 22px;
    -webkit-mask-image: radial-gradient(ellipse 60% 50% at 50% 30%, #000 20%, transparent 75%);
    mask-image: radial-gradient(ellipse 60% 50% at 50% 30%, #000 20%, transparent 75%);
    opacity: .5;
    pointer-events: none;
}

.a2-auth .auth-card {
    width: 100%;
    max-width: 420px;
}

.a2-auth .auth-logo {
    display: block;
    height: 28px;
    width: auto;
    margin: 0 auto var(--a2-space-6);
}

.a2-auth .auth-panel {
    position: relative;
    padding: var(--a2-space-6);
    background: color-mix(in srgb, var(--a2-surface-1) 88%, transparent);
    border: 1px solid var(--a2-border);
    border-radius: 18px;
    box-shadow: var(--a2-shadow-2), inset 0 1px 0 rgba(255, 255, 255, .04);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

/* Filo luminoso sul bordo alto della card */
.a2-auth .auth-panel::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 18%;
    right: 18%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--a2-blue-400), var(--a2-violet-500), transparent);
    opacity: .7;
}

/* ---------- Intestazione form ---------- */
.a2-auth .auth-head {
    margin-bottom: var(--a2-space-5);
}

.a2-auth .auth-wrap .auth-head {
    text-align: center;
}

.a2-auth .auth-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-bottom: var(--a2-space-4);
    border-radius: 12px;
    background: var(--a2-accent-soft);
    border: 1px solid color-mix(in srgb, var(--a2-accent) 30%, transparent);
    color: var(--a2-accent);
    font-size: 21px;
}

.a2-auth .auth-step {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: var(--a2-space-3);
    padding: 3px 10px;
    border-radius: var(--a2-radius-full);
    background: var(--a2-accent-soft);
    color: var(--a2-accent);
    font-size: var(--a2-text-xs);
    font-weight: 600;
    letter-spacing: .02em;
}

.a2-auth .auth-title {
    margin: 0;
    color: var(--a2-text-1) !important;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -.02em;
}

.a2-auth .auth-sub {
    margin: var(--a2-space-2) 0 0;
    color: var(--a2-text-2);
    font-size: var(--a2-text-md);
    line-height: 1.55;
}

/* ---------- Campi ---------- */
.a2-auth .auth-field {
    margin-top: var(--a2-space-4);
}

.a2-auth .auth-head + .auth-field {
    margin-top: 0;
}

.a2-auth .auth-field > label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--a2-space-2);
    max-width: none;
    margin: 0 0 6px;
    color: var(--a2-text-1);
    font-size: 13px;
    font-weight: 500;
}

.a2-auth .auth-hint {
    color: var(--a2-text-3) !important;
    font-size: var(--a2-text-xs) !important;
    font-weight: 500 !important;
}

/* Gli esiti scritti dal JS (#passwdControll, #channelNameControl) sono
   label/span .label-green dentro la label del campo: diventano pill */
.a2-auth .auth-hint .label {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 1px 8px;
    border-radius: var(--a2-radius-full);
    border: 0;
    box-shadow: none;
    background: var(--a2-success-soft);
    color: var(--a2-success);
    font-size: var(--a2-text-xs);
    font-weight: 600;
    line-height: 1.6;
}

.a2-auth .auth-input {
    position: relative;
}

.a2-auth .auth-input > i {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: var(--a2-text-3);
    font-size: 17px;
    line-height: 1;
    pointer-events: none;
    transition: color var(--a2-transition);
}

.a2-auth .auth-input:focus-within > i {
    color: var(--a2-accent);
}

.a2-auth .form-control {
    display: block;
    width: 100%;
    height: var(--auth-input-h);
    padding: 0 14px !important;
    border: 1px solid var(--a2-border-strong);
    border-radius: var(--a2-radius-md);
    background: var(--a2-surface-2);
    color: var(--a2-text-1);
    font-family: var(--a2-font-sans);
    font-size: var(--a2-text-md);
    line-height: normal;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    color-scheme: dark;
    transition: border-color var(--a2-transition), box-shadow var(--a2-transition), background var(--a2-transition);
}

.a2-auth .auth-input > i ~ .form-control {
    padding-left: 42px !important;
}

.a2-auth .auth-input:has(.auth-eye) .form-control {
    padding-right: 46px !important;
}

.a2-auth .form-control:hover {
    border-color: color-mix(in srgb, var(--a2-text-1) 28%, transparent);
    background: var(--a2-surface-2);
}

.a2-auth .form-control:focus {
    outline: none;
    border-color: var(--a2-accent);
    background: var(--a2-surface-2);
    box-shadow: 0 0 0 3px var(--a2-accent-soft);
    color: var(--a2-text-1);
}

.a2-auth .form-control[disabled] {
    opacity: .55;
    cursor: not-allowed;
    background: var(--a2-surface-2);
}

.a2-auth .form-control::placeholder {
    color: var(--a2-text-3);
    opacity: 1;
}

/* Il legacy fa scivolare via il placeholder al focus */
.a2-auth [placeholder]:focus::-webkit-input-placeholder {
    transform: none;
    opacity: 1;
}

/* Autofill: niente sfondo giallo. Lo sfondo del browser non si sovrascrive,
   si copre con un'ombra inset del colore del campo */
.a2-auth input:-webkit-autofill,
.a2-auth input:-webkit-autofill:hover,
.a2-auth input:-webkit-autofill:focus,
.a2-auth input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--a2-text-1);
    -webkit-box-shadow: 0 0 0 1000px var(--a2-surface-2) inset;
    caret-color: var(--a2-text-1);
    transition: background-color 9999s ease-out 0s;
}

.a2-auth input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px var(--a2-surface-2) inset, 0 0 0 3px var(--a2-accent-soft);
}

.a2-auth input:autofill {
    -webkit-text-fill-color: var(--a2-text-1);
    box-shadow: 0 0 0 1000px var(--a2-surface-2) inset;
    filter: none;
}

/* Mostra / nascondi password */
.a2-auth .auth-eye {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--a2-text-3);
    font-size: 17px;
    cursor: pointer;
    transition: color var(--a2-transition), background var(--a2-transition);
}

.a2-auth .auth-eye:hover {
    color: var(--a2-text-1);
    background: var(--a2-surface-hover);
}

/* ---------- Bottone primario ---------- */
.a2-auth .btn.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--a2-space-2);
    width: 100%;
    height: var(--auth-input-h);
    margin-top: var(--a2-space-5);
    padding: 0 var(--a2-space-5);
    border: 0;
    border-radius: var(--a2-radius-md);
    background: var(--a2-accent);
    color: var(--a2-accent-text) !important;
    font-family: var(--a2-font-sans);
    font-size: var(--a2-text-md);
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 8px 24px -10px color-mix(in srgb, var(--a2-accent) 70%, transparent);
    transition: filter var(--a2-transition), transform var(--a2-transition), background var(--a2-transition), box-shadow var(--a2-transition);
}

.a2-auth .btn.auth-submit:hover {
    filter: brightness(1.08);
    color: var(--a2-accent-text) !important;
}

.a2-auth .btn.auth-submit:active {
    transform: translateY(1px);
    opacity: 1;
    box-shadow: none !important;
}

.a2-auth .btn.auth-submit i {
    color: inherit !important;
}

/* Disabled leggibile: superficie neutra, non un blu spento */
.a2-auth .btn.auth-submit[disabled],
.a2-auth .btn.auth-submit[disabled]:hover {
    background: var(--a2-surface-3);
    color: var(--a2-text-3) !important;
    box-shadow: none;
    filter: none;
    opacity: 1;
    cursor: not-allowed;
}

/* Spinner del JS legacy (<i class="fa fa-spinner fa-spin">): Font Awesome
   qui non c'e', lo disegniamo noi */
.a2-auth .fa-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    font-family: inherit !important;
    animation: a2-auth-spin .7s linear infinite;
}

.a2-auth .fa-spinner::before {
    content: none;
}

.a2-auth .btn.auth-submit[disabled]:has(.fa-spinner) {
    background: var(--a2-accent);
    color: var(--a2-accent-text) !important;
    cursor: progress;
}

@keyframes a2-auth-spin {
    to { transform: rotate(360deg); }
}

/* ---------- Link e messaggi ---------- */
.a2-auth .auth-links {
    margin-top: var(--a2-space-4);
    text-align: center;
    font-size: 13px;
}

.a2-auth .auth-links a {
    color: var(--a2-text-2);
    font-weight: 500;
}

.a2-auth .auth-links a:hover {
    color: var(--a2-text-1);
}

.a2-auth .auth-links a i {
    margin-right: 4px;
    vertical-align: -2px;
}

.a2-auth .auth-alt {
    margin: var(--a2-space-5) 0 0;
    padding-top: var(--a2-space-4);
    border-top: 1px solid var(--a2-border);
    color: var(--a2-text-2);
    font-size: 13px;
    text-align: center;
}

.a2-auth .auth-alt a {
    color: var(--a2-accent);
    font-weight: 600;
}

.a2-auth .auth-alt a:hover {
    color: var(--a2-accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Esito del recupero: il JS scrive testo + colore inline */
.a2-auth #recover_response {
    margin-top: var(--a2-space-4);
    padding: 10px 14px;
    border-radius: var(--a2-radius-md);
    background: var(--a2-surface-2);
    border: 1px solid var(--a2-border);
    font-size: 13px;
    font-weight: 600 !important;
    text-align: center;
}

.a2-auth #recover_response:empty {
    display: none;
}

.a2-auth .auth-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 16px;
    color: var(--a2-text-3);
    font-size: var(--a2-text-xs);
}

.a2-auth .auth-foot a {
    color: var(--a2-text-3);
}

.a2-auth .auth-foot a:hover {
    color: var(--a2-text-1);
}

/* ---------- Checkbox (consensi registrazione) ---------- */
.a2-auth .auth-check {
    position: relative;
    margin-top: var(--a2-space-3);
}

.a2-auth .auth-checks {
    margin-top: var(--a2-space-5);
}

.a2-auth .auth-checks .auth-check:first-child {
    margin-top: 0;
}

/* Label a blocco (non flex): dentro c'e' testo + link inline che devono
   andare a capo insieme. La casella e' posizionata a sinistra. */
.a2-auth .styled-checkbox + label {
    display: block;
    position: relative;
    max-width: none;
    margin: 0;
    padding-left: 28px;
    color: var(--a2-text-2);
    font-size: 13px !important;
    font-weight: 400 !important;
    line-height: 1.5;
    cursor: pointer;
}

.a2-auth .styled-checkbox + label:before {
    position: absolute;
    left: 0;
    top: 1px;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1px solid var(--a2-border-strong);
    border-radius: 5px;
    background: var(--a2-surface-2);
    transition: background var(--a2-transition), border-color var(--a2-transition), box-shadow var(--a2-transition);
}

.a2-auth .styled-checkbox:hover + label:before {
    opacity: 1;
    background: var(--a2-surface-2);
    border-color: color-mix(in srgb, var(--a2-text-1) 35%, transparent);
}

.a2-auth .styled-checkbox:focus-visible + label:before {
    box-shadow: 0 0 0 3px var(--a2-accent-soft);
    border-color: var(--a2-accent);
}

.a2-auth .styled-checkbox:checked + label:before {
    background: var(--a2-accent);
    border-color: var(--a2-accent);
}

/* Spunta: rettangolo ruotato con due bordi */
.a2-auth .styled-checkbox:checked + label:after {
    content: "";
    position: absolute;
    left: 6px;
    top: 4px;
    width: 6px;
    height: 10px;
    background: none;
    border: solid var(--a2-accent-text);
    border-width: 0 2px 2px 0;
    box-shadow: none;
    transform: rotate(45deg);
}

.a2-auth .styled-checkbox + label a {
    color: var(--a2-text-1) !important;
    font-weight: 600 !important;
    text-decoration: underline;
    text-decoration-color: var(--a2-border-strong);
    text-underline-offset: 3px;
}

.a2-auth .styled-checkbox + label a:hover {
    text-decoration-color: currentColor;
}

.a2-auth .auth-req {
    color: var(--a2-danger);
    margin-left: 2px;
}

/* ---------- Toast legacy ---------- */
.a2-auth .toast_notification {
    margin: var(--a2-space-4) 0;
    padding: 12px 16px;
    border: 1px solid var(--a2-border-strong);
    border-radius: var(--a2-radius-md);
    box-shadow: var(--a2-shadow-2);
    font-family: var(--a2-font-sans);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
}

/* ============================================================
   Registrazione: split marketing | form
   ============================================================ */
.a2-auth .auth-split {
    min-height: 100vh;
}

.a2-auth .auth-split > .auth-cols {
    display: flex;
    width: 100%;
    margin: 0;
    padding: 0;
    float: none;
}

.a2-auth .auth-cols > [class*="col-"] {
    float: none;
    padding: 0;
}

/* --- Pannello marketing ---
   (.auth-cols > .auth-aside: deve battere il reset delle col- qui sopra) */
.a2-auth .auth-cols > .auth-aside {
    position: sticky;
    top: 0;
    flex: 0 0 50%;
    width: 50%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: var(--a2-space-5);
    padding: 40px 56px 32px;
    overflow: hidden;
    isolation: isolate;
    background: var(--a2-surface-1);
    border-right: 1px solid var(--a2-border);
    color: var(--a2-text-1);
}

.a2-auth .auth-aside::before {
    content: "";
    position: absolute;
    z-index: -1;
    inset: -20% -30% auto -20%;
    height: 85%;
    background:
        radial-gradient(closest-side at 30% 45%, var(--auth-glow-1), transparent),
        radial-gradient(closest-side at 70% 35%, var(--auth-glow-2), transparent);
    filter: blur(30px);
    pointer-events: none;
}

.a2-auth .auth-aside::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: 0;
    background-image: radial-gradient(var(--a2-border-strong) 1px, transparent 1px);
    background-size: 22px 22px;
    -webkit-mask-image: linear-gradient(180deg, #000, transparent 55%);
    mask-image: linear-gradient(180deg, #000, transparent 55%);
    opacity: .45;
    pointer-events: none;
}

.a2-auth .auth-aside .auth-brand {
    flex: 0 0 auto;
    align-self: flex-start;
    height: 28px;
    width: auto;
}

.a2-auth .auth-aside-copy {
    flex: 0 0 auto;
    margin-top: var(--a2-space-5);
}

.a2-auth .auth-aside h2 {
    max-width: 560px;
    margin: 0;
    color: var(--a2-text-1) !important;
    font-size: clamp(30px, 2.6vw, 42px);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -.03em;
}

.a2-auth .auth-aside-sub {
    max-width: 520px;
    margin: var(--a2-space-3) 0 0;
    color: var(--a2-text-2) !important;
    font-size: 17px;
    line-height: 1.5;
}

/* L'immagine prodotto si prende lo spazio che resta e si riduce se serve:
   il pannello e' alto quanto la viewport */
.a2-auth .auth-aside-shot {
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    max-width: 640px;
    margin: 0;
    object-fit: contain;
    object-position: left center;
    filter: drop-shadow(0 30px 50px rgba(0, 0, 0, .45));
}

/* Testimonial (swiffy-slider) */
.a2-auth .auth-aside .swiffy-slider {
    flex: 0 0 auto;
    max-width: 640px;
    padding: 18px 20px;
    border: 1px solid var(--a2-border);
    border-radius: var(--a2-radius-lg);
    background: color-mix(in srgb, var(--a2-surface-2) 70%, transparent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.a2-auth .auth-aside .slider-container > li {
    display: flex !important;
    align-items: flex-start;
    gap: 14px;
    width: 100%;
    padding: 0;
    float: none;
    list-style: none;
}

.a2-auth .auth-aside .slider-container > li > [class*="col-"] {
    float: none;
    padding: 0;
}

.a2-auth .auth-aside .slider-container > li > .col-md-2 {
    flex: 0 0 40px;
    width: 40px;
}

.a2-auth .auth-aside .slider-container > li > .col-md-2 img {
    width: 40px;
    height: 40px;
    border-radius: 50% !important;
    object-fit: cover;
    border: 1px solid var(--a2-border-strong);
}

.a2-auth .auth-aside .slider-container > li > .col-md-10 {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}

.a2-auth .auth-aside .slider-container p {
    margin: 0;
    color: var(--a2-text-1) !important;
    font-size: 13.5px;
    font-weight: 400;
    line-height: 1.55;
}

.a2-auth .auth-aside .slider-container p + p {
    margin-top: 8px;
    color: var(--a2-text-3) !important;
    opacity: 1 !important;
    font-size: var(--a2-text-xs) !important;
    font-weight: 500;
}

/* --- Colonna form --- */
.a2-auth .auth-main {
    flex: 1 1 50%;
    width: 50%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--a2-space-7) var(--a2-space-5) !important;
    color: var(--a2-text-1);
}

.a2-auth .auth-main-inner {
    width: 100%;
    max-width: 420px;
}

.a2-auth .auth-main .auth-brand-mobile {
    display: block;
    height: 28px;
    width: auto;
    margin: 0 0 var(--a2-space-6);
}

/* Anteprima indirizzo del canale (step 2) */
/* Flusso inline, non flex: "https://" + span + ".teyuto.tv" sono nodi di
   testo che non devono separarsi */
.a2-auth .auth-url {
    display: block;
    margin: var(--a2-space-2) 0 0;
    padding: 8px 12px;
    border: 1px dashed var(--a2-border-strong);
    border-radius: var(--a2-radius-md);
    color: var(--a2-text-2) !important;
    font-family: var(--a2-font-mono);
    font-size: 12.5px;
    font-weight: 400 !important;
    letter-spacing: 0 !important;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.a2-auth .auth-url i {
    margin-right: 6px;
    color: var(--a2-text-3);
    font-size: 15px;
    vertical-align: -3px;
}

.a2-auth .auth-url #domain_url_preview {
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    color: var(--a2-accent);
    font-weight: 700 !important;
    font-size: inherit;
    line-height: inherit;
    vertical-align: baseline;
}

.a2-auth .auth-url #domain_url_preview:empty::before {
    content: "your-channel";
    color: var(--a2-text-3);
    font-weight: 400;
}

/* Sotto i 992px il pannello marketing sparisce (come gia' sotto i 768
   con hidden-xs) e resta il solo form, col logo mobile */
@media (max-width: 991px) {
    .a2-auth .auth-aside {
        display: none !important;
    }

    .a2-auth .auth-main {
        flex-basis: 100%;
        width: 100%;
        align-items: flex-start;
        padding: 40px var(--a2-space-4) var(--a2-space-6) !important;
    }
}

@media (max-width: 480px) {
    .a2-auth .auth-wrap {
        justify-content: flex-start;
        padding-top: 40px;
    }

    .a2-auth .auth-panel {
        padding: var(--a2-space-5) 20px;
        border-radius: var(--a2-radius-lg);
    }

    .a2-auth .auth-title {
        font-size: 22px;
    }
}
