/* =========================================
   1. VARIABLES Y RESET GENERAL
   ========================================= */
:root {
    --primary: var(--theme-primary, #16A34A);
    --primary-hover: var(--theme-primary-dark, #15803D);
    --dark-bg: var(--theme-text-dark, #0f172a);
    --secondary: var(--theme-text-dark, #0f172a);
    --text-body: #546E7A;
    --bg-light: var(--theme-bg-soft, #F0FDF4);
    --white: #ffffff;
    --border: #ECEFF1;
    --radius: 12px;
    /* Redondeo de tarjetas */
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-body);
    /* El padding-top lo quitamos porque la Top Bar es parte del flujo */
    padding-top: 0;
}

h1,
h2,
h3,
h4 {
    font-family: 'Quicksand', sans-serif;
    /* Opcional, o usar Nunito */
    font-weight: 700;
    margin-top: 0;
}

/* Contenedor ancho estándar */
.container-wide {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =========================================
   2. TOP BAR (Barra Negra Superior)
   ========================================= */
.top-bar {
    background-color: var(--primary);
    color: var(--white);
    padding: 8px 0;
    font-size: 0.85rem;
    font-weight: 600;
    position: relative;
    z-index: 1002;
}

.top-bar .container-wide {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar a {
    color: var(--white);
    text-decoration: none;
    transition: opacity 0.2s;
}

.top-bar a:hover {
    opacity: 0.8;
}

/* =========================================
   3. HEADER Y NAVEGACIÓN (Arreglado)
   ========================================= */
#main-header {
    background-color: var(--white);
    height: 80px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    /* Se queda pegado al bajar */
    top: 0;
    z-index: 1001;
    width: 100%;
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    /* Separa Logo (izq) y Menú (der) */
    align-items: center;
    height: 100%;
}

/* Logo */
.logo {
    font-size: 1.8rem;
    font-weight: 900;
    text-decoration: none;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: -1px;
}

.logo span {
    color: var(--primary);
}

/* Enlaces Desktop */
.nav-links {
    display: flex;
    gap: 25px;
    align-items: center;
}

.nav-item {
    text-decoration: none;
    color: var(--secondary);
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    transition: color 0.3s;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary);
}

/* Botón Amarillo de Ayuda */
.btn-help-menu {
    background-color: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 30px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.btn-help-menu:hover {
    transform: translateY(-2px);
}

/* Botones y elementos móviles (Ocultos en PC) */
.hamburger,
.close-menu-btn {
    display: none;
}

/* =========================================
   4. HERO SECTION (Imagen Principal)
   ========================================= */
.tour-hero {
    position: relative;
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    /* Imagen de fondo */
    background-image: url('https://img.modernos.cloud/2133/2133.pages_covers.68803f8b193ed.jpg');
    background-size: cover;
    background-position: center;
    margin-bottom: 30px;
}

/* Capa oscura (Overlay) para que se lea el texto */
.tour-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.tour-hero h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.6);
}

.tour-hero .highlight {
    color: var(--primary);
}

/* =========================================
   5. LAYOUT PRINCIPAL (Sidebar + Grid)
   ========================================= */
.main-layout {
    display: flex;
    /* Flexbox para poner Sidebar al lado del Grid */
    gap: 30px;
    padding-bottom: 60px;
    position: relative;
}

/* --- SIDEBAR (Filtros) --- */
.filters-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    height: fit-content;

    /* Sticky: Se pega al bajar en PC */
    position: sticky;
    top: 100px;
    transition: transform 0.3s ease;
}

.sidebar-header-mobile,
.btn-apply-mobile {
    display: none;
    /* Solo para móvil */
}

.filter-box {
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
}

.filter-box:last-child {
    border-bottom: none;
}

.filter-box h4 {
    margin: 0 0 15px 0;
    color: var(--secondary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Inputs de Filtros */
.search-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #CFD8DC;
    border-radius: 8px;
    font-family: inherit;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
}

.filter-header-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-reset {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
}

input[type=range] {
    width: 100%;
    margin: 15px 0;
    accent-color: var(--primary);
}

.price-display {
    font-weight: 800;
    color: var(--primary);
    font-size: 1.2rem;
}

/* Checkboxes */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--secondary);
}

.custom-checkbox input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #CFD8DC;
    border-radius: 6px;
    margin-right: 12px;
    position: relative;
    transition: all 0.2s;
}

.custom-checkbox input:checked+.checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.custom-checkbox input:checked+.checkmark::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    /* Asegúrate de la versión correcta de FA */
    font-weight: 900;
    color: white;
    font-size: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* --- GRID DE TOURS --- */
.tours-container {
    flex-grow: 1;
}

.results-count {
    margin-bottom: 20px;
    color: var(--text-body);
    font-size: 0.9rem;
}

.tour-grid {
    display: grid;
    /* Responsive automático: Mínimo 300px por tarjeta */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
}

/* --- TARJETA DE TOUR --- */
.tour-card {
    background: var(--white);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.tour-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.14);
}

.card-image {
    position: relative;
    height: 210px;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.tour-card:hover .card-image img {
    transform: scale(1.05);
}

.card-thumbs {
    position: absolute;
    right: 14px;
    bottom: 14px;
    display: flex;
    gap: 6px;
    z-index: 12;
}

.card-thumbs img {
    width: 44px;
    height: 34px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.22);
    background: rgba(255, 255, 255, 0.15);
}

