body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

header {
    flex: 0 0 auto; /* L'header non si schiaccia */
    z-index: 10;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.login-split-container {
    flex: 1;
    display: flex;
    width: 100%;
}

.left-panel {
    width: 35%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--light-bg);
    padding: 40px;
    position: relative;
}

.login-card {
    background: white;
    padding: 40px;
    margin-top: 20%;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 400px;
    animation: slideInLeft 0.8s ease-out;
}

.login-card h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 2rem;
}

.login-card p {
    color: #666;
    margin-bottom: 30px;
}





.right-panel {
    flex: 1;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
}
.c1 { width: 300px; height: 300px; top: -50px; right: -50px; animation: float 6s infinite ease-in-out; }
.c2 { width: 500px; height: 500px; bottom: -100px; left: -100px; animation: float 8s infinite ease-in-out reverse; }

.lock-container {
    position: relative;
    width: 120px;
    height: 150px;
    animation: popIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.shackle {
    width: 80px;
    height: 70px;
    border: 12px solid var(--secondary-color);
    border-bottom: none;
    border-radius: 40px 40px 0 0;
    position: absolute;
    top: 0;
    left: 20px;
    transform-origin: bottom right;
    transition: all 0.5s ease;
    animation: unlock 4s infinite;
}

.lock-body {
    width: 120px;
    height: 100px;
    background: white;
    position: absolute;
    bottom: 0;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.keyhole {
    width: 20px;
    height: 30px;
    background: var(--primary-color);
    border-radius: 10px;
    position: relative;
}
.keyhole::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 15px;
    background: var(--primary-color);
}

.access-text {
    position: absolute;
    bottom: 20%;
    color: rgba(255,255,255,0.8);
    font-size: 1.2rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: bold;
    animation: fadeIn 2s ease;
}

/* KEYFRAMES */
@keyframes unlock {
    0%, 20% { transform: translateY(0); } /* Chiuso */
    30%, 40% { transform: translateY(-25px); } /* Scatta su */
    50%, 70% { transform: translateY(-25px) rotateY(180deg); opacity: 0.8; } /* Gira (opzionale) o resta su */
    80% { transform: translateY(0); } /* Richiude */
    100% { transform: translateY(0); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(20px); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-50px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes popIn {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }



/* Animazione in caso di password sbagliata */
.error-msg {
    background-color: #fff5f5;
    color: #c0392b;
    border-left: 5px solid #c0392b;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 25px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}






@media (max-width: 600px) {
    
    .right-panel {
        display: none; 
    }

    /* La parte sinistra occupa tutto lo spazio disponibile */
    .left-panel {
        width: 100%;
        flex: 1;
        padding: 20px;
    }

    header nav .logo h1 {
        font-size: 35px !important;
    }
    .logo{
        margin-left: 9%;
    }
}

@media (min-width: 601px) and (max-width: 900px) {
    .login-split-container {
        flex-direction: column;
    }
    .left-panel {
        width: 100%;
        padding: 40px;
        margin-top: -3%;
    }
    .right-panel {
        display: flex;
        width: 100%;
        min-height: 380px;
        overflow: hidden;
    }
    .login-card {
        max-width: 90%;
    }
    .lock-container {
        transform: scale(0.8);
    }

    header nav .logo h1 {
        font-size: 35px !important;
    }
    .logo{
        margin-left: 9%;
    }
}

.form-group input {
    background-color: #f4f4f4;
    border: 1px solid #ddd;
    transition: 0.3s;
}
.form-group input:focus {
    background-color: white;
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 38, 51, 0.1);
}