/* ========================================================================
   ESTILOS KOUCH - BUSCADOR TOTAL (v5.2 - Layout de Tarjeta CORREGIDO)
   ======================================================================== */

/* --- Contenedores y Layout --- */
.kouch-search-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    box-sizing: border-box;
}

.kouch-search-bar {
    display: grid;
    grid-template-columns: 1fr 1.5fr 150px; 
    gap: 15px;
    padding: 24px;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 30px;
    align-items: flex-end;
}

.kouch-search-main-content {
    display: flex;
    gap: 30px;
}

.kouch-search-sidebar {
    flex: 0 0 300px;
}

.kouch-search-results {
    flex: 1;
    min-width: 0;
}

/* --- Formulario de Búsqueda (Barra Superior) --- */
.kouch-search-field {
    box-sizing: border-box;
}
.kouch-search-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
}
.kouch-search-field input[type="text"],
.kouch-search-field select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 15px;
    height: 47px;
}
.kouch-location-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}
.kouch-location-inputs select[disabled] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

/* --- Botones Principales (Buscar, Filtrar) --- */
button.kouch-search-button,
button.kouch-filter-button-apply {
    width: 100%;
    height: 47px;
    background-color: #FFFFFF;
    color: #5a61f6;
    border: 2px solid #5a61f6;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    line-height: 1;
}
button.kouch-search-button:hover,
button.kouch-filter-button-apply:hover {
    background-color: #5a61f6;
    color: #FFFFFF;
}

/* --- Sidebar de Filtros (Acordeón) --- */
.kouch-filter-accordion {
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    overflow: hidden;
}
.kouch-filter-accordion .kouch-accordion-item {
    border-bottom: 1px solid #f0f0f0;
}
.kouch-filter-accordion .kouch-accordion-item:last-child {
    border-bottom: none;
}
button.kouch-accordion-header {
    width: 100%;
    background: #FFFFFF;
    border: none;
    padding: 18px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}
button.kouch-accordion-header::after {
    content: '+';
    font-size: 20px;
    font-weight: 300;
    color: #888;
    transition: transform 0.2s ease, color 0.2s ease;
}
.kouch-accordion-item.active button.kouch-accordion-header,
button.kouch-accordion-header:hover {
    background-color: #5a61f6;
    color: #FFFFFF;
}
.kouch-accordion-item.active button.kouch-accordion-header::after,
button.kouch-accordion-header:hover::after {
    content: '−';
    color: #FFFFFF;
    transform: none;
}
.kouch-accordion-content {
    display: none;
    padding: 20px 20px 10px 20px;
    background: #fafafa;
}
.kouch-filter-label {
    display: block;
    margin-bottom: 10px;
    font-weight: 400;
    color: #374151;
    cursor: pointer;
    line-height: 1.4;
}
.kouch-filter-label input {
    margin-right: 8px;
    transform: scale(1.1);
}
.kouch-filter-buttons {
    display: grid;
    gap: 10px;
    padding-top: 20px;
}
a.kouch-filter-button-clear {
    width: 100%;
    height: 47px;
    background-color: #FFFFFF;
    color: #6c757d;
    border: 2px solid #6c757d;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    box-sizing: border-box;
    transition: background-color 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    line-height: 1;
}
a.kouch-filter-button-clear:hover {
    background-color: #6c757d;
    color: #FFFFFF;
}

/* --- Resultados (Tarjetas de Empleo) --- */
.kouch-job-list-header {
    font-size: 14px;
    color: #555;
    padding-bottom: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}
.kouch-job-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- INICIO: CORRECCIÓN DE LAYOUT DE TARJETA --- */
.kouch-job-card {
    display: flex;
    flex-direction: column; /* Apilamos las filas */
    padding: 24px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.kouch-job-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-color: #c7c9ff;
}

