/* ==========================================================================
   TEIGUHUB - COMPILADO GLOBAL (Estilo Material Dark / Optimizado Móvil)
   ========================================================================== */

:root {
    /* Paleta Material Dark con toque Teigu */
    --surface-0: #0a0b0e;        /* Fondo profundo de la app */
    --surface-1: #12141c;        /* Capa base superior (Header, Tarjetas) */
    --surface-2: #1c1e29;        /* Capa de elevación (Buscador, Inputs) */
    
    --primary: #cf152d;          /* Rojo Carmesí Teigu (Acentos primarios) */
    --primary-hover: #fa2541;    /* Brillo para interacciones */
    --on-primary: #ffffff;       /* Texto sobre botones de color */
    
    --text-main: #e2e8f0;        /* Texto de alta prioridad */
    --text-muted: #94a3b8;       /* Texto secundario / descripciones */
    --border-color: rgba(255, 255, 255, 0.06);
    
    /* Sombras de elevación oficiales de Material Design */
    --shadow-1: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.4);
    --shadow-2: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
    --shadow-3: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
    
    --radius-main: 12px;         /* Esquinas curvas orgánicas de Material */
    --font-main: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Reset y optimización táctil */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    list-style: none;
    -webkit-tap-highlight-color: transparent; /* Quita el cuadro azul feo al picar en cel */
}

body {
    background-color: var(--surface-0);
    color: var(--text-main);
    font-family: var(--font-main);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 0;
    flex: 1;
}

/* ==========================================================================
   HEADER MATERIAL DESIGN REORGANIZADO
   ========================================================================== */
.main-header {
    background-color: var(--surface-1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 12px 5%;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-2);
    gap: 12px;
}

/* Fila superior: Logo y Botones de acción */
.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo h1 {
    font-size: 1.6rem;
    color: var(--text-main);
    font-weight: 800;
    letter-spacing: 0.5px;
}

.logo h1 span {
    color: var(--primary);
    position: relative;
}

/* Botones circulares de acción estilo Material Icon Button */
.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-btn {
    background-color: var(--surface-2);
    border: none;
    color: var(--text-main);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: var(--shadow-1);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn:hover {
    background-color: var(--primary);
    color: var(--on-primary);
    transform: scale(1.05);
}

/* El contenedor del buscador */
.search-container {
    display: block;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--surface-2);
    border-radius: 24px;
    padding: 8px 16px;
    width: 100%;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

.search-bar:focus-within {
    border-color: rgba(207, 21, 45, 0.4);
    background-color: var(--surface-0);
}

.search-bar input {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 0.95rem;
    width: 100%;
    outline: none;
}

.search-bar button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
}

/* Links estilo "Tabs" inferiores */
.nav-links {
    display: flex;
    justify-content: center;
    gap: 8px;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.nav-links a {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px; /* Espacio entre icono y texto */
    transition: all 0.2s ease;
    flex: 1;
    justify-content: center;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--primary);
    background-color: rgba(207, 21, 45, 0.08);
}

/* ==========================================================================
   COMPORTAMIENTO EXCLUSIVO EN MÓVILES
   ========================================================================== */
@media (max-width: 768px) {
    .main-header {
        padding: 12px 16px;
        gap: 10px;
        border-radius: 0 0 16px 16px;
    }

    /* Escondemos el buscador por defecto en celulares */
    .search-container {
        display: none;
        animation: slideDown 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }

    /* Clase activa que inyecta el JS al tocar el botón */
    .search-container.active {
        display: block;
    }

    .nav-links {
        background-color: var(--surface-2);
        padding: 4px;
        border-radius: 12px;
    }

    .nav-links a {
        font-size: 0.85rem;
        padding: 8px 6px;
        border-radius: 8px;
    }

    .nav-links a.active {
        background-color: var(--surface-1);
        box-shadow: var(--shadow-1);
    }
}

/* Animación fluida para desplegar el buscador */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* ==========================================================================
   CARRUSELES HORIZONTALES (Scroll Lateral Fluido)
   ========================================================================== */
.anime-grid,
.trending-grid {
    display: flex !important;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 16px;
    padding: 12px 4px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.anime-grid::-webkit-scrollbar,
.trending-grid::-webkit-scrollbar {
    display: none;
}

.anime-grid,
.trending-grid {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.anime-card {
    flex: 0 0 160px;
    max-width: 160px;
}

/* Grid para resultados de búsqueda */
.anime-grid.search-mode {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    overflow-x: hidden;
    gap: 16px;
}
/* ==========================================================================
   FOOTER MATERIAL DESIGN (El toque final, pa)
   ========================================================================== */
.main-footer {
    background-color: var(--surface-1);    /* Mismo tono base que el header */
    border-top: 1px solid var(--border-color); /* Línea sutil divisoria */
    padding: 20px 16px;
    text-align: center;
    margin-top: auto;                      /* Empuja el footer siempre al fondo */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3); /* Sombra invertida hacia arriba */
}

.main-footer p {
    color: var(--text-muted);              /* Texto secundario grisáceo elegante */
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    line-height: 1.5;
}

/* Por si quieres resaltar algo en el texto del footer en el futuro */
.main-footer p span {
    color: var(--primary);
    font-weight: bold;
}

