* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body {
    background-color: #fff7f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* =========================================
   NUEVOS ESTILOS DEL ENCABEZADO Y BUSCADOR
   ========================================= */

.busqueda-header {
    margin-bottom: 2rem;
    position: relative; /* Añadido para control de capas */
    z-index: 100;      /* Asegura que toda la cabecera esté por encima */
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.busqueda-header.visible {
    opacity: 1;
    transform: translateY(0);
}

.titulo-pagina {
    font-size: 2rem;
    font-weight: 700;
    color: #222;
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}

.titulo-pagina::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 60px;
    height: 4px;
    background-color: #ff6600;
    border-radius: 2px;
}

/* Contenedor principal de la barra horizontal */
.search-bar-container {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    background: #fff;
    padding: 1rem;
    border-radius: 100px; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    position: relative;
    z-index: 100; /* Mayor que los botones de abajo */
}

/* Wrapper del input de texto principal */
.search-input-wrap {
    flex: 2;
    position: relative;
    min-width: 250px;
}

.search-input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 3rem;
    border: 1px solid #e5e7eb;
    border-radius: 100px;
    background-color: #f9fafb;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

.search-input:focus {
    border-color: #ff6600;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 102, 0, 0.1);
}

.search-input-wrap .search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #ff6600;
    font-size: 1.1rem;
}

.clear-search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}
.clear-search-icon:hover { color: #ff6600; }

.location-dropdown {
    flex: 1;
    min-width: 160px;
    position: relative;
}

.custom-dropdown {
    position: relative;
    width: 100%;
}

.dropdown-selected {
    width: 100%;
    padding: 0.8rem 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 100px;
    background-color: #f9fafb;
    font-size: 1rem;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    white-space: nowrap;
}

.dropdown-selected:hover,
.dropdown-menu.show ~ .dropdown-selected {
    border-color: #ff6600;
    background-color: #fff;
}

/* MENÚ DESPLEGABLE - CORRECCIÓN DE Z-INDEX */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 200 !important; /* Capa más alta posible */
    display: none;
    overflow: hidden;
    border: 1px solid #eee;
}

.dropdown-menu.show { display: block; }

.dropdown-search { padding: 0.8rem; border-bottom: 1px solid #eee; position: relative; }
.dropdown-search input {
    width: 100%; padding: 0.6rem 0.6rem 0.6rem 2.2rem;
    border: 1px solid #eee; border-radius: 0.5rem; background: #f9f9f9; outline: none;
}
.dropdown-search i { position: absolute; left: 1.2rem; top: 50%; transform: translateY(-50%); color: #999; font-size: 0.8rem;}
.dropdown-list { max-height: 250px; overflow-y: auto; padding: 0.5rem; }
.dropdown-item { padding: 0.7rem 1rem; cursor: pointer; border-radius: 0.5rem; transition: all 0.2s; color: #333; }
.dropdown-item:hover { background-color: #fff7ed; color: #ff6600; }
.no-results { padding: 1rem; text-align: center; color: #999; }

.botones-accion {
    display: flex;
    gap: 10px;
}

.limpiar-btn {
    background-color: #fff;
    color: #555;
    border: 1px solid #d1d5db;
    border-radius: 100px;
    padding: 0.8rem 1.5rem;
    font-weight: 500;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 46px;
    white-space: nowrap;
}

.limpiar-btn:hover { background-color: #f9fafb; color: #333; border-color: #9ca3af;}

.buscar-btn {
    background-color: #ff6600;
    color: white;
    border: none;
    border-radius: 100px;
    padding: 0.8rem 2rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 46px;
}

.buscar-btn:hover { background-color: #e65500; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(255, 102, 0, 0.2); }

/* CONTROLES BARRA INFERIOR - BAJAMOS EL Z-INDEX */
.controls-bar-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
    position: relative;
    z-index: 10; /* Valor bajo para no competir con el buscador */
}

.results-count {
    font-size: 0.875rem;
    color: #6b7280;
}

.controls-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.vista-botones {
    display: flex;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    overflow: hidden;
}

.vista-boton {
    padding: 0.75rem 1rem;
    background: white;
    border: none;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.vista-boton.activo {
    background: #ff6600;
    color: white;
}

.ordenar-container {
    position: relative;
}

.ordenar-select {
    appearance: none;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
}

.ordenar-container::after {
    content: "▼";
    font-size: 0.75rem;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #6b7280;
}

/* =========================================
   ESTILOS DE LAS TARJETAS (Grid y List)
   ========================================= */

.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
}

.list-view {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.empresa-card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    position: relative;
    border: 1px solid rgba(255, 102, 0, 0.1);
    opacity: 0;
    transform: translateY(30px);
    z-index: 1; /* Valor base */
}

.empresa-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.empresa-card.hidden {
    display: none !important;
}

.grid-view .empresa-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem;
}

.list-view .empresa-card {
    display: flex;
    align-items: center;
    padding: 1rem 3rem 1rem 1rem;
}

/* Cabecera de la tarjeta */
.empresa-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    width: 100%;
}

.list-view .empresa-header {
    margin-bottom: 0;
    width: auto;
    margin-right: auto;
}

.empresa-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Logo Empresa */
.empresa-logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #f3f4f6;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    transition: transform 0.3s ease;
    position: relative;
}

.empresa-card:hover .empresa-logo {
    transform: scale(1.1);
}

.empresa-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 5px;
    background-color: white;
}

.empresa-logo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    background-color: #ff6600;
}

/* Nombre Empresa */
.empresa-nombre {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.empresa-nombre h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.verificado {
    color: #10b981;
    font-size: 1.125rem;
}

/* Botón Favorito */
.favorito-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: #d1d5db;
    transition: color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
}

.list-view .favorito-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
}