/* Fila Superior: Título y Fecha */
.kouch-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    width: 100%;
    margin-bottom: 8px; /* Espacio antes de la compañía */
}
.kouch-card-title { margin: 0; flex-grow: 1; }
.kouch-card-title a {
    text-decoration: none;
    color: #1f2937;
    font-size: 20px;
    font-weight: 600;
}
.kouch-card-title a:hover { color: #5557B0; }

/* Estilos "Publicado hace..." (Copiados de tu shortcode) */
.job-post-time-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    padding-top: 4px;
}
.job-post-new-badge {
    display: inline-block;
    background-color: #E0FBFB;
    color: #0d5f64;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid #7be1de;
    line-height: 1.4;
}
.job-post-time-ago {
    font-size: 12px;
    color: #575757;
    font-weight: 400;
    white-space: nowrap;
}

/* Contenido Principal (Compañía, Ubicación, Salario) */
.kouch-card-main {
    flex-grow: 1;
    width: 100%;
}
.kouch-card-company {
    font-weight: 500;
    color: #374151;
    margin-bottom: 10px;
}
.kouch-card-location {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 10px;
}
.kouch-card-salary {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 15px;
}

/* Fila Inferior: Meta (tags) y Botones de Acción */
.kouch-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Alinea los botones y tags abajo */
    width: 100%;
    margin-top: 15px; /* Espacio desde el salario */
}

.kouch-card-meta { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
    font-size: 13px; 
    align-items: center; /* Centra tags si hay varias líneas */
}
.kouch-card-meta span {
    background-color: #F6F6FF;
    color: #5557B0;
    padding: 4px 10px;
    border-radius: 15px;
    font-weight: 500;
}

.kouch-card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
/* --- FIN: CORRECCIÓN DE LAYOUT DE TARJETA --- */

.kouch-card-button-vermas {
    padding: 8px 16px;
    background-color: #f1f1f1;
    color: #333;
    text-decoration: none;
    border-radius: 5px;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.2s ease;
}
.kouch-card-button-vermas:hover { background-color: #e0e0e0; }
.kouch-save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 10px;
    background-color: #fff;
    width: 44px;
    height: 44px;
}
.kouch-save-btn:hover {
    background-color: #F6F6FF;
    border-color: #c7c9ff;
}
.kouch-save-btn svg {
    width: 24px;
    height: 24px;
    color: #5557B0;
}
.kouch-save-btn .icon-save-filled { color: #5557B0; }
.kouch-save-btn[disabled] { opacity: 0.7; cursor: not-allowed; }

/* --- Paginación --- */
.kouch-pagination { margin-top: 30px; text-align: center; }
.kouch-pagination .page-numbers {
    padding: 8px 12px;
    margin: 0 3px;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #5557B0;
    transition: background-color 0.2s ease;
}
.kouch-pagination .page-numbers.current {
    background-color: #5557B0;
    color: #fff;
    border-color: #5557B0;
}
.kouch-pagination .page-numbers:hover:not(.current) {
    background-color: #f6f6ff;
}
.kouch-no-results {
    padding: 30px;
    text-align: center;
    font-size: 18px;
    color: #777;
    background-color: #f9f9f9;
    border-radius: 8px;
}

/* --- Responsive (Móvil) --- */
@media (max-width: 900px) {
    .kouch-search-main-content {
        flex-direction: column;
    }
    .kouch-search-sidebar {
        flex: 1 1 auto;
    }
}
@media (max-width: 600px) {
    .kouch-search-bar {
        grid-template-columns: 1fr;
    }
    .kouch-location-inputs {
        grid-template-columns: 1fr;
    }
    .kouch-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        width: 100%;
    }
    .job-post-time-wrapper {
        margin-left: 0;
    }
    .kouch-card-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .kouch-card-actions {
        margin-left: 0;
    }
}

/* Estilos para el autocompletado */
.kouch-suggestions-list {
    position: absolute;
    top: 100%; /* Justo debajo del input */
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 999;
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 250px;
    overflow-y: auto;
}

.kouch-suggestions-list li {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
    transition: background 0.2s;
    margin: 0; /* Asegura que no haya margen extra */
}

