/* ===========================================
   SCRIBE - Modern Authentication Layout CSS
   ===========================================
   Design accattivante e moderno per il login
   Compatibile con Bootstrap 5
   =========================================== */

/* BOOTSTRAP ICONS CDN */
@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css");

/* MODERN AUTH CONTAINER */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Animated background particles */
.auth-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    animation: particleFloat 20s ease-in-out infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes particleFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    padding: 50px 40px;
    width: 100%;
    max-width: 450px;
    position: relative;
    transform: translateY(0);
    transition: all 0.3s ease;
    z-index: 1;
}

.auth-card:hover {
    transform: translateY(-5px);
    box-shadow: 
        0 30px 60px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

/* MODERN BRANDING HEADER */
.auth-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.auth-header::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

.auth-logo {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    text-decoration: none;
    display: inline-block;
    position: relative;
    letter-spacing: -0.02em;
}

.auth-logo::before {
    content: '🏥';
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 8px rgba(102, 126, 234, 0.3));
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-5px) scale(1.05); }
}

.auth-logo:hover {
    transform: scale(1.02);
    text-decoration: none;
}

.auth-subtitle {
    color: #64748b;
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
    opacity: 0.8;
}

/* MODERN FORM STYLES */
.auth-form {
    margin-bottom: 30px;
}

.auth-form .form-group {
    margin-bottom: 25px;
    position: relative;
    overflow: visible;
}

.auth-form .form-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
    display: block;
}

.auth-form .form-control {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 18px 25px;
    font-size: 1.1rem;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    height: 56px;
    width: 100%;
    display: block;
    color: #1f2937;
    font-weight: 500;
    overflow: visible;
    box-sizing: border-box;
}

.auth-form .form-control:focus {
    border-color: #667eea;
    box-shadow: 
        0 0 0 3px rgba(102, 126, 234, 0.1),
        0 4px 12px rgba(102, 126, 234, 0.15);
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px);
    outline: none;
    color: #111827;
}

.auth-form .form-control::placeholder {
    color: #9ca3af;
    font-size: 1rem;
    opacity: 0.8;
}

.auth-form .form-control:focus::placeholder {
    color: #6b7280;
    opacity: 0.6;
}

/* INPUT ICONS FIXED - NON INTERFERISCONO CON LA DIGITAZIONE */
.input-group {
    position: relative;
    display: block;
    width: 100%;
    overflow: visible;
}

.input-icon {
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 1.2rem;
    z-index: 2;
    transition: color 0.3s ease;
    pointer-events: none;
}

.input-group .form-control {
    padding-left: 65px !important;
    padding-right: 25px !important;
    padding-top: 18px !important;
    padding-bottom: 18px !important;
    position: relative;
    z-index: 1;
    border-radius: 12px !important;
    overflow: visible;
}

/* Quando il campo password ha il pulsante show/hide */
.input-group .form-control[type="password"],
.input-group .form-control[data-has-toggle="true"] {
    padding-right: 65px !important;
}

.input-group .form-control:focus + .input-icon,
.input-group .form-control:focus ~ .input-icon {
    color: #667eea;
}

/* PASSWORD TOGGLE BUTTON */
.password-toggle-btn {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: #9ca3af;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.password-toggle-btn:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
}

.password-toggle-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.password-toggle-btn i {
    font-size: 1.1rem;
    pointer-events: none;
}

/* BUTTON INTERACTIVITY FIX */
.btn-auth-primary,
.btn-auth-secondary {
    cursor: pointer;
    user-select: none;
    pointer-events: auto;
}

.btn-auth-primary:not(:disabled),
.btn-auth-secondary:not(:disabled) {
    cursor: pointer;
}

.btn-auth-primary:hover,
.btn-auth-secondary:hover {
    cursor: pointer;
}

/* TESTO INPUT SEMPRE VISIBILE */
.auth-form .form-control:not(:placeholder-shown) {
    color: #111827 !important;
    font-weight: 500;
}

.auth-form .form-control::-webkit-input-placeholder {
    color: #9ca3af;
    opacity: 0.8;
}

.auth-form .form-control::-moz-placeholder {
    color: #9ca3af;
    opacity: 0.8;
}

.auth-form .form-control:-ms-input-placeholder {
    color: #9ca3af;
    opacity: 0.8;
}

