body {
    margin: 0;
    font-family: var(--font-main, 'Segoe UI', Roboto, sans-serif);
    background-color: #1e1e1e;
    color: white;
    min-height: 100vh;
    touch-action: manipulation;
}



/* MAIN LAYOUT */
.auth-main-content {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 120px 10% 60px; /* Aumentato ulteriormente il top padding (era 100px) */
    gap: 80px; /* Ridotto il gap da 100px per bilanciare il form più piccolo */
    min-height: 100vh; /* Copre l'intera altezza del viewport */
    box-sizing: border-box;
}

.auth-bg-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    filter: brightness(0.4) grayscale(100%);
}

.auth-text-section {
    flex: 1;
    max-width: 550px;
    align-self: center; /* Forza l'allineamento al centro verticale */
}

.auth-text-section h1 {
    font-size: 42px;
    line-height: 1.1;
    margin-bottom: 25px;
}

@media (max-width: 992px) {
    .auth-text-section h1 {
        font-size: var(--fs-h1-mobile);
    }
}

.fitsuite-highlight {
    color: #ff6600;
}

.auth-text-section p {
    font-size: var(--fs-body);
    color: white;
    opacity: 0.9;
}

/* FORM SECTION CONTAINER */
.auth-form-section {
    width: 100%; /* Occupa tutta la larghezza disponibile */
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column; /* Per sicurezza */
}

/* FORM CONTAINER */
.registration-form-container {
    background-color: #262626;
    padding: 25px 30px 30px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    width: 380px;
    text-align: center;
    min-height: 600px;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
    margin: 0 auto; /* Forza il centraggio orizzontale */
}

.registration-form-container h2 {
    font-size: var(--fs-h2);
    margin-bottom: 20px;
    margin-top: 0;
}

@media (max-width: 992px) {
    .registration-form-container h2 {
        font-size: var(--fs-h2-mobile);
    }
}

.form-group {
    text-align: left;
    margin-bottom: 12px; /* Ridotto da 15px */
}

.form-group label {
    display: block;
    font-size: 13px; /* Ridotto da 14px */
    margin-bottom: 6px; /* Ridotto da 8px */
    font-weight: bold;
}

/* Auth Page Specific Overrides */
.navbar {
    left: 0 !important;
}

@media (min-width: 1025px) {
    .auth-main-content {
        justify-content: space-between !important;
        padding-left: 10% !important;
        padding-right: 10% !important;
        gap: 0 !important;
    }
    .auth-text-section {
        flex: 1 !important;
        max-width: 650px !important;
    }
    .auth-text-section h1 {
        font-size: 48px !important;
    }
    .auth-form-section {
        flex: 1 !important;
        width: auto !important;
        align-items: flex-end !important;
    }
}

.form-group input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px; /* Ridotto da 12px */
    background-color: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    color: white;
    font-size: 16px; /* Aumentato a 16px per prevenire l'auto-zoom su iOS */
}

/* Password Input Wrapper per l'icona Eye */
.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper input {
    padding-right: 40px; /* Spazio per l'icona */
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #888;
    font-size: 15px;
    transition: color 0.3s ease;
}

.toggle-password:hover, .toggle-password.active {
    color: #ff6600;
}

.continue-btn {
    width: 100%;
    background-color: #ff5500;
    color: white;
    border: none;
    padding: 10px; /* Ridotto da 12px */
    border-radius: 8px;
    font-weight: bold;
    font-size: 16px; /* Aumentato a 16px per touch target e uniformità */
    cursor: pointer;
    margin-top: 5px; /* Ridotto da 10px */
}

.or-divider {
    margin: 15px 0; /* Ridotto da 20px */
    display: flex;
    align-items: center;
    color: #888;
    font-size: 12px; /* Aggiunto font-size */
}

.relative {
    position: relative !important;
}

.text-small {
    font-size: 14px !important;
}

.text-tiny {
    font-size: 13px !important;
}