.kouch-suggestions-list li:last-child {
    border-bottom: none;
}

.kouch-suggestions-list li:hover {
    background-color: #f5f8fa;
    color: #0073aa; /* Color de acento */
}
.kouch-input-icon {
    display: none; /* Por defecto ocultos para no romper el diseño PC */
}

/* ========================================================================
   DISEÑO FINAL: ICONOS ALINEADOS + ANTI-ZOOM + UBICACIÓN CORREGIDA
   ======================================================================== */

@media (max-width: 600px) {

    /* 1. LA PÍLDORA (CONTENEDOR GENERAL) */
    .kouch-search-bar {
        display: flex !important;
        align-items: center !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
        height: 56px !important;
        padding: 4px 4px 4px 5px !important; 
        background-color: #ffffff !important;
        border: 1px solid #e0e0e0 !important;
        border-radius: 100px !important; 
        box-shadow: 0 4px 15px rgba(0,0,0,0.08) !important;
        box-sizing: border-box !important;
        overflow: visible !important;
    }

    /* 2. CONFIGURACIÓN COMÚN DE LOS CAMPOS */
    .kouch-search-field {
        flex: 1 !important;
        min-width: 0 !important;
        margin: 0 !important;
        height: 100% !important;
        position: relative !important; /* CLAVE: Para que el icono flote sobre esto */
        display: flex !important;
        align-items: center !important; /* Centrado vertical forzoso */
    }
    
    .kouch-search-field label { display: none !important; }

    /* 3. POSICIÓN DE LOS ICONOS (GENERAL) */
    .kouch-input-icon {
        display: block !important;
        position: absolute !important;
        top: 50% !important;
        transform: translateY(-50%) !important; /* Matemáticamente al centro exacto */
        color: #9ca3af !important;
        font-size: 20px !important;
        z-index: 10 !important;
        pointer-events: none !important;
        line-height: 1 !important;
    }

    /* Icono Izquierdo (Maletín) */
    .kouch-search-field-title .kouch-input-icon {
        left: 15px !important;
    }

    /* 4. CORRECCIÓN ESPECÍFICA PARA EL CAMPO DE UBICACIÓN (EL QUE FALLABA) */
    .kouch-search-field-location {
        /* Forzamos que este div sea el punto de referencia */
        position: relative !important;
        display: flex !important;
        align-items: center !important;
        height: 100% !important;
        
        /* Línea divisoria gris a la izquierda */
        border-left: 1px solid #ddd !important;
        padding-left: 10px !important;
    }

    /* El icono de ubicación lo anclamos a la izquierda de SU contenedor */
    .kouch-search-field-location .kouch-input-icon {
        left: 15px !important; /* Separación desde la línea divisoria */
        top: 50% !important;
        transform: translateY(-50%) !important;
        display: block !important; /* Asegurar que no se oculte */
    }

    /* 5. INPUTS Y SELECTS (ANTI-ZOOM 16PX) */
    .kouch-search-field input,
    .kouch-search-field select {
        width: 100% !important;
        height: 100% !important;
        border: none !important;
        background-color: transparent !important;
        outline: none !important;
        box-shadow: none !important;
        font-size: 16px !important; /* Anti-zoom */
        color: #333;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 0 !important;
        margin: 0 !important;
        background-image: none !important;
        appearance: none; /* Limpieza nativa */
    }

    /* Padding específico para no tapar los iconos */
    .kouch-search-field-title input {
        padding-left: 45px !important; 
    }
    
    .kouch-search-field-location select {
        padding-left: 40px !important; /* Espacio para el icono de mundo */
    }

    /* 6. BOTÓN LUPA */
    button.kouch-search-button {
        width: 46px !important;
        height: 46px !important;
        flex: 0 0 46px !important;
        margin-left: auto !important;
        border-radius: 50% !important;
        background-color: #5a61f6 !important;
        border: none !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 0 !important;
        color: transparent !important;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
        box-shadow: 0 2px 8px rgba(90, 97, 246, 0.4);
    }
}