/*
* Archivo: CotizEspSolicitud.css (OPTIMIZADO)
* Ruta: src\static\css\Ventas\Cotiz\CotizEspSolicitud.css
* Descripción: Estilos optimizados para la solicitud de cotizaciones especiales
* Optimización: Reducción de redundancias, mejor performance, manteniendo 100% compatibilidad
*/

/*---------------------------------------------------
    1. VARIABLES GLOBALES - Optimizadas y consolidadas
---------------------------------------------------*/
:root {
    /* === TIPOGRAFÍA === */
    --font-family-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-family-secondary: Georgia, 'Times New Roman', serif;
    --font-family-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    
    /* === TAMAÑOS DE TEXTO DESKTOP === */
    --font-size-title: 1.5rem;
    --font-size-subtitle: 1.2rem;
    --font-size-sub-subtitle: 1rem;
    --font-size-section: 1rem;
    --font-size-base: 0.9rem;
    --font-size-small: 0.8rem;
    --font-size-large: 1.2rem;
    --font-size-button: 0.9rem;
    --font-size-button-large: 1rem;
    --font-size-button-small: 0.8rem;
    --font-size-select: 0.9rem;
    --font-size-option: 0.9rem;
    --font-size-placeholder: 0.85rem;
    --font-size-helper: 0.75rem;
    
    /* === TAMAÑOS RESPONSIVOS MÓVIL === */
    --font-size-title-mobile: 1.2rem;
    --font-size-subtitle-mobile: 1rem;
    --font-size-sub-subtitle-mobile: 0.8rem;
    --font-size-section-mobile: 0.8rem;
    --font-size-base-mobile: 0.8rem;
    --font-size-small-mobile: 0.8rem;
    --font-size-button-mobile: 0.85rem;
    --font-size-button-large-mobile: 0.8rem;
    --font-size-button-small-mobile: 0.8rem;
    --font-size-select-mobile: 0.8rem;
    --font-size-option-mobile: 0.8rem;
    
    /* === PESOS DE FUENTE === */
    --font-weight-title: 700;
    --font-weight-subtitle: 600;
    --font-weight-label: 500;
    --font-weight-base: 400;
    --font-weight-light: 300;

    /* === COLORES === */
    --color-primary: #4e8cff;
    --color-secondary: #6c757d;
    --color-success: #00e4d0;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-info: #17a2b8;
    --color-text-primary: #253858;
    --color-text-secondary: #4d6287;
    
    /* === COLORES DE HOVER === */
    --hover-primary: #0056b3;
    --hover-secondary: #5a6268;
    --hover-success: #218838;
    
    /* === FONDOS === */
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --bg-form: #ffffff;
    
    /* === BORDES Y SOMBRAS === */
    --border-color: #e9ecef;
    --border-radius: 8px;
    --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-primary: 0 0 15px rgba(78, 140, 255, 0.3);
    
    /* === ESPACIADO === */
    --gap-xs: 8px;
    --gap-sm: 12px;
    --gap-md: 16px;
    --gap-lg: 24px;
    --gap-xl: 32px;
    
    /* === GRADIENTES === */
    --gradient-primary: linear-gradient(45deg, var(--color-primary), var(--color-success));
    --gradient-subtitle: linear-gradient(90deg, var(--color-primary), var(--color-success));
    --gradient-dark: linear-gradient(90deg, #333, grey);
}

/*---------------------------------------------------
    2. CONTENEDORES BASE
---------------------------------------------------*/
.form-main-container {
    background-color: var(--bg-light);
    padding: var(--gap-lg);
    border-radius: var(--border-radius);
    border: 3px solid transparent;
    border-image: var(--gradient-primary) 1;
    box-shadow: var(--shadow-primary);
    margin: var(--gap-md) 0;
}

.form-section {
    background-color: var(--bg-form);
    padding: var(--gap-lg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    margin-bottom: var(--gap-lg);
    border: 1px dashed rgba(0, 0, 0, 0.171);
}

.form-search-container {
    display: flex;
    align-items: center;
    gap: var(--gap-md);
    background-color: var(--bg-white);
    padding: var(--gap-md);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-primary);
    margin-bottom: var(--gap-lg);
}

/*---------------------------------------------------
    3. TÍTULOS Y ENCABEZADOS - Consolidados
---------------------------------------------------*/
.form-title,
.form-subtitle,
.form-sub-subtitle {
    font-family: var(--font-family-primary);
    color: var(--color-text-primary);
    position: relative;
}

.form-title {
    text-align: center;
    font-size: var(--font-size-title);
    font-weight: var(--font-weight-title);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
}

.form-title::after {
    content: "";
    display: block;
    width: 120px;
    height: 3px;
    background: var(--gradient-subtitle);
    margin: 0.5rem auto 0;
    border-radius: 2px;
}

.form-subtitle {
    font-size: var(--font-size-subtitle);
    font-weight: var(--font-weight-subtitle);
    margin: var(--gap-lg) 0 var(--gap-md) 0;
    padding-bottom: 0.3rem;
}

.form-subtitle::after {
    content: "";
    display: block;
    width: 60px;
    height: 2px;
    background: var(--gradient-subtitle);
    margin-top: 0.3rem;
    border-radius: 2px;
}

.form-sub-subtitle {
    font-size: var(--font-size-sub-subtitle);
    font-weight: var(--font-weight-base);
    color: var(--color-text-secondary);
    margin: var(--gap-lg) 0 var(--gap-md) 0;
    padding-bottom: 0.3rem;
}

.form-sub-subtitle::after {
    content: "";
    display: block;
    width: 60px;
    height: 2px;
    background: var(--gradient-dark);
    opacity: 0.4;
    margin-top: 0.1rem;
    border-radius: 2px;
}

.form-section-title {
    font-size: var(--font-size-section);
    font-weight: var(--font-weight-subtitle);
    font-family: var(--font-family-primary);
    color: var(--color-text-primary);
    margin: var(--gap-md) 0 var(--gap-sm) 0;
}

/*---------------------------------------------------
    4. LAYOUTS GRID - Optimizados
---------------------------------------------------*/
.row-1col,
.row-2col,
.row-3col,
.row-4col {
    display: grid;
    gap: var(--gap-md);
    margin-bottom: var(--gap-md);
}

.row-1col { grid-template-columns: 1fr; }
.row-2col { grid-template-columns: repeat(2, 1fr); }
.row-3col { grid-template-columns: repeat(3, 1fr); }
.row-4col { grid-template-columns: repeat(4, 1fr); }

.row-label-input {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--gap-md);
    align-items: center;
    margin-bottom: var(--gap-md);
}

