/* ============================================
   DigenioAI v2 — Auth pages (sign-in / sign-up / recover password)
   Layout indipendente dalla shell dashboard (digenio-admin.css):
   pagine a schermo intero, senza sidebar/header.
   ============================================ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; font-family: 'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; -webkit-font-smoothing: antialiased; }

:root {
    --primary:        #7c4baf;
    --primary-rgb:    124, 75, 175;
    --primary-light:  #f3edfb;
    --secondary:      #2fa2ff;
    --success:        #3cd188;
    --success-rgb:    60, 209, 136;
    --danger:         #f04770;
    --danger-rgb:     240, 71, 112;
    --body-bg:        #f5f6f9;
    --card-bg:        #ffffff;
    --border:         #e9ebec;
    --text:           #212529;
    --muted:          #878a99;
    --label:          #343a40;
    --radius:         10px;
    --transition:     0.2s ease;
}

.auth-page {
    min-height: 100vh;
    display: flex;
    background: var(--body-bg);
}

/* ---- LEFT — branding panel ---- */
.auth-left {
    flex: 1;
    /* Fallback shown until/unless the video loads */
    background: linear-gradient(135deg, #4a2776 0%, #7c4baf 50%, #2fa2ff 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 48px;
    position: relative;
    overflow: hidden;
}
.auth-left-video {
    position: absolute;
    top: 50%; left: 50%;
    min-width: 100%; min-height: 100%;
    width: auto; height: auto;
    transform: translate(-50%, -50%);
    object-fit: cover;
    z-index: 0;
}
.auth-left::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    top: -120px; left: -120px;
    z-index: 2;
}
.auth-left::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    bottom: -80px; right: -80px;
    z-index: 2;
}

.auth-left-inner { position: relative; z-index: 3; text-align: center; max-width: 400px; }

.auth-brand {
    font-size: 31px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -1px;
    margin-bottom: 32px;
}
.auth-brand span { color: rgba(255,255,255,0.65); }

.auth-illustration {
    width: 100%;
    max-width: 340px;
    margin: 0 auto 36px;
    background: rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 40px;
    border: 1px solid rgba(255,255,255,0.12);
}
.auth-illustration svg { width: 100%; height: auto; opacity: 0.92; }

.auth-tagline {
    color: rgba(255,255,255,0.9);
    font-size: 19px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 12px;
}
.auth-sub {
    color: rgba(255,255,255,0.55);
    font-size: 16px;
    line-height: 1.6;
}

