/* ==========================================================================
   1. RESET & BASE
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #374151;
    background-color: #f9fafb;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.home-layout {
    min-height: 100vh;
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
    background-color: #1a1a1a;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* ==========================================================================
   2. IMAGEN DE FONDO & CAPAS HOME
   ========================================================================== */
.hero-bg-static {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 1;
    display: block;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.45);
    z-index: 2;
    pointer-events: none;
}

/* ==========================================================================
   3. NAVBAR INDEX & GENERAL
   ========================================================================== */
.navbar-transparent {
    position: relative;
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    z-index: 30;
}

.navbar-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1.5rem;
    gap: 1rem;
}

.navbar-left-group {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-width: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    flex-shrink: 0;
    color: #374151;
}

.logo-img {
    height: 40px;
    width: auto;
    display: block;
}

.logo-text {
    font-size: 1.45rem;
    font-weight: 500;
    color: #374151;
    letter-spacing: 0.4px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    text-shadow: none;
}

.logo-text sup {
    font-size: 0.72rem;
    margin-left: 3px;
    font-weight: 400;
    opacity: 0.9;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.desktop-nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    color: #374151 !important;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: opacity 0.2s ease;
    text-shadow: none;
    white-space: nowrap;
}

.nav-link:hover {
    opacity: 0.8;
}

.nav-link-anuncia {
    color: #374151 !important;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.9rem;
}

