/* Responsive Forms Enhancement */

/* Form Container Responsive */
.form-container {
    width: 100% !important;
    max-width: 400px;
}

/* Checkbox styling */
.form-group input[type="checkbox"] {
    width: auto !important;
    margin-right: 0.5rem;
    cursor: pointer;
}

/* Password toggle button */
.password-wrapper {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
    font-size: 0.9rem;
}

.toggle-password:hover {
    color: var(--accent-color);
}

/* Form validation styles */
.form-group.has-error input {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 2px rgba(255, 0, 110, 0.2) !important;
}

.form-error {
    display: block;
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Form responsive styles for tablets */
@media (max-width: 768px) {
    .form-container {
        padding: 1.5rem !important;
        margin: 1.5rem auto !important;
        max-width: calc(100% - 2rem) !important;
    }
    
    .form-container h2 {
        font-size: 1.5rem !important;
        margin-bottom: 1.5rem !important;
        text-align: center;
    }
    
    .form-group {
        margin-bottom: 1.25rem !important;
    }
    
    .form-group label {
        font-size: 0.9rem !important;
    }
    
    .form-group input {
        padding: 0.7rem !important;
        font-size: 16px !important; /* Prevenir zoom en iOS */
    }
    
    .btn-block {
        width: 100% !important;
        padding: 0.8rem !important;
    }
}

/* Form responsive styles for mobile */
@media (max-width: 480px) {
    .form-container {
        padding: 1.25rem !important;
        margin: 1rem auto !important;
        border-radius: 15px !important;
        max-width: calc(100% - 1rem) !important;
    }
    
    .form-container h2 {
        font-size: 1.3rem !important;
        margin-bottom: 1.25rem !important;
    }
    
    .form-group {
        margin-bottom: 1rem !important;
    }
    
    .form-group input {
        padding: 0.65rem !important;
        font-size: 16px !important;
    }
    
    .btn-block {
        padding: 0.75rem !important;
        font-size: 0.95rem !important;
    }
    
    /* Ajustar links en formularios */
    .form-container a {
        font-size: 0.9rem !important;
    }
    
    /* Mejorar espaciado en checkbox */
    .form-group label input[type="checkbox"] {
        margin-right: 0.3rem !important;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .form-container {
        margin: 0.5rem auto !important;
        padding: 1rem !important;
    }
    
    .form-group {
        margin-bottom: 0.75rem !important;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .form-group input {
        -webkit-appearance: none;
        appearance: none;
    }
    
    .form-group input:focus {
        font-size: 16px !important;
    }
}

/* Loading state for forms */
.form-container form.loading {
    pointer-events: none;
    opacity: 0.7;
}

.form-container form.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
}

/* Mejoras para el menú móvil */
@media (max-width: 768px) {
    /* Prevenir scroll cuando el menú está abierto */
    body.menu-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }
    
    /* Overlay para el menú */
    .nav-menu::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
        z-index: 998;
    }
    
    .nav-links.active + .nav-menu::after {
        opacity: 1;
        visibility: visible;
    }
    
    /* Mejorar animación del menú */
    .nav-links {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-links li {
        opacity: 0;
        transform: translateX(-20px);
        animation: none;
    }
    
    .nav-links.active li {
        animation: slideInMenu 0.3s ease forwards;
    }
    
    .nav-links.active li:nth-child(1) { animation-delay: 0.1s; }
    .nav-links.active li:nth-child(2) { animation-delay: 0.15s; }
    .nav-links.active li:nth-child(3) { animation-delay: 0.2s; }
    .nav-links.active li:nth-child(4) { animation-delay: 0.25s; }
    
    @keyframes slideInMenu {
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    
    /* Mejorar botones en el menú móvil */
    .nav-links .btn {
        margin: 0 1rem;
        display: block;
        text-align: center;
    }
}