/*---------------------------------------------------
    5. LAYOUTS FLEX - Consolidados
---------------------------------------------------*/
.row-actions,
.row-search,
.row-flex {
    display: flex;
    align-items: center;
    gap: var(--gap-md);
}

.row-actions {
    justify-content: space-between;
    margin-top: var(--gap-lg);
}

.row-actions.center { justify-content: center; }
.row-actions.end { justify-content: flex-end; }

.row-search {
    margin-bottom: var(--gap-lg);
}

/* === PROPORCIONES FLEX === */
.flex-auto { flex: 0 0 auto; }
.flex-1 { flex: 1 1 0; }
.flex-2 { flex: 2 1 0; }
.flex-3 { flex: 3 1 0; }
.flex-4 { flex: 4 1 0; }
.flex-8 { flex: 8 1 0; }
.flex-half { flex: 0.5 1 0; }
.flex-1-min100 { flex: 1 1 100px; }
.flex-2-min150 { flex: 2 1 150px; }
.flex-3-min200 { flex: 3 1 200px; }

/* === CLASES ESPECÍFICAS PARA BÚSQUEDA === */
.search-label {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-label);
}

.search-input {
    flex: 2 1 150px;
    min-width: 120px;
    max-width: 300px;
}

.search-button {
    flex: 1 1 100px;
    min-width: 80px;
}

.search-spacer {
    flex: 2 1 60px;
}

.search-button-secondary {
    flex: 1.5 1 120px;
    min-width: 100px;
}

/*---------------------------------------------------
    6. GRUPOS DE CAMPOS - Optimizados
---------------------------------------------------*/
.field-group {
    display: flex;
    flex-direction: column;
}

/* === LABELS CONSOLIDADOS === */
.field-group label,
.row-1col .field-group label,
.row-2col .field-group label,
.row-3col .field-group label,
label {
    font-weight: var(--font-weight-label);
    font-family: var(--font-family-primary);
    color: #333;
    font-size: var(--font-size-base);
    margin-bottom: var(--gap-xs);
}

.field-group label.required::after,
.form-group label.required::after,
label.required::after {
    content: '*';
    color: var(--color-danger);
    margin-left: 3px;
    font-weight: bold;
    font-size: 1.1em;
}

/* === INPUTS CONSOLIDADOS === */
.field-group input,
.field-group select,
.field-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: var(--font-size-base);
    font-family: var(--font-family-primary);
    transition: all 0.2s ease;
}

/* === ESTADOS DE FOCUS === */
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(78, 140, 255, 0.2);
}

/* === ESTADOS DISABLED === */
.field-group input:disabled,
.field-group select:disabled,
.field-group textarea:disabled {
    background-color: var(--bg-light);
    color: var(--color-secondary);
    cursor: not-allowed;
}

