/* --- ESTILOS GENERALES --- */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    margin: 0;
    background-color: #f9fafb;
    color: #1f2937;
}

a {
    color: inherit;
    text-decoration: none;
}

/* --- ESTRUCTURA PRINCIPAL --- */
#main-header {
    background-color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.container {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding: 1rem 1.5rem;
}

#main-header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2563eb;
    flex-shrink: 0;
}

/* --- NAVEGACIÓN DE ESCRITORIO --- */
#desktop-nav {
    display: none; /* Oculto por defecto, visible en pantallas grandes */
    align-items: center;
    gap: 1.5rem;
}

#desktop-nav a {
    color: #4b5563;
    transition: color 0.3s;
}

#desktop-nav a:hover {
    color: #2563eb;
}

/* Dropdown de Categorías (Escritorio) */
.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-radius: 0.375rem;
    padding: 0.5rem 0;
    min-width: 12rem;
    z-index: 10;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    display: block;
    padding: 0.5rem 1rem;
    color: #374151;
}

.dropdown-content a:hover {
    background-color: #eff6ff;
}


/* --- BUSCADOR --- */
#desktop-search {
    display: none; /* Oculto por defecto */
    flex-grow: 1;
    justify-content: center;
    padding: 0 2.5rem;
}
.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 28rem;
}
.search-wrapper input {
    width: 100%;
    background-color: #f3f4f6;
    border: 1px solid transparent;
    border-radius: 9999px;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    outline: none;
}
.search-wrapper input:focus {
    border-color: #3b82f6;
}
.search-wrapper svg {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    color: #9ca3af;
}


/* --- MENÚ MÓVIL --- */
#mobile-menu-button {
    cursor: pointer;
}

/* El checkbox es invisible, solo sirve para guardar el estado (abierto/cerrado) */
#mobile-menu-toggle, #mobile-categories-toggle {
    display: none;
}

#mobile-menu {
    display: none; /* Oculto hasta que el checkbox se marque */
    margin-top: 1rem;
}

/* Regla Mágica: Cuando el checkbox está marcado, muestra el menú que es su hermano */
#mobile-menu-toggle:checked ~ #mobile-menu {
    display: block;
}

#mobile-menu .search-wrapper { /* Reutilizamos estilos del buscador */
    margin-bottom: 1rem;
}

.mobile-nav-links a, .mobile-nav-links label {
    display: block;
    padding: 0.75rem 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
}

.mobile-nav-links a:hover, .mobile-nav-links label:hover {
    background-color: #eff6ff;
}

#mobile-categories-list {
    display: none;
    padding-left: 1rem;
    margin-top: 0.5rem;
}

#mobile-categories-toggle:checked ~ #mobile-categories-list {
    display: block;
}

#categories-arrow {
    transition: transform 0.3s;
}

#mobile-categories-toggle:checked + label #categories-arrow {
    transform: rotate(180deg);
}

/* --- MEDIA QUERIES (Responsividad) --- */
/* Estilos para pantallas de 768px o más (tablets y escritorio) */
@media (min-width: 768px) {
    #mobile-menu-button, #mobile-menu {
        display: none;
    }
    #desktop-nav, #desktop-search {
        display: flex;
    }
}

