/**
 * USABILITY IMPROVEMENTS - Bimmer Modular
 * =======================================
 * Mejoras de experiencia de usuario y accesibilidad
 * Incluye: validación visual, feedback, microinteracciones mejoradas
 */

/* ==================== CAMPOS REQUERIDOS ==================== */

/* Indicador visual para campos requeridos */
.req {
    color: #dc2626;
    font-weight: 700;
    margin-left: 2px;
    opacity: 1;
}

.form-group label:has(> .req) {
    font-weight: 600;
}

/* ==================== VALIDACIÓN EN FORMULARIOS ==================== */

/* Estados de inputs */
.form-group input:invalid {
    border-color: #fca5a5;
    background-color: #fef2f2;
}

.form-group input:valid:not(:placeholder-shown) {
    border-color: #86efac;
    background-color: #f0fdf4;
}

.form-group input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ==================== BOTONES - HOVERS CONSISTENTES ==================== */

/* Estandarizar hovers de botones principal */
.btn-hero:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.btn-hero:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Botones secundarios */
.btn-cancel-modern:hover:not(:disabled),
.btn-import-bimmer:hover:not(:disabled) {
    transform: translateY(-1px);
    background-color: #f0f0f0;
}

.btn-cancel-modern:active:not(:disabled),
.btn-import-bimmer:active:not(:disabled) {
    transform: translateY(0);
}

/* Botones de acción crítica */
.btn-delete:hover:not(:disabled) {
    background-color: #fca5a5;
    transform: scale(1.1);
}

.btn-delete:active:not(:disabled) {
    transform: scale(1.05);
}

/* ==================== FEEDBACK DE OPERACIONES ==================== */

/* Estados de carga */
.btn-hero:disabled,
button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Indicador visual de guardado/cambios */
.btn-create-modern.is-dirty {
    animation: pulse-dirty 2s ease-in-out infinite;
}

@keyframes pulse-dirty {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
}

/* ==================== MODAL IMPROVEMENTS ==================== */

/* Cierre claro de modales */
.btn-delete[aria-label="Cerrar"],
.project-create-close-button {
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.1);
    color: inherit;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete[aria-label="Cerrar"]:hover,
.project-create-close-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* ==================== FOCUS VISIBLE PARA ACCESIBILIDAD ==================== */

/* Enfoque visible para navegación por teclado */
*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

button:focus-visible {
    outline: 2px solid #3b82f6;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 1px;
}

/* ==================== INDICADORES DE CANTIDAD ==================== */

.quantity-control-modern {
    display: flex;
    align-items: center;
    gap: 4px;
}

.quantity-step-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-step-btn:hover {
    background: #e5e7eb;
    transform: scale(1.05);
}

.quantity-step-btn:active {
    transform: scale(0.95);
}

/* ==================== DROPDOWN IMPROVEMENTS ==================== */

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 28px;
    cursor: pointer;
}

select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 1px;
}

/* ==================== HELP TEXT ==================== */

.form-help {
    font-size: 0.8rem;
    color: #6b7280;
    margin-top: 4px;
    display: block;
}

.form-error {
    font-size: 0.8rem;
    color: #dc2626;
    margin-top: 4px;
    display: block;
    font-weight: 500;
}

/* ==================== MOBILE IMPROVEMENTS ==================== */

@media (max-width: 768px) {
    /* Botones más grandes en mobile */
    .btn-hero {
        min-height: 44px;
        min-width: 44px;
    }

    /* Inputs más accesibles en mobile */
    .form-group input,
    .form-group select {
        min-height: 44px;
        font-size: 16px; /* Previene zoom en iOS */
    }

    /* Espaciado mejorado en mobile */
    .form-group {
        margin-bottom: 16px;
    }

    /* Botones delete más grandes */
    .btn-delete {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* ==================== DARK MODE ==================== */

body.dark-mode .form-group input::placeholder {
    color: #9ca3af;
}

body.dark-mode .form-group input:invalid {
    background-color: #7f1d1d;
    border-color: #fca5a5;
}

body.dark-mode .form-group input:valid:not(:placeholder-shown) {
    background-color: #064e3b;
    border-color: #86efac;
}

body.dark-mode .quantity-step-btn {
    background: #374151;
    border-color: #4b5563;
}

body.dark-mode .quantity-step-btn:hover {
    background: #4b5563;
}

body.dark-mode select {
    background-color: #1f2937;
    color: #f3f4f6;
    border-color: #4b5563;
}

/* ==================== ANIMACIONES DE FEEDBACK ==================== */

@keyframes slideInMessage {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-message {
    animation: slideInMessage 0.3s ease;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-top: 8px;
}

.form-message.success {
    background: #d1fae5;
    color: #065f46;
    border-left: 3px solid #10b981;
}

.form-message.error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 3px solid #dc2626;
}

.form-message.warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 3px solid #f59e0b;
}

/* ==================== CONFIRMACIONES ==================== */

/* Estilos para diálogos de confirmación */
.confirm-dialog {
    padding: 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.confirm-dialog-text {
    font-size: 1rem;
    color: #374151;
    margin-bottom: 20px;
}

.confirm-dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

body.dark-mode .confirm-dialog {
    background: #1f2937;
    color: #f3f4f6;
}