/* === PLACEHOLDERS === */
.field-group input::placeholder,
.field-group textarea::placeholder {
    font-size: var(--font-size-placeholder);
    color: #999;
}

/* === SELECTS ESPECÍFICOS === */
.field-group select,
select {
    font-size: var(--font-size-select);
    font-family: var(--font-family-primary);
}

.field-group select option,
select option {
    font-size: var(--font-size-option);
    font-family: var(--font-family-primary);
    padding: 8px 12px;
    line-height: 1.4;
}

/* === TEXTO DE AYUDA === */
.field-group .help-text {
    font-size: var(--font-size-helper);
    color: var(--color-secondary);
    margin-top: var(--gap-xs);
    font-weight: var(--font-weight-light);
    font-style: italic; 
}
/* === TEXTO DE AYUDA === */
.help-text {
    font-size: var(--font-size-helper);
    color: var(--color-secondary);
    margin-top: var(--gap-xs);
    font-weight: var(--font-weight-light);
    font-style: italic; 
}

/* === LAYOUT HORIZONTAL PARA CHECKBOX/RADIO === */
.field-group.horizontal {
    flex-direction: row;
    align-items: center;
    gap: var(--gap-xs);
}

.field-group.horizontal input[type="checkbox"],
.field-group.horizontal input[type="radio"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
}

.field-group.horizontal label {
    flex: 1;
    margin-bottom: 0;
    cursor: pointer;
}

/*---------------------------------------------------
    7. ALINEACIONES DE BOTONES - Consolidadas
---------------------------------------------------*/
.single-button-center,
.single-button-left,
.single-button-right,
.two-buttons-center,
.two-buttons-justified,
.two-buttons-ends,
.two-buttons-left,
.two-buttons-right {
    display: flex;
    margin: var(--gap-lg) 0;
}

.single-button-center,
.two-buttons-center { justify-content: center; }
.single-button-left,
.two-buttons-left { justify-content: flex-start; }
.single-button-right,
.two-buttons-right { justify-content: flex-end; }
.two-buttons-justified,
.two-buttons-ends { justify-content: space-between; }

.two-buttons-center,
.two-buttons-left,
.two-buttons-right {
    gap: var(--gap-md);
}

/*---------------------------------------------------
    8. GRUPOS DE CHECKBOX/RADIO
---------------------------------------------------*/
.checkbox-group-horizontal,
.checkbox-group-columns,
.checkbox-group-vertical {
    margin: var(--gap-sm) 0;
}

.checkbox-group-horizontal {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gap-lg);
}

.checkbox-group-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--gap-md);
}

.checkbox-group-vertical {
    display: flex;
    flex-direction: column;
    gap: var(--gap-sm);
}

/*---------------------------------------------------
    9. INPUTS ESPECIALIZADOS
---------------------------------------------------*/
.file-input-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    width: 100%;
}

.file-input-container input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input-display {
    display: flex;
    align-items: center;
    gap: var(--gap-sm);
    padding: 10px 12px;
    border: 2px dashed var(--border-color);
    border-radius: 4px;
    background-color: var(--bg-light);
    transition: all 0.2s ease;
    font-size: var(--font-size-base);
}

.file-input-container:hover .file-input-display {
    border-color: var(--color-primary);
    background-color: rgba(78, 140, 255, 0.05);
}

.file-input-icon {
    color: var(--color-primary);
    font-weight: bold;
}

.phone-input {
    position: relative;
}

.phone-input input {
    padding-left: 50px;
    font-size: var(--font-size-base);
}

.phone-input::before {
    content: "+52";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-secondary);
    font-size: var(--font-size-base);
    z-index: 1;
}

/*---------------------------------------------------
    10. SISTEMA DE VALIDACIÓN - Consolidado
---------------------------------------------------*/
.field-pending {
    border-color: var(--color-warning);
    border-left: 3px solid var(--color-warning);
    box-shadow: 0 0 0 0.2rem rgba(255, 193, 7, 0.25);
    background-color: #fffdf5;
}

.field-invalid {
    border-color: var(--color-danger);
    border-left: 3px solid var(--color-danger);
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    background-color: #fff8f8;
}

.field-valid {
    border-color: #28a745;
    border-left: 3px solid #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
    background-color: #f8fff8;
}

.form-group.has-error,
.field-group.has-error {
    background-color: rgba(220, 53, 69, 0.05);
    border-radius: 4px;
    padding: 5px;
}