.nav-btn-anuncia {
    background-color: #00667e;
    color: #ffffff !important;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.65rem 1.35rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: background-color 0.2s ease, transform 0.2s ease;
    text-shadow: none !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-btn-anuncia:hover {
    background-color: #004d5f;
    transform: translateY(-1px);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.35rem;
    flex-shrink: 0;
}

.hamburger,
.hamburger::before,
.hamburger::after {
    content: '';
    display: block;
    background: #374151;
    height: 2px;
    width: 22px;
    transition: all 0.3s ease;
}

.hamburger::before {
    transform: translateY(-6px);
}

.hamburger::after {
    transform: translateY(6px);
}

.nav-menu {
    display: none;
}

.mobile-only {
    display: none;
}

.desktop-only {
    display: inline-block;
}

/* ==========================================================================
   4. NAVBAR INTERNO & MODAL BUSCADOR
   ========================================================================== */
.navbar-internal {
    background-color: #ffffff !important;
    width: 100% !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 1020 !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

.navbar-internal .navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    gap: 1rem;
}

.navbar-internal .logo-img {
    height: 38px;
    width: auto;
}

.navbar-internal .desktop-nav-links .nav-link {
    color: #374151 !important;
    text-shadow: none;
}

.navbar-internal .desktop-nav-links .nav-link:hover {
    color: #00667e !important;
}

.navbar-internal-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.search-trigger-btn {
    background: none;
    border: none;
    color: #374151;
    cursor: pointer;
    padding: 0.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.search-trigger-btn:hover {
    opacity: 0.8;
}

.mobile-navbar-search-trigger {
    display: none;
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    align-items: center;
    gap: 0.45rem;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.mobile-navbar-search-trigger:active {
    background-color: #f8fafc;
    border-color: #94a3b8;
}

.mobile-navbar-search-trigger .search-trigger-icon,
.mobile-navbar-search-trigger svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.search-placeholder-text {
    color: #64748b;
    font-size: 0.84rem;
    font-weight: 500;
    pointer-events: none;
    white-space: nowrap;
    letter-spacing: -0.15px;
}

.internal-search-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(26, 26, 26, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 28vh;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.internal-search-modal.active {
    opacity: 1;
    visibility: visible;
}

.internal-search-box {
    width: 90%;
    max-width: 640px;
    transform: translateY(-12px);
    transition: transform 0.25s ease;
}

.internal-search-modal.active .internal-search-box {
    transform: translateY(0);
}

.internal-search-form .search-input-wrapper {
    position: relative;
    width: 100%;
}

.internal-search-form input {
    width: 100%;
    padding: 1rem 3.5rem 1rem 1.35rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.85);
    background-color: #ffffff;
    color: #1e293b;
    font-size: 1.05rem;
    outline: none;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45);
}

.internal-search-form .search-button {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #475569;
    display: flex;
    align-items: center;
}

/* ==========================================================================
   5. BUSCADOR & BARRA SEGMENTADA (JERARQUÍA Y PESO VISUAL EQUILIBRADOS)
   ========================================================================== */
.hero-floating-search-container {
    position: relative;
    z-index: 20;
    width: 92%;
    max-width: 780px;
    margin: auto auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.75rem;
    transform: translateY(4vh);
}

.hero-floating-search-form {
    width: 100%;
    max-width: 780px;
}

.hero-floating-search-form .search-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.search-trigger-wrapper {
    cursor: pointer;
}

.hero-floating-search-form input {
    width: 100%;
    padding: 1.2rem 3.8rem 1.2rem 1.75rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.95);
    background: #ffffff;
    color: #1e293b;
    font-size: 1.2rem;
    outline: none;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

.hero-floating-search-form .search-button {
    position: absolute;
    right: 18px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    pointer-events: none;
}

.hero-floating-search-form .search-icon {
    width: 26px;
    height: 26px;
}

.hero-categories-bar {
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: 600px;
    background: rgba(22, 22, 22, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.hero-cat-tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    padding: 0.55rem 0.35rem 0.75rem;
    color: #ffffff !important;
    text-decoration: none;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

.hero-cat-tab:last-child {
    border-right: none;
}

.hero-cat-tab:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

.hero-cat-tab:active {
    transform: scale(0.97);
}

.hero-cat-icon {
    font-size: 0.95rem;
    line-height: 1;
    opacity: 0.95;
}

.hero-cat-name {
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: -0.1px;
    color: #ffffff !important;
    text-align: center;
    white-space: nowrap;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   6. CONTENEDORES INTERNOS & RESULTADOS DE BÚSQUEDA
   ========================================================================== */
.internal-page-container,
.results-container {
    flex: 1 0 auto;
    max-width: 1100px;
    margin: 0 auto;
    padding: 90px 1.5rem 2rem;
    width: 100%;
    background-color: #f9fafb;
}

.results-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.75rem;
    color: #1e293b;
}

.results-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.card-horizontal {
    display: grid;
    grid-template-columns: 220px 1fr;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card-horizontal:hover {
    border-color: #00667e;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.card-img-link {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 150px;
    max-height: 170px;
    overflow: hidden;
    background-color: #f1f5f9;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.card-img-link:hover .card-img {
    transform: scale(1.05);
}

.card-body {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.card-badge {
    background-color: #00667e;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    text-transform: uppercase;
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
}

.card-desc {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 0 0.75rem 0;
}

.card-location {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.4;
}

.location-pin-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
    margin-top: 1px;
}

.map-title {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.75rem;
}

.map-pin-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

.no-results {
    color: #64748b;
    text-align: center;
    padding: 3rem 0;
}

/* ==========================================================================
   7. FOOTER
   ========================================================================== */
.footer {
    background-color: #ffffff;
    width: 100%;
    padding: 1rem 1.5rem calc(1rem + env(safe-area-inset-bottom));
    margin-top: auto;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
}

body.home-layout .footer {
    position: relative;
    width: 100%;
    z-index: 30;
    background-color: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 0.85rem 1.25rem calc(0.85rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.08);
}

.bottom-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.bottom-nav-link {
    color: #374151;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.bottom-nav-link:hover {
    color: #00667e;
    transform: translateY(-1px);
}

.bottom-nav-link-anuncia {
    color: #374151;
    font-weight: 600;
}

.bottom-nav-separator {
    color: #cbd5e1;
    font-weight: 300;
}

.footer-divider {
    width: 100%;
    max-width: 280px;
    height: 1px;
    background-color: #e2e8f0;
    margin: 0.15rem auto;
}

.footer-text {
    color: #64748b;
    font-size: 0.85rem;
    line-height: 1.4;
    display: block !important;
    text-align: center;
    max-width: 100%;
    padding: 0 1rem;
    border-top: none;
    padding-top: 0;
}

.footer-phrase {
    display: inline-block;
    white-space: nowrap;
}

/* ==========================================================================
   8. MEDIA QUERIES & RESPONSIVE BREAKPOINTS (AJUSTE PARA EVITAR COLISIÓN)
   ========================================================================== */
@media (max-width: 1100px) {
    .desktop-nav-links {
        gap: 0.65rem !important;
    }

    .desktop-nav-links .nav-link {
        font-size: 0.8rem !important;
    }
}

@media (max-width: 950px) {
    .desktop-nav-links {
        display: none !important;
    }

    .desktop-only {
        display: none !important;
    }

    .menu-toggle {
        display: block !important;
    }

    .navbar-container {
        width: 100% !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0.65rem 1rem !important;
        gap: 0 !important;
    }

    .navbar-left-group {
        display: flex !important;
        align-items: center !important;
        gap: 0 !important;
        flex: 0 1 auto !important;
    }

    .logo-text {
        font-size: 1.32rem;
        font-weight: 500;
        letter-spacing: 0.3px;
    }

    .navbar-right {
        display: flex !important;
        align-items: center !important;
        gap: 0 !important;
        flex: 0 0 auto !important;
    }

    .navbar-internal .navbar-container {
        display: grid !important;
        grid-template-columns: auto 1fr auto !important;
        align-items: center !important;
        gap: 0.5rem !important;
        padding: 0.5rem 0.55rem !important;
        width: 100% !important;
    }

    .navbar-internal .navbar-left-group {
        display: contents !important;
    }

    .navbar-internal .logo {
        display: flex !important;
        align-items: center !important;
        flex-shrink: 0 !important;
    }

    .navbar-internal .logo-img {
        height: 38px !important;
        width: auto !important;
    }

    .navbar-internal .navbar-right {
        display: flex !important;
        align-items: center !important;
        flex-shrink: 0 !important;
        gap: 0 !important;
    }

    .mobile-navbar-search-trigger {
        display: flex !important;
        align-items: center !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        right: 0;
        width: 180px;
        background-color: #ffffff;
        padding: 0.85rem 1rem;
        border-bottom: 1px solid #e2e8f0;
        border-left: 1px solid #e2e8f0;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        z-index: 1000;
    }

    .nav-menu.active {
        display: flex !important;
        flex-direction: column;
        gap: 0.75rem;
    }

    .hero-floating-search-container {
        width: 90%;
        max-width: 440px;
        gap: 1.25rem;
        transform: translateY(5vh);
    }

    .hero-floating-search-form {
        max-width: 100%;
    }

    .hero-floating-search-form input {
        padding: 0.85rem 2.8rem 0.85rem 1.25rem;
        font-size: 0.98rem;
    }

    .hero-categories-bar {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.55rem;
        background: transparent !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        max-width: 340px;
        overflow: visible;
    }

    .hero-cat-tab {
        flex: 0 0 calc(33.333% - 0.55rem);
        width: calc(33.333% - 0.55rem);
        min-height: 76px;
        background: rgba(22, 22, 22, 0.5);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid rgba(255, 255, 255, 0.12) !important;
        border-radius: 12px;
        padding: 0.75rem 0.2rem;
        gap: 0.3rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
        transition: transform 0.1s ease, background-color 0.1s ease;
    }

    .hero-cat-tab:nth-child(4),
    .hero-cat-tab:nth-child(5) {
        flex: 0 0 calc(33.333% - 0.55rem);
        width: calc(33.333% - 0.55rem);
    }

    .hero-cat-tab:active {
        transform: scale(0.94);
        background: rgba(15, 15, 15, 0.85);
    }

    .hero-cat-icon {
        font-size: 1.3rem;
    }

    .hero-cat-name {
        font-size: 0.70rem;
        letter-spacing: -0.2px;
        white-space: nowrap;
    }

    .internal-search-modal {
        padding-top: 25vh;
    }

    .card-horizontal {
        grid-template-columns: 1fr;
        border-radius: 8px;
    }

    .card-img-link {
        height: 200px;
        max-height: none;
    }

    body.home-layout .footer {
        padding: 0.65rem 1rem calc(0.65rem + env(safe-area-inset-bottom, 0px)) !important;
        gap: 0.5rem !important;
    }

    body.home-layout .bottom-nav {
        gap: 1rem !important;
        width: 100%;
        justify-content: space-around;
    }

    body.home-layout .bottom-nav-link {
        font-size: 0.92rem !important;
        font-weight: 600 !important;
    }

    .footer-divider {
        max-width: 100%;
        margin: 0.1rem 0;
    }

    body.home-layout .footer-text {
        font-size: 0.7rem !important;
        line-height: 1.3 !important;
        padding: 0 0.5rem;
    }

    .mobile-only {
        display: block !important;
    }

    .map-bottom-card {
        bottom: calc(4.5rem + env(safe-area-inset-bottom)) !important;
    }
}