/* ========================================
   STILI PER PAGINA DI AUTENTICAZIONE
   ======================================== */

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    background: #0F0F0F;
}

.auth-container {
    background-color: var(--surface-color);
    padding: 40px;
    border-radius: var(--border-radius-large);
    width: 100%;
    max-width: 420px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
    opacity: 0;
    transform: scale(0.95);
    animation: fadeInUp 0.6s 0.2s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: 35px;
    color: var(--on-surface-primary);
}

.auth-header .material-icons {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.auth-header h2 {
    margin: 0;
    font-weight: 500;
    font-size: 1.8rem;
}

@media (max-width: 480px) {
    .auth-container {
        padding: 25px;
        width: 90%;
        margin-top: 0;
        margin-bottom: 0;
    }
    .auth-header h2 {
        font-size: 1.5rem;
    }
}

/* ========================================
   TOGGLE TRA LOGIN E REGISTRAZIONE
   ======================================== */

.auth-toggle {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.auth-toggle button {
    background: none;
    border: none;
    color: var(--on-surface-secondary);
    font-size: 1.2rem;
    font-weight: 500;
    padding: 10px 20px;
    cursor: pointer;
    transition: color 0.3s ease;
    position: relative;
}

.auth-toggle button.active {
    color: var(--on-surface-primary);
}

.auth-toggle button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10px;
    right: 10px;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 2px;
    animation: underline-grow 0.3s ease-out;
}

@keyframes underline-grow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* ========================================
   CONTAINER DEI FORM
   ======================================== */

.form-container {
    display: none;
}

.form-container.active {
    display: block;
    animation: slideIn 0.5s ease-out forwards;
}

.form-content-wrapper {
    position: relative;
    min-height: 380px;
    display: flex;
    flex-direction: column;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   GESTIONE STEP DELLA REGISTRAZIONE
   ======================================== */

#register-form {
    position: relative;
}

.form-step {
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
    opacity: 0;
    transform: translateX(30px);
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.form-step.active {
    opacity: 1;
    transform: translateX(0);
    position: relative;
    pointer-events: all;
}

.form-step.leaving {
    transform: translateX(-30px);
    opacity: 0;
}

/* ========================================
   STILI DEI CAMPI FORM
   ======================================== */

.form-group {
    margin-bottom: 25px;
    position: relative;
}

.form-group .material-icons:not(.toggle-password) {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 15px;
    color: var(--on-surface-tertiary);
    transition: color 0.3s ease;
    pointer-events: none;
}

.form-group .toggle-password {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 15px;
    color: var(--on-surface-tertiary);
    cursor: pointer;
    transition: color 0.3s ease;
}

.form-group .toggle-password:hover {
    color: var(--on-surface-primary);
}

.form-group input {
    width: 100%;
    padding: 15px 15px 15px 50px;
    background-color: var(--background-color);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-small);
    color: var(--on-surface-primary);
    font-size: 1rem;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

.form-group:focus-within .material-icons:not(.toggle-password) {
    color: var(--primary-color);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #000;
}

.form-group.error-state {
    animation: shake 0.4s ease-in-out;
}

.form-group.error-state input {
    border-color: var(--color-error);
}

.form-group.error-state .material-icons:not(.toggle-password) {
    color: var(--color-error);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}

/* ========================================
   PULSANTI
   ======================================== */

.btn-submit {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, var(--primary-color), #6c3483);
    border: none;
    border-radius: var(--border-radius-small);
    color: var(--on-surface-primary);
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(142, 68, 173, 0.25);
}

.btn-submit.loading {
    cursor: wait;
}

.btn-back {
    background: none;
    border: none;
    color: var(--on-surface-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.btn-back:hover {
    color: var(--on-surface-primary);
}

/* ========================================
   SPINNER DI CARICAMENTO
   ======================================== */

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   MESSAGGI DI RISPOSTA
   ======================================== */

.response-message {
    margin-top: auto;
    padding: 12px;
    border-radius: var(--border-radius-small);
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease-out;
    display: none;
}

#response-message.show,
.response-message.show {
    opacity: 1;
    transform: translateY(0);
    display: block;
}

.response-message.success {
    background-color: rgba(46, 204, 113, 0.15);
    color: var(--color-success);
}

.response-message.error {
    background-color: rgba(231, 76, 60, 0.15);
    color: var(--color-error);
}