/* === MENSAJES DE VALIDACIÓN === */
.field-error-message,
.field-success-message {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.field-error-message { color: var(--color-danger); }
.field-success-message { color: #28a745; }

/* === CONTADORES DE REQUIRED === */
.required-counter {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    margin-left: 0.5rem;
}

.required-counter.pending {
    color: #856404;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
}

.required-counter.complete {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

.required-counter.error {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.form-subtitle .section-validation-status {
    margin-left: 1rem;
    font-size: 0.9rem;
    font-weight: normal;
}

/*---------------------------------------------------
    11. BOTONES - Consolidados y optimizados
---------------------------------------------------*/
.btn-custom,
.btn,
button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: var(--font-size-button);
    font-weight: var(--font-weight-label);
    font-family: var(--font-family-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

/* === VARIANTES DE BOTONES === */
.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--hover-primary);
}

.btn-success {
    background-color: var(--color-success);
    color: white;
}

.btn-success:hover {
    background-color: var(--hover-success);
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--hover-secondary);
}

.btn-outline {
    background-color: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
}

.btn-outline:hover {
    background-color: var(--color-primary);
    color: white;
}

/* === TAMAÑOS DE BOTONES === */
.btn-large {
    font-size: var(--font-size-button-large);
    padding: 12px 24px;
}

.btn-small {
    font-size: var(--font-size-button-small);
    padding: 6px 12px;
}

/* === BOTONES ESPECIALES PARA POPUPS === */
.btn-continue-waiting {
    background-color: var(--color-info);
    border-color: var(--color-info);
    padding: 10px 20px;
    font-weight: 500;
}

.btn-new-request {
    background-color: #28a745;
    border-color: #28a745;
    font-weight: 500;
}

.btn-keep-form {
    background-color: var(--color-secondary);
    border-color: var(--color-secondary);
    font-weight: 500;
}

/*---------------------------------------------------
    12. UTILIDADES Y COMPONENTES MENORES
---------------------------------------------------*/
.spacer { flex-grow: 1; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-small { font-size: var(--font-size-small); color: var(--color-secondary); }
.text-highlight { font-size: var(--font-size-large); font-weight: var(--font-weight-subtitle); color: var(--color-primary); }
.text-primary { color: #007bff; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; }

/* === MÁRGENES === */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--gap-xs); }
.mb-2 { margin-bottom: var(--gap-sm); }
.mb-3 { margin-bottom: var(--gap-md); }
.mb-4 { margin-bottom: var(--gap-lg); }

/* === POPUPS === */
.large-popup-info { width: 600px; max-width: 90vw; }
.large-popup-success { width: 650px; max-width: 90vw; }
.large-popup-error { width: 550px; max-width: 90vw; }

/* === SPINNER === */
.spinner-border {
    width: 2rem;
    height: 2rem;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

/*---------------------------------------------------
    13. RESPONSIVE - Optimizado
---------------------------------------------------*/
@media (max-width: 1000px) {
    /* === APLICAR VARIABLES MÓVILES === */
    :root {
        --font-size-title: var(--font-size-title-mobile);
        --font-size-subtitle: var(--font-size-subtitle-mobile);
        --font-size-sub-subtitle: var(--font-size-sub-subtitle-mobile);
        --font-size-section: var(--font-size-section-mobile);
        --font-size-base: var(--font-size-base-mobile);
        --font-size-small: var(--font-size-small-mobile);
        --font-size-button: var(--font-size-button-mobile);
        --font-size-button-large: var(--font-size-button-large-mobile);
        --font-size-button-small: var(--font-size-button-small-mobile);
        --font-size-select: var(--font-size-select-mobile);
        --font-size-option: var(--font-size-option-mobile);
    }
    
    /* === GRIDS RESPONSIVOS === */
    .row-2col,
    .row-3col,
    .row-4col {
        grid-template-columns: 1fr;
    }
    
    /* === FLEX RESPONSIVO === */
    .row-flex,
    .row-search {
        flex-direction: column;
        align-items: stretch;
        gap: var(--gap-sm);
    }
    
    /* === RESETEAR FLEX EN MÓVIL === */
    .search-label,
    .search-input,
    .search-button,
    .search-button-secondary,
    .flex-1, .flex-2, .flex-3, .flex-4,
    .flex-1-min100, .flex-2-min150, .flex-3-min200 {
        flex: none;
        width: 100%;
        max-width: none;
        min-width: auto;
    }
    
    .search-spacer { display: none; }
    .flex-auto { width: 100%; }
    
    /* === BOTONES RESPONSIVOS === */
    .two-buttons-justified,
    .two-buttons-ends {
        flex-direction: column;
        gap: var(--gap-sm);
    }
    
    /* === POPUPS RESPONSIVOS === */
    .large-popup-info,
    .large-popup-success,
    .large-popup-error {
        width: 95vw;
        margin: 10px;
    }
}