/* Reset e base styles */
.auth-page {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Background gradients */
.gradient-background-login {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 35%, #059669 100%);
    z-index: -2;
}

.gradient-background-register {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #059669 0%, #047857 35%, #1e40af 100%);
    z-index: -2;
}

.gradient-background-logout {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 35%, #059669 100%);
    z-index: -2;
}

.gradient-background-delete {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 35%, #ea580c 100%);
    z-index: -2;
}

.gradient-background-forgot {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 35%, #eab308 100%);
    z-index: -2;
}

/* Info section styling */
.info-section {
    position: relative;
    z-index: 1;
    padding: 2rem;
}

/* TESTI BIANCHI PER LEGGIBILITÀ SU SFONDO BLU */
.info-section .text-white {
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.info-section h1,
.info-section h4,
.info-section p,
.info-section span {
    color: #ffffff !important;
}

.info-section .text-success {
    color: #10b981 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Form section styling - RIMOSSO min-height che causava problemi */
.form-section {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    /* RIMOSSO: min-height: 100vh; che causava problemi di layout */
}

/* Auth cards con design migliorato */
.auth-card {
    border: none !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem !important;
    padding: 3rem 2.5rem !important;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #059669, #3b82f6);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.auth-card-small {
    max-width: 420px;
    width: 100%;
}

.auth-card-medium {
    max-width: 520px;
    width: 100%;
}

.auth-card-large {
    max-width: 720px;
    width: 100%;
}

/* Header della card - ALLINEAMENTO A SINISTRA */
.auth-card .mb-4:first-of-type {
    text-align: left;
    margin-bottom: 2rem;
}

.auth-card h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
}

.auth-card .text-muted {
    color: #6b7280 !important;
    font-size: 0.95rem;
}

/* Form controls migliorati */
.form-control-custom {
    background-color: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.form-control-custom:focus {
    background-color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 
        0 0 0 3px rgba(59, 130, 246, 0.1),
        0 1px 2px 0 rgba(0, 0, 0, 0.05);
    outline: none;
    transform: translateY(-1px);
}

.form-control-custom::placeholder {
    color: #9ca3af;
    font-size: 0.9rem;
}

/* Form icons migliorati */
.form-icon {
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    color: #6b7280;
    z-index: 3;
    pointer-events: none;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.position-relative:focus-within .form-icon {
    color: #3b82f6;
}

.form-control-custom.ps-5 {
    padding-left: 2.75rem;
}

/* Labels migliorati */
.form-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    letter-spacing: 0.025em;
}

/* Gruppi di form migliorati */
.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

/* Custom checkbox migliorato */
.custom-checkbox {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: #3b82f6;
    border-radius: 0.375rem;
    cursor: pointer;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-check-label {
    color: #374151;
    font-size: 0.9rem;
    cursor: pointer;
    line-height: 1.4;
}

/* Sezione remember me e forgot password */
.d-flex.justify-content-between.align-items-center {
    padding: 0.5rem 0;
    border-radius: 0.5rem;
    background: rgba(248, 250, 252, 0.5);
    padding: 1rem;
    margin-bottom: 1.5rem;
}

/* Gradient buttons migliorati */
.btn-gradient-primary,
.btn-gradient-success,
.btn-gradient-danger {
    border: none;
    color: white;
    font-weight: 600;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    border-radius: 0.75rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.1);
    letter-spacing: 0.025em;
}

.btn-gradient-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #059669 100%);
}

.btn-gradient-success {
    background: linear-gradient(135deg, #059669 0%, #3b82f6 100%);
}

.btn-gradient-danger {
    background: linear-gradient(135deg, #dc2626 0%, #ea580c 100%);
}

.btn-gradient-primary:hover,
.btn-gradient-success:hover,
.btn-gradient-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px 0 rgba(0, 0, 0, 0.15);
    color: white;
}

.btn-gradient-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #047857 100%);
}

.btn-gradient-success:hover {
    background: linear-gradient(135deg, #047857 0%, #2563eb 100%);
}

.btn-gradient-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #c2410c 100%);
}

.btn-gradient-primary:active,
.btn-gradient-success:active,
.btn-gradient-danger:active {
    transform: translateY(0);
    box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.1);
}

/* Alert migliorati */
.alert-sm {
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
    border-radius: 0.75rem;
    border: none;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.alert-danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #b91c1c;
    border-left: 4px solid #dc2626;
}

.alert-success {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    color: #166534;
    border-left: 4px solid #059669;
}

.alert-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

/* Links migliorati */
a.text-primary,
a.text-success,
a.text-danger {
    font-weight: 500;
    text-decoration: none;
    position: relative;
    transition: all 0.2s ease;
}

a.text-primary:hover {
    color: #1d4ed8 !important;
    text-decoration: underline;
}

a.text-success:hover {
    color: #047857 !important;
    text-decoration: underline;
}

a.text-danger:hover {
    color: #b91c1c !important;
    text-decoration: underline;
}

/* Footer links della card - NON CENTRATO */
.auth-card > div:last-child {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.auth-card > div:last-child p {
    margin-bottom: 0;
    color: #6b7280;
    font-size: 0.9rem;
}

/* Spinner migliorato */
.custom-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Form validation migliorata */
.text-danger {
    font-size: 0.8rem;
    margin-top: 0.375rem;
    display: block;
    color: #dc2626;
    font-weight: 500;
}

/* Special styling for delete account warning boxes */
.warning-box,
.info-box,
.tip-box {
    padding: 1.25rem;
    border-radius: 0.75rem;
    margin: 1rem 0;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.warning-box {
    border-left: 4px solid #dc2626;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.info-box {
    border-left: 4px solid #eab308;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.tip-box {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

/* Responsive improvements - CORRETTI I BREAKPOINT */
@media (max-width: 1199.98px) {
    /* Per schermi xl e più piccoli */
    .auth-card {
        padding: 2.5rem 2rem !important;
    }
    
    .info-section {
        padding: 1.5rem;
    }
}

@media (max-width: 991.98px) {
    /* NASCONDE INFO SECTION SOLO SU TABLET E MOBILE, NON SU DESKTOP */
    .info-section {
        display: none !important;
    }
    
    .form-section {
        padding: 2rem 1rem;
    }
    
    .auth-card {
        padding: 2rem 1.5rem !important;
        margin: 1rem 0.5rem;
    }
}

@media (max-width: 767.98px) {
    .form-section {
        padding: 1rem;
    }
    
    .auth-card {
        padding: 2rem 1.5rem !important;
        margin: 0.5rem;
        border-radius: 1.25rem !important;
    }
}

@media (max-width: 575.98px) {
    .auth-card {
        padding: 2rem 1.5rem !important;
        margin: 0.5rem 0.25rem;
        border-radius: 1.25rem !important;
    }
    
    .form-control-custom {
        padding: 0.75rem 1rem;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .form-control-custom.ps-5 {
        padding-left: 2.5rem;
    }
    
    .form-icon {
        left: 0.875rem;
        font-size: 0.9rem;
    }
    
    .btn-gradient-primary,
    .btn-gradient-success,
    .btn-gradient-danger {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }
    
    .auth-card h3 {
        font-size: 1.5rem;
    }
    
    .auth-card-large {
        max-width: 100%;
    }
    
    .d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

@media (max-width: 390px) {
    .auth-card {
        padding: 1.5rem 1rem !important;
        margin: 0.25rem;
    }
}

/* Additional utility classes */
.min-vh-100 {
    min-height: 100vh;
}

/* Smooth animations per tutti gli elementi */
* {
    transition: color 0.15s cubic-bezier(0.4, 0, 0.2, 1), 
                background-color 0.15s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.15s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.15s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus ring migliorato per accessibilità */
.form-control-custom:focus,
.custom-checkbox:focus,
.btn-gradient-primary:focus,
.btn-gradient-success:focus,
.btn-gradient-danger:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

/* Miglioramenti tipografici */
.auth-card {
    line-height: 1.6;
}

.form-check-label,
.form-label,
.text-muted {
    line-height: 1.5;
}

/* Effetti hover per interattività */
.auth-card:hover {
    box-shadow: 
        0 32px 64px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}