/* Auth Pages Styles */
:root {
    --primary-color: #3B51C0;
    --primary-hover: #2D41AA;
    --secondary-color: #6c757d;
    --secondary-hover: #5a6268;
    --accent-color: #4A64D4;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --light-bg: #f8f9fa;
    --white: #ffffff;
    --text-dark: #333333;
    --text-muted: #6c757d;
    --border-color: #dee2e6;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
}

* {
    box-sizing: border-box;
}

body.auth-page {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f0f4ff;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Language Selector - Flags */
.language-selector {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.lang-flag {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid rgba(59,81,192,0.25);
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(59,81,192,0.08);
    text-decoration: none;
}

.lang-flag:hover {
    transform: scale(1.1);
    border-color: rgba(59,81,192,0.6);
}

.lang-flag.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(59,81,192,0.35);
    transform: scale(1.1);
}

.lang-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Logo */
.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo img {
    max-width: 220px;
    height: auto;
}

.auth-logo h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    font-weight: 700;
    margin: 15px 0 5px;
}

.auth-logo h1 em {
    font-style: normal;
    font-weight: 300;
}

.auth-logo p {
    color: var(--text-muted);
    font-size: 1rem;
    margin: 0;
}

/* Auth Card */
.auth-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(59,81,192,0.35);
    width: 100%;
    max-width: 420px;
    padding: 40px 30px;
    animation: slideUp 0.4s ease-out;
    color: white;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-card h2 {
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin: 0 0 25px;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: rgba(255,255,255,0.9);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
    background: rgba(255,255,255,0.95);
    color: var(--text-dark);
}

.form-control:focus {
    border-color: rgba(255,255,255,0.9);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.2);
}

.form-control::placeholder {
    color: #adb5bd;
}

/* Email Display Button */
.email-display-btn {
    width: 100%;
    padding: 20px;
    background: rgba(255,255,255,0.18);
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 16px;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.email-display-btn:hover {
    background: rgba(255,255,255,0.28);
    transform: translateY(-2px);
}

.email-display-btn:active {
    transform: translateY(0);
}

.email-display-btn .email-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.use-different-email {
    text-align: center;
    color: rgba(255,255,255,0.75);
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.use-different-email:hover {
    color: white;
}

/* Checkbox Group */
.checkbox-group {
    margin-bottom: 20px;
}

.checkbox-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    cursor: pointer;
}

/* Native input nascosto per privacy/terms */
.checkbox-group:not(.mobility-group) .checkbox-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* Label prende tutto lo spazio con padding per il box custom */
.checkbox-group:not(.mobility-group) .checkbox-item label {
    position: relative;
    padding-left: 34px;
    color: rgba(255,255,255,0.9);
    font-size: 0.9rem;
    line-height: 1.4;
    cursor: pointer;
    user-select: none;
}

/* Box del checkbox custom */
.checkbox-group:not(.mobility-group) .checkbox-item label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 1px;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.45);
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Checkmark nascosto */
.checkbox-group:not(.mobility-group) .checkbox-item label::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 5px;
    width: 8px;
    height: 5px;
    border-left: 2.5px solid var(--primary-color);
    border-bottom: 2.5px solid var(--primary-color);
    transform: rotate(-45deg) scale(0);
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Stato selezionato */
.checkbox-group:not(.mobility-group) .checkbox-item input:checked + label::before {
    background: white;
    border-color: white;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.2);
}

.checkbox-group:not(.mobility-group) .checkbox-item input:checked + label::after {
    transform: rotate(-45deg) scale(1);
}

/* Hover sul box */
.checkbox-group:not(.mobility-group) .checkbox-item:hover label::before {
    border-color: rgba(255,255,255,0.75);
    background: rgba(255,255,255,0.18);
}

.checkbox-item label a {
    color: white;
    text-decoration: underline;
    font-weight: 600;
}

.checkbox-item label a:hover {
    opacity: 0.85;
}

.checkbox-item label a:hover {
    opacity: 0.85;
}

/* Buttons */
.btn-primary-custom {
    width: 100%;
    padding: 16px;
    background: white;
    border: none;
    border-radius: 12px;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.btn-primary-custom:hover {
    background: rgba(255,255,255,0.9);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}

.btn-primary-custom:active {
    transform: translateY(0);
}

.btn-primary-custom:disabled {
    background: rgba(255,255,255,0.35);
    color: rgba(255,255,255,0.6);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary-custom {
    width: 100%;
    padding: 16px;
    background: transparent;
    border: 2px solid rgba(255,255,255,0.7);
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary-custom:hover {
    background: rgba(255,255,255,0.15);
    border-color: white;
}

.btn-outline-custom {
    width: 100%;
    padding: 16px;
    background: transparent;
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-outline-custom:hover {
    background: rgba(255,255,255,0.15);
    border-color: white;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 25px 0;
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.3);
}

.divider span {
    padding: 0 15px;
    white-space: nowrap;
}

/* Alert Messages */
.alert {
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Footer Text */
.auth-footer {
    text-align: center;
    margin-top: 30px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
    body.auth-page {
        padding: 15px;
    }

    .auth-card {
        padding: 30px 20px;
    }

    .auth-logo h1 {
        font-size: 2rem;
    }

    .language-selector {
        top: 15px;
        right: 15px;
    }
}

/* Loading State */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Mobility type selection */
.mobility-group {
    margin-bottom: 0;
}

.mobility-section-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.9);
    margin: 0 0 4px;
}

.mobility-hint {
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    margin: 0 0 12px;
    font-style: italic;
}

/* Mobility grid: 3+2 layout */
.mob-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 6px;
}

/* Mobility card items */
.mobility-group .checkbox-item.mob-card {
    flex: 0 0 calc(33.333% - 8px);
    max-width: calc(33.333% - 8px);
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 14px;
    padding: 0;
    margin-bottom: 0;
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    min-height: 96px;
}

.mobility-group .checkbox-item.mob-card:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.5);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.2);
}

.mobility-group .checkbox-item.mob-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.mobility-group .checkbox-item.mob-card label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    height: 100%;
    min-height: 92px;
    padding: 12px 8px;
    margin: 0;
    cursor: pointer;
    gap: 6px;
}

.mob-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mob-icon i {
    font-size: 1.7rem;
    color: rgba(255,255,255,0.9);
    transition: color 0.2s ease;
}

.mob-text {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
    line-height: 1.25;
    display: block;
    transition: color 0.2s ease;
}

.mobility-group .checkbox-item.mob-card::after {
    display: none;
}

.mobility-group .checkbox-item.mob-card:has(input:checked) {
    background: rgba(255,255,255,0.95);
    border-color: white;
    box-shadow: 0 4px 18px rgba(0,0,0,0.2);
}

.mobility-group .checkbox-item.mob-card:has(input:checked) .mob-icon i {
    color: #fff;
}

.mobility-group .checkbox-item.mob-card:has(input:checked) .mob-text {
    color: var(--primary-color);
    font-weight: 700;
}