.favorito-btn:hover {
    color: #f59e0b;
    transform: scale(1.1);
    background-color: #fff8e6;
}

.favorito-btn.activo {
    color: #f59e0b;
}

.favorito-btn::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-radius: 50%;
    background-color: rgba(245, 158, 11, 0.2);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.favorito-btn:active::before {
    width: 150%;
    height: 150%;
}

/* Detalles (Ubicación y Año) */
.empresa-detalles {
    display: flex;
    margin: 1rem 0;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.list-view .empresa-detalles {
    margin: 0;
    flex-wrap: nowrap;
}

.ubicacion, .tamano {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    background-color: #f9fafb;
    border-radius: 0.5rem;
    transition: background-color 0.3s ease;
}

.list-view .ubicacion, .list-view .tamano {
    margin: 0;
    margin-right: 15px;
}

.empresa-card:hover .ubicacion,
.empresa-card:hover .tamano {
    background-color: #f0f7ff;
}

.ubicacion i, .tamano i {
    font-size: 1rem;
    color: #ff6600;
}

/* Descripción */
.empresa-descripcion {
    color: #4b5563;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.list-view .empresa-descripcion {
    display: none;
}

/* Categorías */
.empresa-categorias {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.list-view .empresa-categorias {
    margin: 0;
    margin-right: 15px;
}

.categoria {
    padding: 0.5rem 0.75rem;
    background: #ffe8e0;
    border-radius: 9999px;
    font-size: 0.75rem;
    color: #ff6600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.categoria:hover {
    background-color: #cce0ff;
    transform: translateY(-2px);
}

.categoria i {
    font-size: 0.75rem;
    color: #e65500;
}

/* Footer de la tarjeta */
.empresa-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.list-view .empresa-footer {
    margin: 0;
}

.vacantes {
    font-size: 0.875rem;
    font-weight: 500;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.list-view .vacantes {
    margin-right: 15px;
}

.vacantes i { color: #ff6600; }

.ver-mas {
    padding: 0.5rem 1.25rem;
    background-color: #ff6600;
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: inline-block;
}

.list-view .ver-mas {
    margin-right: 15px;
}

.ver-mas:hover {
    background-color: #e65500;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 102, 0, 0.25);
}

.ver-mas::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.ver-mas:active::after {
    animation: ripple 0.6s ease-out;
}

/* Sin Resultados */
.sin-resultados {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.sin-resultados.visible {
    opacity: 1;
    transform: translateY(0);
}

.sin-resultados i { font-size: 4rem; margin-bottom: 1.5rem; color: #d1d5db; }
.sin-resultados h3 { font-size: 1.5rem; font-weight: 600; margin-bottom: 1rem; color: #374151; }
.sin-resultados p { font-size: 1rem; max-width: 500px; margin: 0 auto; }

/* Highlight de texto */
.highlight {
    background-color: #ffff80;
    padding: 0 2px;
    border-radius: 2px;
}

/* RESPONSIVE */
@media (max-width: 992px) {
    .search-bar-container {
        border-radius: 20px;
        padding: 1.5rem;
    }
    .search-input-wrap { flex: 100%; }
    .location-dropdown { flex: 1; }
    .botones-accion { flex: 100%; justify-content: flex-end; }
}

@media (max-width: 768px) {
    .container { padding: 1.5rem; }

    /* Forzar grid en mobile */
    .vista-botones a:nth-child(2) { display: none; }
    .vista-botones a:first-child { width: 100%; border-right: none; }
    .list-view { display: grid; grid-template-columns: 1fr; gap: 2rem; }
    
    .list-view .empresa-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1.5rem; /* Reset padding list view */
    }
    
    /* Resetear estilos específicos de list view en mobile */
    .list-view .empresa-header, 
    .list-view .ubicacion, 
    .list-view .tamano, 
    .list-view .empresa-categorias, 
    .list-view .empresa-footer,
    .list-view .vacantes,
    .list-view .ver-mas {
        margin: 0;
        width: 100%;
    }
    
    .list-view .empresa-footer {
        display: flex;
        justify-content: space-between;
    }
    
    .list-view .empresa-info { width: 100%; }
    .list-view .empresa-detalles { flex-direction: column; gap: 0.75rem; width: 100%; }
    .list-view .favorito-btn { position: relative; right: auto; top: auto; transform: none; }
    
    /* Ajustes del Buscador en Mobile */
    .search-bar-container { flex-direction: column; gap: 0.8rem; }
    .search-input-wrap, .location-dropdown, .botones-accion { width: 100%; flex: none; }
    .botones-accion { flex-direction: row; }
    .limpiar-btn, .buscar-btn { flex: 1; justify-content: center; }
    
    /* Controles inferiores */
    .controls-bar-bottom { flex-direction: column; gap: 1rem; align-items: flex-start; }
    .controls-right { width: 100%; justify-content: space-between; }
}

@media (max-width: 768px) {
    .search-bar-container { border-radius: 20px; flex-direction: column; }
    .controls-bar-bottom { z-index: 5; }
    .dropdown-menu { z-index: 10000 !important; }
}