/* =========================================
   1. VARIABLES Y CONFIGURACIÓN GENERAL
   ========================================= */
:root {
    --primary-color: #7c4dff;
    --primary-dark: #6536ec;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --text-dark: #18181b;
    --text-muted: #71717a;
    --border-color: #e4e4e7;
    --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --max-width: 1200px;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-white);
    color: var(--text-dark);
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

/* =========================================
   2. BARRA SUPERIOR (HEADER REFINADO)
   ========================================= */
.topbar {
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

/* Logo con Marca y País */
.brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-icon {
    background-color: #8b5cf6; /* Violeta vibrante */
    color: white;
    font-weight: 800;
    padding: 0.5rem 0.65rem;
    border-radius: 12px;
    font-size: 1rem;
    line-height: 1;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-weight: 800;
    font-size: 1.15rem;
    color: #0f172a;
    line-height: 1.1;
}

.brand-sub {
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 500;
}

/* Buscador Unificado con Cápsula */
.search-box {
    flex: 1;
    max-width: 580px;
    display: flex;
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.25rem 0.35rem 0.25rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box:focus-within {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.search-icon {
    display: flex;
    align-items: center;
    color: #64748b;
    margin-right: 0.6rem;
}

.search-input {
    border: none;
    outline: none;
    width: 100%;
    font-size: 0.95rem;
    color: #1e293b;
    background: transparent;
}

.search-input::placeholder {
    color: #64748b;
}

/* Botón de Ubicación interior */
.location-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background-color: #f1f5f9;
    border: none;
    padding: 0.45rem 0.85rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease;
}

.location-btn:hover {
    background-color: #e2e8f0;
}

/* Acciones Derecha */
.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.favorite-icon {
    display: flex;
    align-items: center;
    color: #334155;
    transition: color 0.2s ease;
}

.favorite-icon:hover {
    color: #8b5cf6;
}

.login {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e293b;
}

.login:hover {
    color: #8b5cf6;
}

.publish-small {
    background-color: #8b5cf6;
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background 0.2s ease, transform 0.1s ease;
}

.publish-small:hover {
    background-color: #7c3aed;
}

/* Ajuste Mobile */
@media (max-width: 768px) {
    .topbar-inner {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
    }
    
    .search-box {
        order: 3;
        max-width: 100%;
        width: 100%;
        margin-top: 0.5rem;
    }
}

/* =========================================
   3. HERO SECTION
   ========================================= */
.hero {
    background: linear-gradient(180deg, #f3f0ff 0%, #f8f9fa 100%);
    text-align: center;
    padding: 5rem 1.5rem 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero h1 {
    font-size: 3.2rem;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.15;
    color: var(--text-dark);
    margin-bottom: 1.25rem;
}

.hero h1 span {
    color: var(--primary-color);
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2.5rem;
}

.btn {
    padding: 0.8rem 1.8rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 14px rgba(124, 77, 255, 0.3);
}

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

.btn-secondary {
    background-color: white;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #f4f4f5;
}

.free-line {
    font-size: 0.95rem;
    color: var(--text-muted);
    border-top: 1px solid #e4e4e7;
    padding-top: 1.5rem;
    width: 100%;
    max-width: 400px;
}

.free-line strong {
    color: var(--text-dark);
}

/* =========================================
   CARRUSEL DE CATEGORÍAS
   ========================================= */

.categories-carousel-wrapper {
    width: 100%;
    padding: 2.5rem 0;
    overflow: hidden;
}

.categories-carousel {
    width: 100%;
    overflow: hidden;
    position: relative;
    padding: 10px 0;
    
    /* Máscara de transparencia lateral (Fade) */
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0%,
        black 12%,
        black 88%,
        transparent 100%
    );
    mask-image: linear-gradient(
        to right,
        transparent 0%,
        black 12%,
        black 88%,
        transparent 100%
    );
}

.carousel-track {
    display: flex !important; /* Fuerza la disposición horizontal */
    flex-direction: row !important;
    gap: 1.25rem;
    width: max-content;
    will-change: transform;
    animation: carruselInfinito 28s linear infinite;
}

/* Pausa la animación al pasar el cursor */
.categories-carousel:hover .carousel-track {
    animation-play-state: paused;
}

/* Estilo de las tarjetas individuales */
.category-card {
    flex: 0 0 160px !important; /* Fuerza ancho fijo por tarjeta */
    width: 160px;
    padding: 1.25rem 1rem;
    background-color: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    text-decoration: none !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.category-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
    box-shadow: 0 8px 20px rgba(124, 77, 255, 0.15);
}

.category-icon {
    font-size: 2.2rem;
    line-height: 1;
}

.category-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
    white-space: nowrap;
}

/* Animación continua sin cortes */
@keyframes carruselInfinito {
    0% {
        transform: translateX(0);
    }
    100% {
        /* Desplaza exactamente la mitad (el bloque de ítems duplicados) */
        transform: translateX(calc(-50% - 0.625rem));
    }
}

/* =========================================
   4. SECCIONES Y CATEGORÍAS
   ========================================= */
.section-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-heading-container{
    display: flex;
    flex-direction: row;
}

.section-heading h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.section-heading a {
    color: var(--primary-color);
    font-weight: 600;
}

/* Banner de Publicación CTA */
.publish-box {
    background: #522BA6;
    background: linear-gradient(121deg, rgba(82, 43, 166, 1) 12%, rgba(124, 77, 255, 1) 55%, rgba(82, 43, 166, 1) 86%);
    color: white;
    padding: 3rem 2rem;
    border-radius: 16px;
    text-align: center;
}

.publish-box h2 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.publish-box p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 1.5rem;
}

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

.btn-white:hover {
    background-color: #f4f4f5;
}

/* =========================================
   5. FOOTER
   ========================================= */
.footer {
    background-color: #f4f4f5;
    border-top: 1px solid var(--border-color);
    padding-top: 3.5rem;
    margin-top: 2rem;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem 3rem;
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: 2rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.footer-brand a {
    color: var(--primary-color);
}

.socials {
    display: flex;
    gap: 0.75rem;
}

.socials a {
    width: 36px;
    height: 36px;
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.footer-column {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.footer-column h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.footer-column a {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.footer-column a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* =========================================
   6. RESPONSIVE DESIGN (Pantallas Pequeñas)
   ========================================= */
@media (max-width: 900px) {
    .footer-inner {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 650px) {
    .topbar-inner {
        flex-wrap: wrap;
    }

    .search {
        order: 3;
        width: 100%;
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .footer-inner {
        grid-template-columns: 1fr;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
}