/* ==========================================================================
   EXERCITIA - ROLE CHOICE PAGE
   ========================================================================== */

:root {
    --tl-brand-blue: #0d2e57;
    --tl-brand-yellow: #fec10d;
    --tl-text-dark: #0f172a;
    --tl-text-soft: #94a3b8;
    --tl-text-light: #e2e8f0;
    --tl-bg-page: #f0f2f5;
    --tl-bg-card-light: #ffffff;
    --tl-border-light: #e2e8f0;
    --tl-radius-md: 12px;
    --tl-radius-lg: 24px;
    --tl-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.tutor-lab-role-choice-page {
    padding: 40px 20px;
    min-height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--tl-bg-page);
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.role-choice-container {
    width: 100%;
    max-width: 900px;
    text-align: center;
    margin: 0 auto;
}

.role-choice-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
}

.role-choice-logo {
    max-width: 200px;
    height: auto;
    margin: 0 auto;
    display: block;
}

.role-choice-logo-fallback {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 28px;
    font-weight: 800;
    color: var(--tl-brand-blue);
}

.role-choice-logo-fallback i {
    color: var(--tl-brand-yellow);
    font-size: 32px;
}

.role-choice-header h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 800;
    color: var(--tl-text-dark);
    margin: 0 0 10px 0;
    letter-spacing: -1.5px;
}

.role-choice-header p {
    font-size: 1.1rem;
    color: var(--tl-text-soft);
    margin: 0 auto 50px;
    max-width: 550px;
}

.role-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.role-card {
    background: var(--tl-bg-card-light);
    border-radius: var(--tl-radius-lg);
    padding: 40px 30px;
    border: 2px solid var(--tl-border-light);
    transition: var(--tl-transition);
    cursor: pointer;
}

.role-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -15px rgba(0, 46, 91, 0.15);
}

.student-card:hover {
    border-color: #4338ca;
}

.teacher-card:hover {
    border-color: var(--tl-brand-yellow);
}

.role-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    transition: var(--tl-transition);
}

.student-card .role-icon {
    background: linear-gradient(135deg, #eef2ff, #ddd6fe);
    color: #4338ca;
}

.teacher-card .role-icon {
    background: linear-gradient(135deg, #fef3c7, #fde047);
    color: var(--tl-brand-blue);
}

.role-card:hover .role-icon {
    transform: scale(1.1) rotate(5deg);
}

.role-card h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--tl-text-dark);
    margin: 0 0 10px;
}

.role-card p {
    font-size: 1rem;
    color: var(--tl-text-soft);
    margin: 0 0 25px;
    line-height: 1.6;
}

.role-btn {
    width: 100%;
    padding: 16px 24px;
    border-radius: var(--tl-radius-md);
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: var(--tl-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.role-btn:hover {
    transform: translateY(-3px);
}

.student-btn {
    background: #4338ca;
    color: white;
}

.student-btn:hover {
    background: #3730a3;
}

.teacher-btn {
    background: var(--tl-brand-yellow);
    color: var(--tl-brand-blue);
}

.teacher-btn:hover {
    background: #ffcf40;
}

.login-link-container {
    margin-top: 30px;
    margin-bottom: 20px;
}

.login-link-container p {
    color: var(--tl-text-soft);
    font-size: 1rem;
}

.login-link {
    color: var(--tl-brand-blue);
    font-weight: 600;
    text-decoration: none;
}

.login-link:hover {
    text-decoration: underline;
}

.back-to-site-link {
    color: var(--tl-text-soft);
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.back-to-site-link:hover {
    color: var(--tl-text-dark);
}

/* ==========================================================================
   INVITE MODE STYLES
   ========================================================================== */

.invite-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.invite-badge i {
    font-size: 1.1rem;
}

.role-cards-container.single-card {
    grid-template-columns: 1fr;
    max-width: 450px;
    margin: 0 auto 40px;
}

.role-card.invited {
    border: 2px solid #22c55e;
    background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
}

.role-card.invited .role-icon {
    background: linear-gradient(135deg, #d1fae5, #bbf7d0);
    color: #15803d;
}

.role-card.invited .role-btn {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.role-card.invited .role-btn:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

/* ==========================================================================
   TEACHER REQUEST MODAL
   ========================================================================== */

.teacher-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.teacher-modal.is-visible {
    opacity: 1;
    pointer-events: all;
}

.teacher-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

.teacher-modal-content {
    position: relative;
    background: white;
    border-radius: var(--tl-radius-lg);
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.teacher-modal.is-visible .teacher-modal-content {
    transform: scale(1);
}

.teacher-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--tl-text-soft);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--tl-transition);
}

.teacher-modal-close:hover {
    background: var(--tl-bg-page);
    color: var(--tl-text-dark);
}

.teacher-form-header {
    text-align: center;
    margin-bottom: 30px;
}

.teacher-form-logo {
    max-width: 150px;
    height: auto;
    margin: 0 auto 20px;
    display: block;
}

.teacher-form-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--tl-text-dark);
    margin: 0 0 10px;
}

.teacher-form-header p {
    font-size: 1rem;
    color: var(--tl-text-soft);
    margin: 0;
}

/* Google Sign In */
.google-signin-container {
    margin-bottom: 30px;
}

.google-signin-btn {
    width: 100%;
    padding: 14px 20px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: var(--tl-radius-md);
    font-size: 1rem;
    font-weight: 600;
    color: var(--tl-text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: var(--tl-transition);
}

.google-signin-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.google-signin-btn.google-signed-in {
    background: #f0fdf4;
    border-color: #86efac;
    color: #166534;
    cursor: default;
    transform: none;
}

.google-signin-btn.google-signed-in:hover {
    background: #f0fdf4;
    border-color: #86efac;
    transform: none;
}

.divider-text {
    text-align: center;
    margin: 20px 0;
    color: var(--tl-text-soft);
    font-size: 0.9rem;
    position: relative;
}

.divider-text::before,
.divider-text::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--tl-border-light);
}