/* Step dots (sign-up) */
.step-dots { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 32px; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.3); }
.step-dot.active { width: 24px; border-radius: 4px; background: #fff; }

/* ---- RIGHT — form panel ---- */
.auth-right {
    width: 480px;
    flex-shrink: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    position: relative;
    overflow-y: auto;
}

.auth-form-wrap { width: 100%; max-width: 380px; }

.auth-form-header { margin-bottom: 32px; }
.auth-form-title { font-size: 21px; font-weight: 700; color: var(--label); margin-bottom: 6px; }
.auth-form-subtitle { font-size: 16px; color: var(--muted); line-height: 1.5; }

/* Back link (recover password) */
.back-link {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 15px; font-weight: 500; color: var(--muted);
    margin-bottom: 28px;
    transition: color var(--transition);
}
.back-link:hover { color: var(--primary); }

/* Step tabs (recover password) */
.steps-wrap { display: flex; gap: 0; margin-bottom: 28px; border-bottom: 2px solid var(--border); }
.step-tab {
    flex: 1; text-align: center; padding: 8px 4px;
    font-size: 14px; font-weight: 600; color: var(--muted);
    position: relative;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.step-tab.active { color: var(--primary); }
.step-tab.active::after {
    content: ''; position: absolute; bottom: -2px; left: 0; right: 0; height: 2px;
    background: var(--primary); border-radius: 1px;
}
.step-tab.done { color: var(--success); }
.step-num {
    width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid currentColor;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.step-tab.done .step-num { background: var(--success); border-color: var(--success); color: #fff; }

/* Form elements */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { margin-bottom: 18px; }

.form-label { display: block; font-size: 15px; font-weight: 600; color: var(--label); margin-bottom: 6px; }

.input-wrap { position: relative; }

.input-icon {
    position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
    color: var(--muted); display: flex; align-items: center; pointer-events: none;
}

.form-control {
    width: 100%; height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--body-bg);
    padding: 0 40px;
    font-size: 16px;
    font-family: 'Jost', sans-serif;
    color: var(--text);
    outline: none;
    transition: all var(--transition);
}
.form-control:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}
.form-control::placeholder { color: #b0b3bc; }
.form-control.no-left-icon { padding-left: 14px; }
.form-control.plain { padding: 0 14px; }

/* Live validation states (sign-up) */
.form-control.is-success { border-color: var(--success); background: rgba(var(--success-rgb), 0.08); color: #1b8a5a; }
.form-control.is-danger  { border-color: var(--danger);  background: rgba(var(--danger-rgb), 0.08);  color: #b3123a; }
.input-check-icon {
    position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
    font-size: 16px; font-weight: 700; opacity: 0; transition: opacity var(--transition);
    pointer-events: none;
}
.input-check-icon.show { opacity: 1; }
.input-check-icon.success { color: var(--success); }
.input-check-icon.danger  { color: var(--danger); }

.input-toggle {
    position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
    cursor: pointer; color: var(--muted);
    background: none; border: none; padding: 0;
    display: flex; align-items: center;
    transition: color var(--transition);
}
.input-toggle:hover { color: var(--primary); }

/* Row helpers */
.row-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.forgot-link { font-size: 14.5px; font-weight: 500; color: var(--primary); }
.forgot-link:hover { text-decoration: underline; }

/* Checkbox */
.check-group { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; }
.check-group input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.check-group label { font-size: 15px; color: var(--muted); cursor: pointer; }

/* Terms (sign-up) */
.terms-group { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 22px; margin-top: 4px; }
.terms-group input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; margin-top: 2px; }
.terms-group label { font-size: 15px; color: var(--muted); line-height: 1.5; }
.terms-group a { color: var(--primary); font-weight: 500; }

/* Password strength (sign-up) */
.pwd-strength { margin-top: 8px; }
.pwd-bar { display: flex; gap: 4px; margin-bottom: 4px; }
.pwd-seg { flex: 1; height: 3px; border-radius: 2px; background: var(--border); transition: background 0.3s; }
.pwd-seg.weak   { background: var(--danger); }
.pwd-seg.fair   { background: var(--secondary); }
.pwd-seg.strong { background: var(--success); }
.pwd-label { font-size: 13px; color: var(--muted); }

/* OTP input (recover password) */
.otp-wrap { display: flex; gap: 10px; }
.otp-input {
    flex: 1; height: 52px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--body-bg);
    font-size: 21px; font-weight: 700;
    text-align: center; font-family: 'Jost', sans-serif;
    color: var(--primary); outline: none;
    transition: all var(--transition);
}
.otp-input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1); }

.resend-line { display: flex; align-items: center; justify-content: space-between; font-size: 14.5px; color: var(--muted); margin-top: 8px; }
.resend-btn { background: none; border: none; cursor: pointer; color: var(--primary); font-size: 14.5px; font-weight: 500; font-family: 'Jost', sans-serif; transition: opacity var(--transition); }
.resend-btn:hover { opacity: 0.75; }
.resend-btn:disabled { opacity: 0.4; cursor: default; }

/* Alert boxes (info / error / success) */
.alert-info, .alert-danger, .alert-success {
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 15px;
    display: flex; align-items: flex-start; gap: 10px;
    margin-bottom: 20px;
    line-height: 1.5;
}
.alert-info svg, .alert-danger svg, .alert-success svg { flex-shrink: 0; margin-top: 1px; }
.alert-info    { background: rgba(var(--primary-rgb), 0.06); border: 1px solid rgba(var(--primary-rgb), 0.2); color: var(--primary); }
.alert-danger  { background: rgba(var(--danger-rgb), 0.07);  border: 1px solid rgba(var(--danger-rgb), 0.25);  color: var(--danger); }
.alert-success { background: rgba(var(--success-rgb), 0.08); border: 1px solid rgba(var(--success-rgb), 0.25); color: #1b8a5a; }

/* Submit button */
.btn-auth {
    width: 100%;
    height: 46px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 17px;
    font-weight: 600;
    font-family: 'Jost', sans-serif;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition);
    letter-spacing: 0.2px;
    display: inline-flex; align-items: center; justify-content: center;
    text-decoration: none;
}
.btn-auth:hover { background: #6a3f96; box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.35); }
.btn-auth:disabled { opacity: 0.6; cursor: default; }

/* Divider */
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 24px 0; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-divider span { font-size: 14px; color: var(--muted); white-space: nowrap; }

/* Social buttons */
.social-btns { display: flex; justify-content: center; gap: 12px; }
.btn-social {
    flex: 1; height: 42px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    font-size: 15px; font-weight: 500;
    font-family: 'Jost', sans-serif;
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
}
.btn-social:hover { background: var(--body-bg); border-color: var(--primary); color: var(--primary); }

/* Success state (recover password) */
.success-card { display: none; text-align: center; padding: 20px 0; }
.success-icon {
    width: 72px; height: 72px; border-radius: 50%;
    background: rgba(var(--success-rgb), 0.12);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
}
.success-title { font-size: 19px; font-weight: 700; color: var(--label); margin-bottom: 8px; }
.success-sub { font-size: 16px; color: var(--muted); margin-bottom: 28px; line-height: 1.6; }

/* Bottom link */
.auth-bottom { margin-top: 28px; text-align: center; font-size: 14.5px; color: var(--muted); }
.auth-bottom a { color: var(--primary); font-weight: 600; }
.auth-bottom a:hover { text-decoration: underline; }

/* Footer note */
.auth-footer { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center; font-size: 14px; color: #b0b3bc; }

/* Demo/env banner (sign-in-demo) */
.demo-banner {
    background: rgba(var(--secondary), 0.08);
    background: rgba(47,162,255,0.08);
    border: 1px solid rgba(47,162,255,0.25);
    color: #1867a8;
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 14.5px;
    text-align: center;
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 960px) { .auth-left { display: none; } .auth-right { width: 100%; padding: 40px 24px; } }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }
