/* =========================================
VARIABLES & CONFIGURACIÓN GLOBAL
========================================= */
:root {
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --accent-color: #FFE66D;
    --dark-color: #2C3E50;
    --light-color: #ECF0F1;
    --text-dark: #2C3E50;
    --text-light: #7F8C8D;
    --white: #FFFFFF;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
}

/* =========================================
   HEADER
   ========================================= */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    cursor: pointer;
}

.logo-icon {
    font-size: 2rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.nav-links a:hover {
    background: var(--light-color);
    color: var(--primary-color);
}

/* =========================================
   CONTENEDOR PRINCIPAL
   ========================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* =========================================
   HERO SECTION
   ========================================= */
.hero {
    text-align: center;
    color: var(--white);
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.hero p {
    font-size: 1.3rem;
    opacity: 0.95;
    margin-bottom: 2rem;
}

/* =========================================
   CATEGORÍAS (Grid)
   ========================================= */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    animation: fadeInUp 0.8s ease-out;
}

.category-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    border: 2px solid transparent; /* Preparado para el hover */
}

/* Efecto de barra superior con el color de la categoría */
.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    /* Usamos la variable CSS que tu JS inyecta, o un fallback */
    background: var(--category-color, var(--primary-color));
    transform: scaleX(0);
    transition: var(--transition);
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
}

.category-card:hover::before {
    transform: scaleX(1);
}

.category-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    display: inline-block;
    transition: var(--transition);
}

.category-card:hover .category-icon {
    transform: scale(1.1) rotate(5deg);
}

.category-card h3 { /* Adaptado a tu JS */
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.category-card p { /* Adaptado a tu JS */
    color: var(--text-light);
    font-size: 0.95rem;
}

/* =========================================
   VISTA DE BÚSQUEDA
   ========================================= */
.search-view {
    display: none; /* Se controla por JS */
    animation: fadeIn 0.5s ease-out;
}

.search-header {
    background: var(--white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.search-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 1rem 1.5rem;
    border: 2px solid var(--light-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}

/* Botones */
.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #ff5252;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--light-color);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background: #d5dbdb;
}

/* =========================================
   RESULTADOS
   ========================================= */
.results-container {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    margin-top: 2rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-count {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-dark);
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--light-color);
    background: var(--white);
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover, .filter-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* Mapa */
#map {
    width: 100%;
    height: 400px;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

/* Grid de Lugares */
.places-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* =========================================
   TARJETAS DE LUGARES (Generadas por JS)
   ========================================= */
.place-card {
    background: var(--white);
    border: 1px solid var(--light-color);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    position: relative; /* Para posicionar el badge de patrocinado */
    display: flex;
    flex-direction: column;
}

.place-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

/* Imagen del lugar */
.place-image {
    width: 100%;
    height: 200px;
    background-size: cover;
    background-position: center;
    background-color: var(--light-color); /* Fallback */
}

/* Contenido de la tarjeta */
.place-info {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.place-info h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.place-address {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Metadatos (Rating, Precio, Estado) */
.place-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.status-open {
    color: #27ae60;
    font-weight: 600;
    background: #e8f8f5;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

.status-closed {
    color: #c0392b;
    font-weight: 600;
    background: #fdedec;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

.place-reviews {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

/* Botón de "Ver en Google Maps" */
.btn-view-map {
    margin-top: auto; /* Empuja el botón al fondo */
    display: block;
    text-align: center;
    background: var(--light-color);
    color: var(--text-dark);
    padding: 0.8rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.btn-view-map:hover {
    background: var(--dark-color);
    color: var(--white);
}

/* Badge de Patrocinado */
.sponsored-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--accent-color);
    color: var(--text-dark);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: var(--shadow);
    z-index: 10;
}

/* Tarjeta Patrocinada (Estilo extra) */
.place-card.sponsored {
    border: 2px solid var(--accent-color);
}

/* =========================================
   PUBLICIDAD (Ad Card)
   ========================================= */
.ad-card {
    grid-column: 1 / -1; /* Ocupa todo el ancho del grid */
    background: linear-gradient(135deg, #FFE66D 0%, #FF6B6B 100%);
    padding: 2rem;
    border-radius: var(--radius);
    margin: 1rem 0;
    text-align: center;
    color: var(--text-dark);
    box-shadow: var(--shadow-lg);
}

.ad-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.ad-text {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* =========================================
   LOADING SPINNER
   ========================================= */
.loading {
    text-align: center;
    padding: 3rem;
    color: var(--white);
    font-size: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--white);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

/* Mensaje de "No resultados" */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
    font-size: 1.2rem;
}

/* =========================================
   ANIMACIONES
   ========================================= */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =========================================
   RESPONSIVE DESIGN
   ========================================= */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }

    .hero p {
        font-size: 1.1rem;
    }

    .categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }

    .search-controls {
        flex-direction: column;
    }

    .nav-links {
        display: none; /* Opcional: Menú hamburguesa podría ir aquí */
    }

    .container {
        padding: 2rem 1rem;
    }
}