.divider-text::before {
    left: 0;
}

.divider-text::after {
    right: 0;
}

/* Form Styles */
.teacher-request-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.teacher-request-form .form-field {
    text-align: left;
    margin-bottom: 20px;
}

.teacher-request-form .form-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--tl-text-dark);
    font-size: 0.95rem;
}

.teacher-request-form .form-field input {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
    border: 2px solid var(--tl-border-light);
    border-radius: var(--tl-radius-md);
    background: white;
    color: var(--tl-text-dark);
    transition: var(--tl-transition);
}

.teacher-request-form .form-field input:focus {
    border-color: var(--tl-brand-yellow);
    outline: none;
    box-shadow: 0 0 0 4px rgba(254, 193, 13, 0.1);
}

.teacher-request-form .privacy-field {
    margin-top: 10px;
}

.privacy-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.privacy-label input[type="checkbox"] {
    width: auto;
    margin-top: 4px;
    flex-shrink: 0;
}

.privacy-label span {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--tl-text-soft);
}

.privacy-label a {
    color: var(--tl-brand-blue);
    font-weight: 600;
}

.teacher-form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    padding: 14px 24px;
    border-radius: var(--tl-radius-md);
    font-size: 1rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: var(--tl-transition);
}

.btn-primary {
    background: var(--tl-brand-yellow);
    color: var(--tl-brand-blue);
}

.btn-primary:hover {
    background: #ffcf40;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--tl-bg-page);
    color: var(--tl-text-dark);
}

.btn-secondary:hover {
    background: #e2e8f0;
}

/* Success Feedback */
.teacher-form-feedback {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 5rem;
    color: #22c55e;
    margin-bottom: 20px;
}

.teacher-form-feedback h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--tl-text-dark);
    margin: 0 0 15px;
}

.teacher-form-feedback p {
    font-size: 1rem;
    color: var(--tl-text-soft);
    margin: 0 0 30px;
    line-height: 1.6;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tutor-lab-role-choice-page {
        padding: 30px 15px;
    }

    .role-choice-logo {
        max-width: 150px;
        margin-bottom: 20px;
    }

    .role-choice-header h1 {
        font-size: 2rem;
        margin-bottom: 8px;
    }

    .role-choice-header p {
        font-size: 1rem;
        margin-bottom: 30px;
    }

    .role-cards-container {
        gap: 20px;
        grid-template-columns: 1fr;
    }

    .role-card {
        padding: 30px 25px;
    }

    .role-icon {
        width: 70px;
        height: 70px;
        font-size: 35px;
    }

    .teacher-modal-content {
        padding: 30px 20px;
        width: 95%;
    }

    .teacher-request-form .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .teacher-form-actions {
        flex-direction: column;
    }

    .teacher-form-header h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .role-card h3 {
        font-size: 1.5rem;
    }

    .role-card p {
        font-size: 0.95rem;
    }

    .role-btn {
        padding: 14px 20px;
        font-size: 0.95rem;
    }
}

