/* Derivado do CSS do original para clone fiel local. */
.langsw { position: relative; display: inline-flex; align-items: center; }
.langsw-trigger {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border: 1.5px solid #eee; border-radius: 50px;
    background: #fff; color: #333; font-family: "Outfit", sans-serif;
    font-size: 14px; font-weight: 500; cursor: pointer; line-height: 1;
    transition: border-color .2s, background .2s; white-space: nowrap;
}
.langsw-trigger:hover { border-color: #FF8A3D; background: #FFF8F0; }
.langsw-trigger .fi { width: 18px; height: 13px; border-radius: 2px; flex-shrink: 0; }
.langsw-code { font-size: 13px; font-weight: 600; letter-spacing: .03em; }
.langsw-chevron { width: 10px; height: 10px; flex-shrink: 0; transition: transform .2s; color: #999; }
.langsw.open .langsw-chevron { transform: rotate(180deg); }
.langsw-panel {
    display: none; position: absolute; top: calc(100% + 8px); right: 0;
    background: #fff; border: 1px solid #eee; border-radius: 14px;
    box-shadow: 0 8px 28px rgba(0,0,0,.10); min-width: 170px;
    z-index: 2000; padding: 6px; max-height: 340px; overflow-y: auto;
}
.langsw.open .langsw-panel { display: block; }
.langsw-item {
    display: flex; align-items: center; gap: 9px; padding: 8px 10px;
    border-radius: 8px; font-size: 14px; color: #333;
    text-decoration: none; transition: background .15s; white-space: nowrap;
}
.langsw-item:hover { background: #FFF8F0; }
.langsw-item-active { background: #FFF8F0; font-weight: 600; color: #FF8A3D; }
.langsw-item .fi { width: 20px; height: 15px; border-radius: 2px; flex-shrink: 0; }
@media (max-width: 900px) {
    .langsw-panel { right: auto; left: 0; }
}
        :root {
            --primary: #FF8A3D;
            --primary-dark: #e07b2d;
            --text-dark: #1a1a1a;
            --text-gray: #666666;
            --text-light: #9ca3af;
            --bg-beige: #FFF8F0;
            --white: #ffffff;
            --border-light: #e5e7eb;
            --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
            --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
            --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
            --border-radius: 12px;
            --border-radius-lg: 16px;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Outfit', sans-serif;
            line-height: 1.6;
            color: var(--text-dark);
            background: var(--bg-beige);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 2rem 2rem 3rem;
        }

        .login-container {
            width: 100%;
            max-width: 450px;
        }

        .logo-section {
            text-align: center;
            margin-bottom: 2rem;
            transition: opacity 0.3s ease;
        }

        .logo-section.hide {
            display: none;
        }

        .logo-img {
            width: 90px;
            height: 90px;
            transition: transform 0.3s ease;
        }

        .logo-img:hover {
            transform: scale(1.05);
        }

        .login-card {
            background: var(--white);
            border-radius: var(--border-radius-lg);
            padding: 3rem 2.5rem 2.5rem;
            box-shadow: var(--shadow-xl);
        }

        .login-header {
            text-align: center;
            margin-bottom: 2rem;
        }

        .login-title {
            font-size: 1.75rem;
            font-weight: 700;
            color: var(--text-dark);
            margin-bottom: 0.5rem;
        }

        .login-subtitle {
            color: var(--text-gray);
            font-size: 0.95rem;
        }

        .alert {
            padding: 1rem;
            border-radius: var(--border-radius);
            margin-bottom: 1.5rem;
            font-size: 0.9rem;
        }

        .alert-success {
            background: #d1fae5;
            color: #065f46;
            border: 1px solid #6ee7b7;
        }

        .alert-danger, .alert-error {
            background: #fee2e2;
            color: #991b1b;
            border: 1px solid #fca5a5;
        }

        .alert-warning {
            background: #fef3c7;
            color: #92400e;
            border: 1px solid #fcd34d;
        }

        .alert-info {
            background: #dbeafe;
            color: #1e40af;
            border: 1px solid #93c5fd;
        }

        /* Social Login Buttons */
        .social-login {
            margin-bottom: 1.5rem;
        }

        .btn-social {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            padding: 0.875rem 1.5rem;
            border-radius: var(--border-radius);
            font-weight: 600;
            font-size: 0.95rem;
            border: 2px solid var(--border-light);
            background: var(--white);
            color: var(--text-dark);
            cursor: pointer;
            transition: all 0.3s ease;
            text-decoration: none;
            width: 100%;
            margin-bottom: 0.75rem;
        }

        .btn-social:hover {
            border-color: var(--primary);
            background: #fff5ed;
            transform: translateY(-1px);
            box-shadow: var(--shadow);
        }

        .btn-social i {
            font-size: 1.2rem;
        }

        .btn-google {
            background: #fff;
            border-color: #dadce0;
        }

        .btn-google:hover {
            background: #f8f9fa;
            border-color: var(--primary);
        }

        .divider {
            display: flex;
            align-items: center;
            text-align: center;
            margin: 1.5rem 0;
            color: var(--text-gray);
            font-size: 0.9rem;
        }

        .divider::before,
        .divider::after {
            content: '';
            flex: 1;
            border-bottom: 1px solid var(--border-light);
        }

        .divider span {
            padding: 0 1rem;
        }

        /* Email Login Form (Hidden by default) */
        .email-login-form {
            display: none;
        }

        .email-login-form.show {
            display: block;
            animation: slideDown 0.3s ease;
        }

        @keyframes slideDown {
            from {
                opacity: 0;
                transform: translateY(-10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .form-group {
            margin-bottom: 1.5rem;
        }

        .form-label {
            display: block;
            margin-bottom: 0.5rem;
            font-weight: 600;
            color: var(--text-dark);
            font-size: 0.95rem;
        }

        .form-control {
            width: 100%;
            padding: 0.875rem 1rem;
            border: 2px solid var(--border-light);
            border-radius: var(--border-radius);
            font-size: 0.95rem;
            font-family: 'Outfit', sans-serif;
            transition: all 0.3s ease;
            background: var(--white);
        }

        .form-control:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(255, 138, 61, 0.1);
        }

        .form-control::placeholder {
            color: var(--text-light);
        }

        .password-wrapper {
            position: relative;
        }

        .password-toggle {
            position: absolute;
            right: 1rem;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            color: var(--text-gray);
            cursor: pointer;
            font-size: 1rem;
            padding: 0.5rem;
            transition: color 0.3s ease;
        }

        .password-toggle:hover {
            color: var(--primary);
        }

        .remember-forgot {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
            font-size: 0.9rem;
        }

        .remember-me {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .remember-me input[type="checkbox"] {
            width: 18px;
            height: 18px;
            cursor: pointer;
            accent-color: var(--primary);
        }

        .remember-me label {
            cursor: pointer;
            color: var(--text-gray);
        }

        .forgot-link {
            color: var(--primary);
            text-decoration: none;
            font-weight: 500;
            transition: color 0.3s ease;
        }

        .forgot-link:hover {
            color: var(--primary-dark);
        }

        .btn {
            width: 100%;
            padding: 0.875rem 1.5rem;
            border-radius: var(--border-radius);
            font-weight: 600;
            font-size: 1rem;
            border: none;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
        }

        .btn-primary {
            background: var(--primary);
            color: var(--white);
        }

        .btn-primary:hover {
            background: var(--primary-dark);
            transform: translateY(-1px);
            box-shadow: var(--shadow-lg);
        }

        .btn-primary:active {
            transform: translateY(0);
        }

        .signup-link {
            text-align: center;
            margin-top: 1.5rem;
            padding-top: 1.5rem;
            border-top: 1px solid var(--border-light);
            font-size: 0.95rem;
            color: var(--text-gray);
        }

        .signup-link a {
            color: var(--primary);
            text-decoration: none;
            font-weight: 600;
            transition: color 0.3s ease;
        }

        .signup-link a:hover {
            color: var(--primary-dark);
        }

        .back-to-options {
            text-align: center;
            margin-bottom: 1rem;
        }

        .back-link {
            color: var(--primary);
            text-decoration: none;
            font-size: 0.9rem;
            font-weight: 500;
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            transition: color 0.3s ease;
        }

        .back-link:hover {
            color: var(--primary-dark);
        }

        .footer-links {
            text-align: center;
            margin-top: 1.5rem;
            font-size: 0.85rem;
        }

        .footer-links a {
            color: var(--text-gray);
            text-decoration: none;
            margin: 0 0.5rem;
            transition: color 0.3s ease;
        }

        .footer-links a:hover {
            color: var(--primary);
        }

        .copyright {
            text-align: center;
            margin-top: 1rem;
            color: var(--text-gray);
            font-size: 0.85rem;
        }

        .btn-loading {
            opacity: 0.7;
            cursor: not-allowed;
            pointer-events: none;
        }

        .spinner {
            border: 2px solid transparent;
            border-top: 2px solid var(--white);
            border-radius: 50%;
            width: 16px;
            height: 16px;
            animation: spin 0.8s linear infinite;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* ============================================
           SELETTORE LINGUA — dropup forzato
           Il markup arriva da lang_switcher(), quindi
           qui si colpisce qualunque pannello assoluto
           che stia dentro #langWrap.
           ============================================ */
        .lang-wrap {
            display: flex;
            justify-content: center;
            margin: 18px 0 4px;
            position: relative;
            z-index: 50;
        }

        .lang-wrap > * {
            position: relative;
        }

        /* Qualsiasi tendina dentro il wrapper si apre verso l'alto */
        .lang-wrap ul,
        .lang-wrap ol,
        .lang-wrap [class*="dropdown"],
        .lang-wrap [class*="menu"],
        .lang-wrap [class*="list"],
        .lang-wrap [class*="options"],
        .lang-wrap [class*="panel"] {
            top: auto !important;
            bottom: calc(100% + 8px) !important;
            max-height: min(50vh, 320px) !important;
            overflow-y: auto !important;
            z-index: 9999 !important;
            box-shadow: 0 -10px 24px -6px rgb(0 0 0 / 0.18) !important;
        }

        /* Marcatura applicata via JS come rete di sicurezza */
        .lang-dropup-fix {
            top: auto !important;
            bottom: calc(100% + 8px) !important;
            max-height: min(50vh, 320px) !important;
            overflow-y: auto !important;
            z-index: 9999 !important;
        }

        @media (max-width: 768px) {
            body {
                padding: 1rem 1rem 2rem;
            }

            .login-card {
                padding: 2.5rem 1.5rem 2rem;
            }

            .login-title {
                font-size: 1.5rem;
            }

            .logo-img {
                width: 70px;
                height: 70px;
            }

            .remember-forgot {
                flex-direction: column;
                align-items: flex-start;
                gap: 0.75rem;
            }
        }
