/* BB Formularios - Estilos Frontend Mejorados */
.bb-form-registro-container,
.bb-form-container {
    max-width: 600px;
    margin: 0 auto 40px;
}

.bb-form {
    background: #ffffff;
    border: 1px solid #e1e1e1;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.bb-form:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.bb-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.bb-form-field {
    margin-bottom: 25px;
    position: relative;
}

.bb-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bb-form-required {
    color: #e74c3c;
    margin-left: 2px;
}

.bb-form-field input,
.bb-form-field select,
.bb-form-field textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #fafafa;
    font-family: inherit;
}

.bb-form-field input:focus,
.bb-form-field select:focus,
.bb-form-field textarea:focus {
    border-color: #3498db;
    background: #ffffff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    transform: translateY(-2px);
}

.bb-form-field textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

.bb-form-field select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 45px;
}

.bb-form-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    cursor: pointer;
    padding: 8px 0;
    transition: all 0.2s ease;
}

.bb-form-checkbox-label:hover {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 0 -12px 12px -12px;
}

.bb-form-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #3498db;
}

.bb-form-actions {
    margin-top: 35px;
    text-align: center;
}

.bb-form-submit {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 16px 50px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-width: 180px;
}

.bb-form-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(52, 152, 219, 0.3);
    background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
}

.bb-form-submit:active {
    transform: translateY(-1px);
}

.bb-form-submit:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.bb-form-submit::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;
}

.bb-form-submit:hover::before {
    left: 100%;
}

.bb-form-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.bb-form-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: bb-form-spin 1s linear infinite;
}

@keyframes bb-form-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.bb-form-honeypot {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

.bb-form-messages {
    margin-top: 25px;
    padding: 20px;
    border-radius: 8px;
    display: none;
    animation: bb-form-fadeIn 0.5s ease;
}

.bb-form-messages.success {
    background: #d4f8e8;
    border: 1px solid #27ae60;
    color: #155724;
    display: block;
}

.bb-form-messages.error {
    background: #fde8e8;
    border: 1px solid #e74c3c;
    color: #721c24;
    display: block;
}

.bb-form-messages ul {
    margin: 0;
    padding-left: 20px;
}

.bb-form-messages li {
    margin-bottom: 5px;
}

.bb-form-messages li:last-child {
    margin-bottom: 0;
}

@keyframes bb-form-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estados de validación */
.bb-form-field input:invalid:not(:focus):not(:placeholder-shown),
.bb-form-field select:invalid:not(:focus),
.bb-form-field textarea:invalid:not(:focus):not(:placeholder-shown) {
    border-color: #e74c3c;
    background: #fdf2f2;
}

.bb-form-field input:valid:not(:focus):not(:placeholder-shown),
.bb-form-field select:valid:not(:focus),
.bb-form-field textarea:valid:not(:focus):not(:placeholder-shown) {
    border-color: #27ae60;
    background: #f2fdf2;
}

/* Placeholders mejorados */
.bb-form-field input::placeholder,
.bb-form-field textarea::placeholder {
    color: #95a5a6;
    opacity: 1;
    transition: all 0.3s ease;
}

.bb-form-field input:focus::placeholder,
.bb-form-field textarea:focus::placeholder {
    opacity: 0.7;
    transform: translateX(5px);
}

/* Estados de carga del formulario */
.bb-form-loading .bb-form-field input,
.bb-form-loading .bb-form-field select,
.bb-form-loading .bb-form-field textarea {
    opacity: 0.7;
    pointer-events: none;
}

.bb-form-loading .bb-form-submit {
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    .bb-form-registro-container,
    .bb-form-container {
        max-width: 100%;
        margin: 0 auto 30px;
    }
    
    .bb-form {
        padding: 30px 25px;
        border-radius: 10px;
    }
    
    .bb-form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .bb-form-field {
        margin-bottom: 20px;
    }
    
    .bb-form-field input,
    .bb-form-field select,
    .bb-form-field textarea {
        padding: 12px 14px;
        font-size: 16px; /* Previene zoom en iOS */
    }
    
    .bb-form-actions {
        margin-top: 30px;
    }
    
    .bb-form-submit {
        padding: 14px 40px;
        width: 100%;
        max-width: 280px;
    }
}

@media (max-width: 480px) {
    .bb-form {
        padding: 25px 20px;
        border-radius: 8px;
    }
    
    .bb-form-field label {
        font-size: 13px;
    }
    
    .bb-form-field input,
    .bb-form-field select,
    .bb-form-field textarea {
        padding: 11px 13px;
    }
    
    .bb-form-submit {
        padding: 13px 35px;
        font-size: 15px;
    }
}

/* Modo alto contraste */
@media (prefers-contrast: high) {
    .bb-form {
        border: 2px solid #000;
    }
    
    .bb-form-field input,
    .bb-form-field select,
    .bb-form-field textarea {
        border: 2px solid #000;
        background: #fff;
    }
    
    .bb-form-field input:focus,
    .bb-form-field select:focus,
    .bb-form-field textarea:focus {
        border: 3px solid #000;
        background: #fff;
    }
}

/* Modo reducido de movimiento */
@media (prefers-reduced-motion: reduce) {
    .bb-form,
    .bb-form-field input,
    .bb-form-field select,
    .bb-form-field textarea,
    .bb-form-submit {
        transition: none;
    }
    
    .bb-form-submit:hover {
        transform: none;
    }
    
    .bb-form-submit::before {
        display: none;
    }
    
    @keyframes bb-form-fadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

/* Mejoras de accesibilidad */
.bb-form-field input:focus,
.bb-form-field select:focus,
.bb-form-field textarea:focus,
.bb-form-submit:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.bb-form-checkbox-label:focus-within {
    outline: 2px solid #3498db;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Estados de éxito después del envío */
.bb-form-sent .bb-form-field {
    opacity: 0.6;
    pointer-events: none;
}

.bb-form-sent .bb-form-submit {
    display: none;
}

/* Variaciones de estilo para diferentes tipos de formularios */
.bb-form-contacto {
    border-left: 4px solid #3498db;
}

.bb-form-registro {
    border-left: 4px solid #27ae60;
}

.bb-form-suscripcion {
    border-left: 4px solid #e67e22;
}

.bb-form-personalizado {
    border-left: 4px solid #9b59b6;
}

/* Efectos de campo flotante */
.bb-form-field {
    position: relative;
}

.bb-form-field-floating label {
    position: absolute;
    top: 14px;
    left: 16px;
    background: white;
    padding: 0 8px;
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1;
}

.bb-form-field-floating input:focus + label,
.bb-form-field-floating input:not(:placeholder-shown) + label,
.bb-form-field-floating textarea:focus + label,
.bb-form-field-floating textarea:not(:placeholder-shown) + label {
    top: -8px;
    font-size: 12px;
    color: #3498db;
    font-weight: 600;
}

/* Tooltips de ayuda */
.bb-form-field-help {
    display: inline-block;
    margin-left: 5px;
    color: #7f8c8d;
    cursor: help;
    position: relative;
}

.bb-form-field-help:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.bb-form-field-help:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #2c3e50;
    margin-bottom: -5px;
}