/* =======================
   📝 SISTEMA DE FORMULARIOS GLOBAL
   ======================= */

/* Variables específicas para formularios */
:root {
    --form-bg: var(--bg-tertiary);
    --form-border: var(--border-primary);
    --form-border-focus: var(--purple-primary);
    --form-text: var(--text-primary);
    --form-placeholder: var(--text-muted);
    --form-error: var(--danger);
    --form-success: var(--success);
    --form-warning: var(--warning);
    
    --form-radius: var(--radius);
    --form-padding: 0.75rem 1rem;
    --form-transition: all 0.3s ease;
    
    --form-shadow-focus: 0 0 0 3px rgba(139, 92, 246, 0.1);
    --form-shadow-error: 0 0 0 3px rgba(239, 68, 68, 0.1);
    --form-shadow-success: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* =======================
   📋 ELEMENTOS BASE DE FORMULARIOS
   ======================= */

/* Contenedor de formulario */
.form-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

/* Grupos de formulario */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

/* Labels */
.form-label {
    display: block;
    color: var(--form-text);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    transition: var(--form-transition);
}

.form-label i {
    color: var(--purple-primary);
    margin-right: 0.5rem;
    width: 16px;
    text-align: center;
}

.form-label.required::after {
    content: ' *';
    color: var(--form-error);
    font-weight: 700;
}

/* =======================
   📝 CAMPOS DE ENTRADA
   ======================= */

/* Inputs de texto */
.form-input {
    width: 100%;
    background: var(--form-bg);
    border: 1px solid var(--form-border);
    border-radius: var(--form-radius);
    padding: var(--form-padding);
    color: var(--form-text);
    font-size: 0.95rem;
    transition: var(--form-transition);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--form-border-focus);
    box-shadow: var(--form-shadow-focus);
    background: var(--bg-hover);
}

.form-input::placeholder {
    color: var(--form-placeholder);
    opacity: 0.7;
}

.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-secondary);
}

/* Inputs específicos */
.form-input[type="email"] {
    text-transform: lowercase;
}

.form-input[type="password"] {
    letter-spacing: 0.1em;
}

.form-input[type="number"] {
    -moz-appearance: textfield;
}

.form-input[type="number"]::-webkit-outer-spin-button,
.form-input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* =======================
   📋 SELECTS
   ======================= */

.form-select {
    width: 100%;
    background: var(--form-bg);
    border: 1px solid var(--form-border);
    border-radius: var(--form-radius);
    padding: var(--form-padding);
    color: var(--form-text);
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--form-transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

.form-select:focus {
    outline: none;
    border-color: var(--form-border-focus);
    box-shadow: var(--form-shadow-focus);
    background-color: var(--bg-hover);
}

.form-select option {
    background: var(--bg-card);
    color: var(--form-text);
    padding: 0.5rem;
}

/* =======================
   📝 TEXTAREAS
   ======================= */

.form-textarea {
    width: 100%;
    background: var(--form-bg);
    border: 1px solid var(--form-border);
    border-radius: var(--form-radius);
    padding: var(--form-padding);
    color: var(--form-text);
    font-size: 0.95rem;
    transition: var(--form-transition);
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--form-border-focus);
    box-shadow: var(--form-shadow-focus);
    background: var(--bg-hover);
}

.form-textarea::placeholder {
    color: var(--form-placeholder);
    opacity: 0.7;
}

/* =======================
   📁 UPLOAD DE ARCHIVOS
   ======================= */

.form-file {
    position: relative;
    display: inline-block;
    width: 100%;
}

.form-file input[type="file"] {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

.form-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: var(--form-padding);
    background: var(--form-bg);
    border: 2px dashed var(--form-border);
    border-radius: var(--form-radius);
    color: var(--form-text);
    cursor: pointer;
    transition: var(--form-transition);
    text-align: center;
    min-height: 120px;
    flex-direction: column;
}

.form-file-label:hover {
    border-color: var(--form-border-focus);
    background: var(--bg-hover);
}

.form-file-label.dragover {
    border-color: var(--form-border-focus);
    background: rgba(139, 92, 246, 0.1);
    transform: scale(1.02);
}

.form-file-label i {
    font-size: 2rem;
    color: var(--purple-primary);
    margin-bottom: 0.5rem;
}

.form-file-info {
    font-size: 0.9rem;
    color: var(--form-placeholder);
    margin-top: 0.5rem;
}