/* Badges / Etiquetas */
.badge {
    position: absolute;
    top: 14px;
    left: 14px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 900;
    color: white;
    z-index: 10;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
    letter-spacing: 0.5px;
}

/* Colores de badges por defecto */
.badge {
    background: var(--primary);
}

.badge.nocturno {
    background: #0f172a;
}

.badge.clasico {
    background: var(--theme-accent);
    color: #111827;
}

.badge.aventura {
    background: var(--primary-hover);
}

.badge.imperdible {
    background: #ef4444;
}

.card-content {
    padding: 20px 20px 18px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #90A4AE;
    margin-bottom: 12px;
}

.card-meta .duration {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    font-weight: 800;
    color: #64748b;
}

.card-meta .rating {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    font-weight: 900;
    color: var(--theme-accent);
}

.tour-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.25rem;
    color: var(--secondary);
    line-height: 1.3;
}

.tour-card p {
    font-size: 0.95rem;
    color: var(--text-body);
    line-height: 1.5;
    margin: 0 0 20px 0;
    flex-grow: 1;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 15px;
    margin-top: auto;
}

.card-footer .price {
    display: flex;
    flex-direction: column;
}

.card-footer .price small {
    font-size: 0.75rem;
    color: #90A4AE;
}

.card-footer .price span {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--secondary);
}

.btn-reservar {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    font-weight: 900;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-reservar:hover {
    background-color: var(--primary-hover);
}

/* Sin resultados */
.no-results {
    text-align: center;
    padding: 50px 20px;
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    grid-column: 1 / -1;
}

/* =========================================
   6. RESPONSIVE Y MÓVIL
   ========================================= */

/* Botón flotante de filtro (solo móvil) */
.btn-mobile-filter {
    display: none;
}

/* Fondo oscuro al abrir menú */
.overlay-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

@media (max-width: 991px) {

    /* Layout Vertical */
    .main-layout {
        flex-direction: column;
    }

    /* Hero más pequeño */
    .tour-hero {
        height: 250px;
    }

    .tour-hero h1 {
        font-size: 2.2rem;
    }

    /* Hamburguesa Visible */
    .hamburger {
        display: block;
        font-size: 1.6rem;
        cursor: pointer;
        color: var(--secondary);
    }

    /* Menú de Navegación Off-Canvas */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        /* Oculto a la derecha */
        height: 100vh;
        width: 75%;
        background: var(--white);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
        z-index: 1005;
        gap: 30px;
    }

    .nav-links.active {
        right: 0;
    }

    .nav-links .nav-item {
        font-size: 1.2rem;
    }

    .close-menu-btn {
        position: absolute;
        top: 25px;
        right: 25px;
        font-size: 2rem;
        display: block;
        cursor: pointer;
        color: var(--secondary);
    }

    /* Botón Flotante Filtros */
    .btn-mobile-filter {
        display: flex;
        align-items: center;
        gap: 10px;
        position: fixed;
        bottom: 30px;
        left: 50%;
        transform: translateX(-50%);
        background: var(--secondary);
        color: white;
        border: none;
        padding: 12px 25px;
        border-radius: 30px;
        font-weight: bold;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
        z-index: 990;
        cursor: pointer;
    }

    /* Sidebar Off-Canvas (sale de la izquierda) */
    .filters-sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        z-index: 1000;
        overflow-y: auto;
        border-radius: 0;
        transition: left 0.3s ease;
    }

    .filters-sidebar.active {
        left: 0;
    }

    .sidebar-header-mobile {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        border-bottom: 1px solid var(--border);
        padding-bottom: 15px;
    }

    .sidebar-header-mobile h3 {
        margin: 0;
    }

    #closeFiltersBtn {
        background: none;
        border: none;
        font-size: 1.5rem;
        color: var(--secondary);
        cursor: pointer;
    }

    .btn-apply-mobile {
        display: block;
        width: 100%;
        background: var(--primary);
        color: white;
        padding: 15px;
        border: none;
        border-radius: 8px;
        font-weight: bold;
        font-size: 1.1rem;
        margin-top: 20px;
        cursor: pointer;
    }

    .overlay-backdrop.active {
        display: block;
    }
}

@media (max-width: 640px) {
    .container-wide {
        padding: 0 14px;
    }

    .results-count {
        margin-bottom: 14px;
        font-size: 0.95rem;
    }

    .tour-hero {
        height: 220px;
        margin-bottom: 18px;
    }

    .tour-hero h1 {
        font-size: 1.8rem;
    }

    .tour-hero p {
        font-size: 1rem;
        padding: 0 10px;
    }

    .tour-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card-image {
        height: 190px;
    }

    .card-content {
        padding: 16px 16px 14px;
    }

    .card-meta {
        flex-wrap: wrap;
        gap: 10px;
    }

    .card-meta .duration,
    .card-meta .rating {
        font-size: 0.9rem;
    }

    .card-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .card-footer .price {
        flex-direction: row;
        justify-content: space-between;
        align-items: baseline;
    }

    .card-footer .price span {
        font-size: 1.25rem;
    }

    .card-footer>div:last-child {
        text-align: left !important;
    }

    .btn-reservar {
        width: 100%;
        padding: 12px 16px;
        border-radius: 14px;
    }

    .btn-details {
        width: 100%;
    }

    .card-thumbs {
        right: 12px;
        bottom: 12px;
    }

    .card-thumbs img {
        width: 40px;
        height: 32px;
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    .tour-grid {
        grid-template-columns: 1fr;
        /* Una columna en pantallas muy chicas */
    }
}