/* Sotto le due scelte: chi è insegnante ma frequenta un corso sceglie «Partecipo a un corso». */
.role-choice-hint { max-width: 640px; margin: 22px auto 0; padding: 12px 16px; border-radius: 12px; background: #eef2ff; color: #3730a3; font-size: 15px; line-height: 1.5; text-align: center; }
.role-choice-hint i { margin-right: 4px; vertical-align: -2px; }

/* ==========================================================================
   Registrazione 5.0: due metà. A sinistra il pannello del marchio (logo, titolo,
   vantaggi), a destra l'unica azione. Sul telefono una sopra l'altra.
   ========================================================================== */
.tutor-lab-role-choice-page.is-v5 { padding: 32px 20px; background: radial-gradient(1200px 600px at 85% -10%, #e0e7ff 0%, rgba(224, 231, 255, 0) 60%), #f1f3f9; }
.is-v5 .role-choice-container { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); max-width: 1060px; min-height: 580px; text-align: left; border-radius: 28px; background: #fff; box-shadow: 0 30px 80px -30px rgba(13, 46, 87, .35), 0 0 0 1px rgba(13, 46, 87, .06); overflow: hidden; }
.is-v5 .rc-side { position: relative; display: flex; flex-direction: column; gap: 28px; padding: 44px 44px 40px; color: #fff; background: radial-gradient(500px 300px at 110% 110%, rgba(254, 193, 13, .28), rgba(254, 193, 13, 0) 70%), linear-gradient(160deg, #0d2e57 0%, #172554 55%, #1e1b4b 100%); overflow: hidden; }
.is-v5 .rc-side::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1.2px); background-size: 18px 18px; -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 60%); mask-image: linear-gradient(180deg, transparent 0%, #000 60%); pointer-events: none; }
.is-v5 .rc-side > * { position: relative; z-index: 1; }
.is-v5 .role-choice-brand { justify-content: flex-start; margin: 0; }
.is-v5 .role-choice-logo { max-width: 170px; margin: 0; padding: 10px 14px; border-radius: 16px; background: #fff; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.is-v5 .role-choice-logo-fallback { color: #fff; }
.is-v5 .role-choice-header { margin-top: auto; }
.is-v5 .role-choice-header h1 { margin: 0 0 12px; font-size: clamp(2.4rem, 4.2vw, 3.4rem); line-height: 1.02; letter-spacing: -0.03em; color: #fff; }
.is-v5 .role-choice-header p { max-width: 420px; margin: 0 0 26px; font-size: 1.15rem; line-height: 1.5; color: #c7d2fe; }
.is-v5 .rc-benefits { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.is-v5 .rc-benefits li { display: flex; align-items: flex-start; gap: 12px; font-size: 1rem; line-height: 1.45; color: #e0e7ff; }
.is-v5 .rc-benefits li::before { content: "✓"; flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #fec10d; color: #0d2e57; font-size: 13px; font-weight: 900; }
.is-v5 .invite-badge { background: rgba(255, 255, 255, .14); color: #fff; }
.is-v5 .rc-main { display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 44px 44px 32px; }
.is-v5 .role-cards-container, .is-v5 .role-cards-container.single-card { display: block; max-width: none; margin: 0; }
.is-v5 .role-card { padding: 0; border: 0; background: transparent; box-shadow: none; cursor: default; text-align: left; }
.is-v5 .role-card:hover { transform: none; box-shadow: none; }
.is-v5 .role-icon { width: 64px; height: 64px; margin: 0 0 18px; border-radius: 18px; }
.is-v5 .role-card h3 { margin: 0 0 8px; font-size: 1.7rem; letter-spacing: -0.01em; color: #0f172a; }
.is-v5 .role-card p { margin: 0 0 26px; font-size: 1.02rem; line-height: 1.55; color: #475569; }
.is-v5 .role-btn { width: 100%; min-height: 56px; justify-content: center; font-size: 1.05rem; border-radius: 14px; box-shadow: 0 12px 24px -12px rgba(67, 56, 202, .7); }
.is-v5 .teacher-btn { box-shadow: 0 12px 24px -12px rgba(254, 193, 13, .9); }
.is-v5 .role-btn:active { transform: scale(.98); }
.is-v5 #student-reg-inline .role-choice-header h2 { color: #0f172a; }
.is-v5 #student-reg-inline .role-choice-header p { color: #475569; margin-bottom: 14px; }
.is-v5 .login-link-container { margin: 6px 0 0; padding-top: 18px; border-top: 1px solid #e2e8f0; text-align: left; }
.is-v5 .login-link-container p { margin: 0; color: #64748b; }
.is-v5 .back-to-site-link { align-self: flex-start; margin: 0; }
.is-v5 .tl-class-invite, .is-v5 [class*="class-invite"] { color: #0f172a; }
@media (max-width: 860px) {
    .is-v5 .role-choice-container { grid-template-columns: minmax(0, 1fr); min-height: 0; border-radius: 22px; }
    .is-v5 .rc-side { gap: 18px; padding: 26px 24px 28px; }
    .is-v5 .role-choice-header h1 { font-size: 2.2rem; }
    .is-v5 .role-choice-header p { margin-bottom: 16px; font-size: 1.05rem; }
    .is-v5 .rc-benefits { gap: 8px; }
    .is-v5 .rc-main { padding: 26px 24px 24px; }
    .is-v5 .role-choice-logo { max-width: 120px; padding: 8px 10px; border-radius: 12px; }
}
@media (max-width: 480px) {
    .tutor-lab-role-choice-page.is-v5 { padding: 12px; }
    .is-v5 .role-card h3 { font-size: 1.45rem; }
}
@media (prefers-reduced-motion: reduce) { .is-v5 .role-btn:active { transform: none; } }