.mb-20 {
    margin-bottom: 20px !important;
}

.mb-25 {
    margin-bottom: 25px !important;
}

.font-bold {
    font-weight: bold !important;
}

.color-primary {
    color: #ff6600 !important;
}

.color-muted {
    color: #ccc !important;
}

.color-gray {
    color: #888 !important;
}

.or-divider::before, .or-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #444;
    margin: 0 10px; /* Ridotto da 15px */
}

.google-signin-btn {
    width: 100%;
    background-color: #cccccc;
    color: black;
    border: none;
    padding: 8px; /* Ridotto da 10px */
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px; /* Ridotto da 10px */
    font-weight: 500;
    cursor: pointer;
    font-size: 14px; /* Aggiunto font-size */
}

.google-signin-btn img {
    width: 18px; /* Ridotto da 20px */
}

.login-link {
    font-size: 12px; /* Ridotto da 13px */
    margin-top: 15px; /* Ridotto da 20px */
}

.login-link a {
    color: #ff6600;
    text-decoration: underline;
}

.forgot-password-link {
    display: block;
    text-align: right;
    margin-top: 8px; /* Ridotto da 10px */
    font-size: 12px; /* Ridotto da 13px */
    color: #ff6600;
    text-decoration: none;
}

.forgot-password-link:hover {
    text-decoration: underline;
}

.terms-privacy {
    font-size: 10px; /* Ridotto da 11px */
    color: #888;
    margin-top: 20px; /* Ridotto da 30px */
    line-height: 1.4;
}

.terms-privacy a {
    color: #888;
    text-decoration: underline;
}

.copyright {
    margin-top: 10px;
}

.error-message {
    color: #ff4d4d; /* Red color for errors */
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
}

.success-message {
    color: #4CAF50; /* Green color for success */
    font-size: 14px;
    margin-top: 10px;
    text-align: center;
}

/* Custom Checkbox/Radio & Google Terms */
.custom-checkbox-group {
    margin-top: 15px;
    margin-bottom: 20px;
    text-align: left;
    display: flex;
    align-items: flex-start;
}

.form-group label.custom-checkbox {
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    user-select: none;
    gap: 10px;
    width: 100%;
    font-weight: normal;
    margin-bottom: 0;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: relative;
    height: 20px;
    width: 20px;
    min-width: 20px;
    min-height: 20px;
    background-color: #2a2a2a;
    border: 2px solid #555;
    border-radius: 4px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-top: 0;
    display: block;
    box-sizing: border-box;
}

.custom-checkbox:hover input ~ .checkmark {
    border-color: #ff6600;
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: #ff6600;
    border-color: #ff6600;
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.error-message {
    background-color: rgba(244, 67, 54, 0.1);
    border: 1px solid #f44336;
    color: #f44336;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 15px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.error-message.hidden {
    display: none;
}

.error-message ul {
    margin: 5px 0 0 18px;
    padding: 0;
    list-style-type: disc;
}

.error-message li {
    margin-bottom: 2px;
}

.terms-text {
    font-size: 11px;
    color: #ccc;
    line-height: 1.5;
    transition: all 0.3s ease;
    display: block;
    flex: 1;
    word-wrap: break-word;
    white-space: normal;
}

.terms-text a {
    color: #ff6600;
    text-decoration: none;
    font-weight: 500;
}

.terms-text a:hover {
    text-decoration: underline;
}

/* Shake animation for error */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}

.checkbox-error .checkmark {
    border-color: #ff4d4d;
    box-shadow: 0 0 8px rgba(255, 77, 77, 0.6);
}

.checkbox-error {
    animation: shake 0.4s ease-in-out;
}

.checkbox-error .terms-text {
    color: #ff4d4d;
}

.checkbox-error .terms-text a {
    color: #ff4d4d;
}

/* Input Error Style */
.input-error {
    border-color: #ff4d4d !important;
    box-shadow: 0 0 8px rgba(255, 77, 77, 0.4) !important;
    animation: shake 0.4s ease-in-out;
}

