/* ===================================
   RESET E BASE
   =================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    height: 100vh;
    overflow: hidden;
    background: #f2f2f2;
}

/* ===================================
   CONTAINER PRINCIPALE
   =================================== */

.login-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

.login-container .d-none {
    display: none !important;
}

/* ===================================
   LATO IMMAGINE (SINISTRA)
   =================================== */

.image-side {
    flex: 1;
    position: relative;
    background: #f7f7f7;
    overflow: hidden;
}

.image-background {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    
    /* Animazione Ken Burns */
    animation: kenBurnsEffect 20s ease-in-out infinite;
}

/* Animazione zoom + movimento */
@keyframes kenBurnsEffect {
    0% {
        transform: scale(1) translate(0, 0);
    }
    50% {
        transform: scale(1.1) translate(-2%, -1%);
    }
    100% {
        transform: scale(1) translate(0, 0);
    }
}

/* Overlay leggero sopra l'immagine */
.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(122, 158, 159, 0.1) 0%,
        rgba(102, 117, 223, 0.05) 100%
    );
    pointer-events: none;
}

/* ===================================
   LATO FORM (DESTRA)
   =================================== */

.form-side {
    width: 500px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 50px;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.05);
    position: relative;
}

/* Logo */
.logo-container {
    margin-bottom: 0px;
    text-align: center;
}

.logo {
    max-height: 60px;
    width: auto;
}

/* ===================================
   FORM CONTAINERS
   =================================== */

.form-container {
    width: 100%;
    max-width: 400px;
    
    /* Nascosto di default */
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.4s ease;
}

.form-container.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Titolo Form */
.form-title {
    font-family: 'Poppins', sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 10px;
    text-align: center;
}

.form-subtitle {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    color: #999999;
    margin-bottom: 40px;
    text-align: center;
    line-height: 1.6;
}

/* ===================================
   INPUT GROUPS
   =================================== */

.input-group {
    margin-bottom: 25px;
    width: 100%;
}

.input-group label {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #555555;
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 18px;
    color: #999999;
    font-size: 16px;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 16px 18px 16px 48px;
    border: 2px solid #e6e6e6;
    border-radius: 10px;
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    color: #333333;
    background: #f9f9f9;
    transition: all 0.3s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: #7A9E9F;
    background: #ffffff;
}

.input-wrapper input::placeholder {
    color: #bbbbbb;
}

/* Toggle Password Button */
.toggle-password {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    color: #999999;
    cursor: pointer;
    padding: 5px;
    font-size: 16px;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #7A9E9F;
}

/* ===================================
   CHECKBOX
   =================================== */

.checkbox-group {
    margin-bottom: 25px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    color: #666666;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #7A9E9F;
}

/* ===================================
   BUTTONS
   =================================== */