.auth-form .form-control::placeholder {
    color: #9ca3af;
    opacity: 0.8;
}
.auth-form .form-control.is-invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.auth-form .invalid-feedback {
    font-size: 0.875rem;
    margin-top: 8px;
    color: #ef4444;
    font-weight: 500;
}

/* MODERN BUTTONS */
.btn-auth-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    border: none;
    border-radius: 12px;
    padding: 15px 30px;
    font-weight: 700;
    font-size: 1.1rem;
    width: 100%;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    letter-spacing: 0.5px;
}

.btn-auth-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-auth-primary:hover::before {
    left: 100%;
}

.btn-auth-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
    color: white;
    background: linear-gradient(135deg, #5a6fd8 0%, #6b4190 50%, #e881e9 100%);
}

.btn-auth-primary:active {
    transform: translateY(0px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.btn-auth-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 12px 30px;
    font-weight: 600;
    color: #667eea;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    backdrop-filter: blur(10px);
}

.btn-auth-secondary:hover {
    border-color: #667eea;
    color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    text-decoration: none;
    transform: translateY(-1px);
}

/* MODERN CHECKBOX */
.auth-remember {
    display: flex;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

.auth-remember:hover {
    background: rgba(102, 126, 234, 0.08);
    border-color: rgba(102, 126, 234, 0.2);
}

.auth-remember input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    accent-color: #667eea;
    cursor: pointer;
}

.auth-remember label {
    margin: 0;
    color: #374151;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    flex-grow: 1;
}

/* MODERN ALERTS */
.auth-alert {
    border: none;
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 25px;
    font-weight: 500;
    display: flex;
    align-items: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    animation: slideInFromTop 0.4s ease-out;
}

@keyframes slideInFromTop {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border-left: 4px solid #ef4444;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
    border-left: 4px solid #22c55e;
}

.auth-alert i {
    margin-right: 10px;
    font-size: 1.1rem;
}

/* ALERTS */
.auth-alert {
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    border: none;
    font-size: 0.9rem;
}

.auth-alert.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.auth-alert.alert-success {
    background-color: #d1edff;
    color: #0c5460;
}

.auth-alert.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* FOOTER */
.auth-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* LOADING STATE */
.auth-loading {
    position: relative;
    overflow: hidden;
}

.auth-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* MODERN RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .auth-container {
        padding: 20px 15px;
    }
    
    .auth-card {
        padding: 40px 30px;
        max-width: 400px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.12);
    }
    
    .auth-title {
        font-size: 2.2rem;
    }
    
    .btn-auth-primary {
        padding: 14px 28px;
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .auth-container {
        padding: 15px 10px;
    }
    
    .auth-card {
        padding: 35px 25px;
        border-radius: 16px;
    }
    
    .auth-title {
        font-size: 2rem;
    }
    
    .auth-subtitle {
        font-size: 1rem;
    }
    
    .form-control {
        padding: 14px 18px;
    }
    
    .input-icon + .form-control {
        padding-left: 45px;
    }
}

@media (max-width: 400px) {
    .auth-card {
        padding: 30px 20px;
        margin: 5px;
    }
    
    .auth-title {
        font-size: 1.8rem;
    }
    
    .btn-auth-primary {
        padding: 13px 25px;
        font-size: 0.95rem;
    }
}

/* ENHANCED ACCESSIBILITY */
.auth-form .form-control:focus {
    outline: none;
}

.btn-auth-primary:focus,
.btn-auth-secondary:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* LOADING STATES */
.btn-auth-primary:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-auth-primary.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* MODERN DARK MODE SUPPORT */
@media (prefers-color-scheme: dark) {
    .auth-container {
        background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
    }
    
    .auth-card {
        background: rgba(30, 41, 59, 0.95);
        color: #e2e8f0;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .auth-title {
        color: #e2e8f0;
    }
    
    .auth-subtitle {
        color: #94a3b8;
    }
    
    .form-control {
        background: rgba(15, 23, 42, 0.8);
        border-color: rgba(255, 255, 255, 0.1);
        color: #e2e8f0;
    }
    
    .form-control:focus {
        background: rgba(15, 23, 42, 0.95);
        border-color: #667eea;
        color: #e2e8f0;
    }
    
    .form-control::placeholder {
        color: #64748b;
    }
    
    .input-icon {
        color: #64748b;
    }
    
    .form-control:focus + .input-icon,
    .form-control:focus ~ .input-icon {
        color: #667eea;
    }
}