/* =======================
   ☑️ CHECKBOXES Y RADIOS
   ======================= */

.form-checkbox,
.form-radio {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: var(--form-transition);
}

.form-checkbox:hover,
.form-radio:hover {
    color: var(--purple-primary);
}

.form-checkbox input[type="checkbox"],
.form-radio input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--purple-primary);
    cursor: pointer;
}

.form-checkbox input[type="checkbox"]:focus,
.form-radio input[type="radio"]:focus {
    outline: 2px solid var(--purple-primary);
    outline-offset: 2px;
}

/* =======================
   🔍 BÚSQUEDA Y FILTROS
   ======================= */

.search-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-input .form-input {
    padding-left: 2.5rem;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--form-placeholder);
    pointer-events: none;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* =======================
   ⚠️ ESTADOS DE VALIDACIÓN
   ======================= */

/* Error */
.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: var(--form-error);
    box-shadow: var(--form-shadow-error);
}

.form-error {
    color: var(--form-error);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-error i {
    font-size: 0.75rem;
}

/* Success */
.form-input.success,
.form-select.success,
.form-textarea.success {
    border-color: var(--form-success);
    box-shadow: var(--form-shadow-success);
}

.form-success {
    color: var(--form-success);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Warning */
.form-input.warning,
.form-select.warning,
.form-textarea.warning {
    border-color: var(--form-warning);
}

/* =======================
   📊 CONTADORES Y FEEDBACK
   ======================= */

.input-feedback {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

.char-counter {
    color: var(--form-placeholder);
}

.char-counter.near-limit {
    color: var(--form-warning);
}

.char-counter.at-limit {
    color: var(--form-error);
}

.validation-message {
    color: var(--form-error);
    font-weight: 500;
}

/* =======================
   🎨 WIZARD Y PASOS
   ======================= */

.wizard-container {
    max-width: 1000px;
    margin: 0 auto;
}

.wizard-progress {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
    position: relative;
}

.wizard-progress::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--form-border);
    transform: translateY(-50%);
    z-index: 1;
}

.wizard-step {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--form-bg);
    border: 2px solid var(--form-border);
    color: var(--form-placeholder);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    transition: var(--form-transition);
}

.step-circle.active {
    background: var(--purple-primary);
    border-color: var(--purple-primary);
    color: white;
    box-shadow: var(--shadow-purple);
    transform: scale(1.1);
}

.step-circle.completed {
    background: var(--form-success);
    border-color: var(--form-success);
    color: white;
    box-shadow: var(--shadow-success);
}

.step-label {
    font-size: 0.8rem;
    color: var(--form-placeholder);
    font-weight: 500;
    text-align: center;
}

.step-circle.active + .step-label {
    color: var(--purple-primary);
    font-weight: 600;
}

/* =======================
   📱 RESPONSIVE DESIGN
   ======================= */

@media (max-width: 768px) {
    .form-container {
        padding: 1rem;
    }
    
    .search-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-input {
        min-width: auto;
    }
    
    .filter-group {
        justify-content: center;
    }
    
    .wizard-progress {
        gap: 0.5rem;
    }
    
    .step-circle {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .step-label {
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px; /* Previene zoom en iOS */
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .wizard-progress {
        margin: 1rem 0;
    }
}

/* =======================
   🎯 ANIMACIONES
   ======================= */

@keyframes formFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-step {
    animation: formFadeIn 0.3s ease;
}

@keyframes formShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.form-input.error {
    animation: formShake 0.3s ease;
}

/* =======================
   🎨 TEMAS ADICIONALES
   ======================= */

/* Tema claro (opcional) */
[data-theme="light"] {
    --form-bg: #ffffff;
    --form-border: #e5e7eb;
    --form-text: #374151;
    --form-placeholder: #9ca3af;
}

/* Modo de alto contraste */
@media (prefers-contrast: high) {
    .form-input,
    .form-select,
    .form-textarea {
        border-width: 2px;
    }
    
    .form-input:focus,
    .form-select:focus,
    .form-textarea:focus {
        border-width: 3px;
    }
}

/* Modo de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    .form-input,
    .form-select,
    .form-textarea,
    .form-file-label,
    .step-circle {
        transition: none;
    }
    
    .form-step {
        animation: none;
    }
    
    .form-input.error {
        animation: none;
    }
} 