.btn-primary {
    width: 100%;
    padding: 16px;
    background: #7A9E9F;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover {
    background: #5e8283;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(122, 158, 159, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ===================================
   MESSAGE AREA
   =================================== */

.message-area {
    width: 100%;
    min-height: 20px;
    margin-top: 15px;
    padding: 12px 15px;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    line-height: 1.5;
    border-radius: 8px;
    text-align: center;
    display: none;
}

/* Quando contiene testo, diventa visibile */
.message-area:not(:empty) {
    display: block;
}

/* Stile errore (default rosso) */
.message-area {
    background: #fff5f5;
    border: 1px solid #ffebee;
    border-left: 4px solid #f44336;
    color: #d32f2f;
}

/* Variante successo - aggiungi classe 'success' */
.message-area.success {
    background: #f1f8f4;
    border: 1px solid #e8f5e9;
    border-left: 4px solid #4caf50;
    color: #2e7d32;
}

/* Variante info - aggiungi classe 'info' */
.message-area.info {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
    border-left: 4px solid #2196f3;
    color: #1976d2;
}

/* Variante warning - aggiungi classe 'warning' */
.message-area.warning {
    background: #fff8e1;
    border: 1px solid #ffecb3;
    border-left: 4px solid #ff9800;
    color: #f57c00;
}

/* ===================================
   SOCIAL BUTTONS - SPID/CIE UFFICIALI
   =================================== */

.social-buttons-official {
    display: flex;
    flex-direction: row;
    gap: 12px;
    margin-top: 20px;
}

/* Bottone SPID Ufficiale */
.btn-spid-official,
.btn-cie-official {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 20px;
    border-radius: 4px;
    text-decoration: none;
    font-family: 'Titillium Web', 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

/* SPID - Colori Ufficiali */
.btn-spid-official {
    background-color: #0066CC;
    color: #ffffff;
    border-color: #0066CC;
}

.btn-spid-official:hover {
    background-color: #0052A3;
    border-color: #0052A3;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

/* CIE - Colori Ufficiali */
.btn-cie-official {
    background-color: #0073E6;
    color: #ffffff;
    border-color: #0073E6;
}

.btn-cie-official:hover {
    background-color: #005BB5;
    border-color: #005BB5;
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 230, 0.3);
}

/* Icone */
.btn-spid-official .btn-icon,
.btn-cie-official .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin-right: 12px;
    flex-shrink: 0;
}

.btn-spid-official .btn-icon img,
.btn-cie-official .btn-icon img {
    width: 32px;
    height: 32px;
    display: block;
}

/* Testo */
.btn-spid-official .btn-text,
.btn-cie-official .btn-text {
    flex: 1;
    text-align: left;
}

/* Variante Mobile */
@media (max-width: 576px) {
    .btn-spid-official,
    .btn-cie-official {
        font-size: 15px;
        padding: 10px 16px;
    }
    
    .btn-spid-official .btn-icon,
    .btn-cie-official .btn-icon {
        width: 28px;
        height: 28px;
        margin-right: 10px;
    }
    
    .btn-spid-official .btn-icon img,
    .btn-cie-official .btn-icon img {
        width: 28px;
        height: 28px;
    }
}

/* Accessibility */
.btn-spid-official:focus,
.btn-cie-official:focus {
    outline: 3px solid #FFC107;
    outline-offset: 2px;
}

/* ===================================
   DIVIDER
   =================================== */

.divider {
    display: flex;
    align-items: center;
    margin: 30px 0 20px 0;
    color: #999999;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e6e6e6;
}

.divider span {
    padding: 0 15px;
}

/* ===================================
   FORM FOOTER / LINKS
   =================================== */

.form-footer {
    text-align: center;
    margin-top: 25px;
    margin-bottom: 25px;
}

.link {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    color: #7A9E9F;
    text-decoration: none;
    transition: color 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.link:hover {
    color: #5e8283;
    text-decoration: underline;
}

/*
 LOGHI ESTERNI
*/

.logos-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-top:10px;
}

.login-logo {
  max-height: 60px;
  width: auto;

}

/* ===================================
   ANIMAZIONI TRANSIZIONE FORM
   =================================== */

/* Slide in from right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide out to left */
@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50px);
    }
}

/* Fade in */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Applicazione animazioni */
.form-container.active {
    animation: fadeIn 0.5s ease forwards;
}

.form-container.hiding {
    animation: slideOutLeft 0.4s ease forwards;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* Tablet */
@media (max-width: 992px) {
    .form-side {
        width: 450px;
        padding: 50px 40px;
    }
    
    /* Riduce intensità animazione */
    @keyframes kenBurnsEffect {
        0%, 100% {
            transform: scale(1) translate(0, 0);
        }
        50% {
            transform: scale(1.05) translate(-1%, 0);
        }
    }
}

/* Mobile */
@media (max-width: 768px) {
    .login-container {
        flex-direction: column;
    }
    
    .image-side {
        height: 200px;
        flex: none;
    }
    
    .image-background {
        animation: none; /* Disabilita animazione su mobile */
    }
    
    .form-side {
        width: 100%;
        height: calc(100vh - 200px);
        padding: 30px 20px;
        overflow-y: auto;
    }
    
    .form-title {
        font-size: 24px;
    }
    
    .form-subtitle {
        font-size: 13px;
        margin-bottom: 30px;
    }
    
    .input-group {
        margin-bottom: 20px;
    }
    
    .logo {
        max-height: 50px;
    }
    
    .logo-container {
        margin-bottom: 0px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .image-side {
        height: 150px;
    }
    
    .form-side {
        height: calc(100vh - 150px);
        padding: 20px 15px;
    }
    
    .social-buttons {
        flex-direction: column;
    }
    
    .btn-social {
        width: 100%;
    }
}

/* ===================================
   ACCESSIBILITY
   =================================== */

/* Riduzione movimento per utenti con preferenze */
@media (prefers-reduced-motion: reduce) {
    .image-background {
        animation: none !important;
    }
    
    .form-container,
    .btn-primary,
    .btn-social,
    .link,
    .toggle-password {
        transition: none !important;
    }
}

/* Focus visibile per tastiera */
input:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 3px solid #7A9E9F;
    outline-offset: 2px;
}

/* ===================================
   LOADING STATE (opzionale)
   =================================== */

.btn-primary.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-primary.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===================================
   UTILITÀ
   =================================== */

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}
