/* Estilo general del formulario */
form {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-content: center;
    position: relative;
    margin: 0 auto;
    width: 50%;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    font-family: Arial, sans-serif;
    font-size: 16px;
    color: #333;
    transition: all 0.3s ease;
    border: 1px solid #ccc;
    box-sizing: border-box;
    margin-top: 20px;
    margin-bottom: 20px;
    overflow: hidden; /* Para evitar que el borde animado sobresalga */
}

/* Inputs y textarea */
form input[type="text"],
form input[type="email"],
form input[type="password"],
form textarea {
    width: 100%;
    padding: 10px;
    margin: 10px 0;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    color: #333;
    transition: all 0.3s ease;
}

form input[type="text"]:focus,
form input[type="email"]:focus,
form input[type="password"]:focus,
form textarea:focus {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
    outline: none;
}

/* Botón de envío */
form button[type="submit"] {
    background-color: #007bff;
    margin: 20px;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

form button[type="submit"]:hover {
    background-color: #0056b3;
    transform: scale(1.05);
    transition: all 0.3s ease;
}

/* Modo oscuro */
form.dark-mode {
    background-color: #1e1e1e;
    color: #ffffff;
    border: 1px solid #007bff;
    position: relative; /* Necesario para el pseudo-elemento ::before */
    overflow: hidden; /* Evita que el borde animado sobresalga */
}

/* Borde animado solo en modo oscuro */
form.dark-mode:before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid #007bff;
    border-radius: 5px;
    box-sizing: border-box;
    animation: border-animation 2s linear infinite;
    pointer-events: none; /* Evita que interfiera con la interacción del usuario */
}

/* Animación del borde */
@keyframes border-animation {
    0% {
        clip-path: polygon(0% 0%, 0% 0%, 0% 100%, 0% 100%);
    }
    25% {
        clip-path: polygon(0% 0%, 100% 0%, 100% 0%, 0% 0%);
    }
    50% {
        clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 100% 100%);
    }
    75% {
        clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
    }
    100% {
        clip-path: polygon(0% 0%, 0% 0%, 0% 100%, 0% 100%);
    }
}