.input-error:focus {
    border-color: #ff4d4d !important;
    box-shadow: 0 0 10px rgba(255, 77, 77, 0.6) !important;
    outline: none;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 5px;
    margin-bottom: 15px;
    text-align: left;
}

.checkbox-group input[type="radio"],
.checkbox-group input[type="checkbox"] {
    width: 16px !important;
    height: 16px !important;
    margin: 2px 0 0 0 !important;
    padding: 0 !important;
    cursor: pointer;
    accent-color: #ff6600;
    flex-shrink: 0;
    background-color: transparent !important;
    border: none !important;
}

.checkbox-group label {
    font-size: 12px !important;
    color: #ccc !important;
    margin-bottom: 0 !important;
    font-weight: normal !important;
    line-height: 1.4;
    display: inline !important;
}

.checkbox-group label a {
    color: #ff6600 !important;
    text-decoration: none;
    font-weight: 500;
}

.checkbox-group label a:hover {
    text-decoration: underline;
}

.google-terms-text {
    font-size: 10px;
    color: #888;
    margin-top: 10px;
    margin-bottom: 0;
    line-height: 1.4;
    text-align: center;
}

.google-terms-text a {
    color: #aaa;
    text-decoration: underline;
}

.google-terms-text a:hover {
    color: #ff6600;
}

/* OVERLAY FOR EMAIL VERIFICATION */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95); /* Sfondo quasi nero */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.auth-overlay .registration-form-container {
    background-color: #1a1a1a;
    border: 1px solid #ff6600;
    box-shadow: 0 0 20px rgba(255, 102, 0, 0.2);
    position: relative;
}

.close-overlay-btn {
    /* Styles are now handled by universal rules in popup.css */
}

#resend-code-link.disabled {
    color: #888;
    text-decoration: none;
    cursor: not-allowed;
    opacity: 0.5;
}

/* --- RESPONSIVE ADJUSTMENTS (ALL AT THE BOTTOM TO ENSURE OVERRIDE) --- */

@media (max-width: 1024px) {
    .auth-main-content {
        flex-direction: column;
        padding: 60px 20px; /* Padding bilanciato */
        gap: 0;
        min-height: 100vh;
        align-items: center;
        justify-content: center; /* Centratura verticale */
    }

    .auth-text-section {
        display: none;
    }

    .auth-form-section {
        margin-top: 0; /* Rimosso margine per centratura perfetta */
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .registration-form-container {
        width: 95%;
        max-width: 340px; /* Leggermente meno allargato come richiesto */
        height: auto;
        min-height: 520px; /* Uniformità tra login e registrazione */
        margin: 0 auto;
        padding: 25px;
    }
}

@media (max-width: 768px) {
    .auth-main-content {
        padding: 40px 15px;
        align-items: center;
        justify-content: center;
    }

    .registration-form-container {
        width: 95%;
        max-width: 340px;
        padding: 25px;
    }

    .registration-form-container h2 {
        font-size: 24px;
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .auth-main-content {
        padding: 20px 10px; /* Minimo padding per piccoli schermi */
        align-items: center;
        justify-content: center;
    }

    .registration-form-container {
        padding: 20px;
        width: 95%;
        max-width: 330px; /* Ancora leggermente più stretto per mobile piccolo */
        min-height: 480px; 
        margin: 0 auto;
    }

    .registration-form-container h2 {
        font-size: 22px;
        margin-bottom: 15px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .form-group input,
    .continue-btn,
    .google-signin-btn {
        padding: 10px;
        font-size: 14px;
    }

    .google-signin-btn img {
        width: 18px;
    }

    .or-divider {
        margin: 15px 0;
    }

    .login-link {
        font-size: 12px;
        margin-top: 15px;
    }

    .terms-privacy {
        font-size: 10px;
        margin-top: 20px;
    }

    .copyright {
        margin-top: 5px;
    }
}