:root {
    /* Colores principales */
    --bg-dark: #1A1614;
    --sidebar-bg: #141414;
    --active-item: #2b2b2b;
    --text-main: #ffffff;
    --text-dim: #a0a0a0;
    --text-dim2: #212020;
    --accent-color: #eb4d4b;
    --azul-principal: #3ca5e7;
    --rojo: #e74c3c;
    --azul: #3498db;
    --verde: #27ae60;
    --discord: #7289da;

    /* Bordes y fondos */
    --border-color: #333;
    --bg-tarjeta: #252525;
    --bg-hover: rgba(255, 255, 255, 0.05);
}

/* ============================================ */
/* RESET Y BASE */
/* ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body,
html {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Scroll personalizado global */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* ============================================ */
/* ESTRUCTURA PRINCIPAL */
/* ============================================ */
.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    color: var(--text-main);
}

/* ============================================ */
/* SIDEBAR */
/* ============================================ */
.sidebar {
    width: 260px;
    min-height: 90vh;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 12px;
    border-right: 1px solid #252525;
    transition: all 0.2s ease-in-out;
    overflow-x: hidden;
    flex-shrink: 0;
}

.toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-left: 10px;
    font-weight: bold;
    font-size: 1rem;
    padding-bottom: 10px;
    transition: all 0.3s ease ease-in-out;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: block;
}

.nav-menu {
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    width: 80%;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    color: var(--text-dim);
    margin-bottom: 4px;
    transition: 0.2s;
    font-size: 13px;
}

.nav-item:hover {
    background-color: rgba(105, 105, 105, 0.171);
    border-color: rgba(255, 255, 255, 0.35);
    color: var(--text-main);
}

.nav-item.active {
    background-color: var(--active-item);
    color: var(--text-main);
    position: relative;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 20%;
    height: 60%;
    width: 4px;
    background-color: var(--accent-color);
    border-radius: 0 4px 4px 0;
}

/* Sidebar colapsado */
.sidebar.collapsed {
    width: 10px;
}

.sidebar.collapsed .toggle-btn {
    position: fixed;
    left: 1px;
    margin-top: 50px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span:not(.icon),
.sidebar.collapsed .user-profile span,
.sidebar.collapsed .btn-upgrade,
.sidebar.collapsed .sidebar-footer,
.sidebar.collapsed .nav-item,
.sidebar.collapsed .icon {
    display: none;
}

/* Footer del sidebar */
.sidebar-footer {
    border-top: 1px solid #252525;
    padding-top: 15px;
}

.user-profile {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
}

.avatar {
    width: 32px;
    height: 32px;
    background: #333;
    border-radius: 50%;
    margin-right: 10px;
}

.btn-upgrade {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #333;
    background: #1a1a1a;
    color: white;
    cursor: pointer;
}

/* ============================================ */
/* HEADER */
/* ============================================ */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 30px;
    height: 60px;
    background: #ffffff;
    border-bottom: 1px solid #333;
    position: relative;
    z-index: 100;
}

.logo-header span {
    color: #1A1614;
    font-size: 20px;
    text-transform: uppercase;
}

/* ============================================ */
/* BUSCADOR */
/* ============================================ */
.search-box {
    display: flex;
    align-items: center;
    background: #252525;
    border-radius: 10px;
    padding: 4px 12px;
    border: 1px solid #444;
    width: 180px;
    transition: all 0.3s ease;
}

.search-box:focus-within {
    width: 220px;
    border-color: #fff;
}

.search-box input {
    background: transparent;
    border: none;
    color: white;
    font-size: 13px;
    outline: none;
    width: 100%;
}

.search-box button {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 12px;
}

.search-box button:hover {
    color: #fff;
}

/* ============================================ */
/* SUGERENCIAS DE BÚSQUEDA */
/* ============================================ */
.sugerencias-container {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #252525;
    border: 1px solid #444;
    border-radius: 0 0 10px 10px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.sugerencias-container.visible {
    display: block;
}

.sugerencia-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #333;
    transition: background 0.2s;
}

.sugerencia-item:last-child {
    border-bottom: none;
}

.sugerencia-item:hover {
    background: #333;
}

.sugerencia-imagen {
    width: 40px;
    height: 40px;
    background-size: cover;
    background-position: center;
    border-radius: 5px;
    margin-right: 12px;
    flex-shrink: 0;
}

.sugerencia-info {
    flex: 1;
}

.sugerencia-nombre {
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.sugerencia-tipo {
    color: #888;
    font-size: 12px;
    text-transform: uppercase;
}

.sugerencia-seccion {
    background: var(--rojo);
    color: white;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 10px;
    white-space: nowrap;
}

/* ============================================ */
/* MAIN Y SECCIONES */
/* ============================================ */
main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: auto;
    width: 100%;
    transition: background 0.3s ease-in-out;
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
}

main.bg-home {
    background: linear-gradient(90deg, #132430, #2fbaba);
}

main.bg-games {
    background: var(--bg-dark);
}

.content-section {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.content-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ============================================ */
/* MENSAJE DE RESULTADOS */
/* ============================================ */
.resultados-mensaje-container {
    width: calc(100% - 40px);
    margin: 10px auto;
    padding: 0 20px;
    position: relative;
    z-index: 10;
    min-height: 50px;
}

.mensaje-resultado {
    width: 100%;
    text-align: center;
    padding: 15px;
    margin: 10px 0;
    color: #ffffff;
    font-size: 14px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================ */
/* INICIO / HOME */
/* ============================================ */
.inicio-destacados {
    padding: 0px 20px;
    text-align: center;
    max-width: 1200px;
    min-height: 120vh;
    margin: 0 auto;
}

.inicio-header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    color: white;
}

.inicio-header p {
    color: #b5b3b3;
    margin-bottom: 2rem;
    font-size: 1.2rem;
}

.destacados-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 1000px;
    margin: 0 auto 40px;
}

.destacado-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid #333;
}

.destacado-card:hover {
    transform: translateY(-5px);
    border-color: var(--rojo);
    box-shadow: 0 10px 20px rgba(231, 76, 60, 0.2);
}

.destacado-img {
    width: 100%;
    height: 150px;
    background-size: cover;
    background-position: center;
}

.destacado-info {
    padding: 15px;
    text-align: left;
}

.destacado-info h3 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: white;
}

.destacado-tipo {
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 12px;
    background: #333;
    display: inline-block;
}

.destacado-tipo.juego {
    background: #3498db20;
    color: var(--azul);
}

.destacado-tipo.rom {
    background: #e74c3c20;
    color: var(--rojo);
}

/* Botones de inicio */
.inicio-footer {
    margin-top: 30px;
}

.btn-discord {
    background: var(--discord);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin: 0 10px 15px;
}

.btn-discord:hover {
    background: #5b6eae;
    transform: scale(1.05);
}

.btn-explorar {
    background: transparent;
    color: var(--rojo);
    border: 2px solid var(--rojo);
    padding: 10px 25px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin: 0 5px 15px;
}

.btn-explorar:hover {
    background: var(--rojo);
    color: white;
}

.inicio-meta {
    color: #888;
    font-size: 0.9rem;
    margin-top: 20px;
}

/* ============================================ */
/* TARJETAS DE JUEGOS Y ROMS */
/* ============================================ */
.base-targetas {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 10px;
}

.card-wrapper {
    display: flex;
    width: 160px;
    height: 250px;
    margin: 10px;
    border-radius: 12px;
    overflow: hidden;
    transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 5px 10px 20px rgba(0, 0, 0, 0.4);
}

.card-wrapper.active {
    width: 550px;
}

.card-main {
    min-width: 160px;
    height: 100%;
    background: var(--i) center/cover;
    cursor: pointer;
    position: relative;
}

.card-main::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: 0.5s;
}

.card-main:hover::after {
    left: 100%;
}

/* Info hover */
.info-hover {
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 20%, rgba(255, 255, 255, 0));
    backdrop-filter: blur(3px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 0;
    transition: all 0.4s ease-in-out;
    color: white;
}

.card-main:hover .info-hover {
    opacity: 1;
}

.game-title h1 {
    font-size: 30px;
    margin: 0;
}

/* Panel lateral */
.side-panel {
    min-width: 290px;
    background: #1e1e1e;
    color: #eee;
    padding: 15px;
    border-left: 2px solid #ffffff;
    position: relative;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease;
}

.card-wrapper.active .side-panel {
    opacity: 1;
    visibility: visible;
}

.panel-content h3 {
    font-size: 15px;
    margin-bottom: 10px;
    text-transform: uppercase;
    color: #ffffff;
    margin-top: 0;
}

.panel-content p {
    margin: 10px;
    font-size: 12px;
}

.btn-ver-mas {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: #ffffff;
    border: none;
    color: rgb(0, 0, 0);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-ver-mas:hover {
    transform: scale(1.05);
}

/* ============================================ */
/* TUTORIALES - ESTILO PÓSTERS */
/* ============================================ */
.posters-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.posters-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px;
    border-bottom: 2px solid var(--azul-principal);
}

.posters-title {
    font-size: 2.5rem;
    color: white;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.posters-subtitle {
    color: #ffffff;
    font-size: 1.1rem;
    margin: 0;
}

.posters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    padding: 10px;
}

/* Poster individual */
.poster {
    position: relative;
    height: 250px;
    border-radius: 16px;
    border-left: 6px solid;
    background: #1e1e1e;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.5s ease forwards;
    opacity: 0;
}

.poster:hover {
    transform: scale(1.03) translateY(-8px);
    box-shadow: 0 20px 30px rgba(0, 0, 0, 0.5);
}

.poster-content {
    position: relative;
    z-index: 3;
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.poster-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
    margin-bottom: 5px;
}

.poster-subtitle {
    color: #ccc;
    font-size: 1rem;
    font-weight: 300;
    margin-bottom: 15px;
}

.poster-meta {
    display: flex;
    gap: 15px;
    color: #aaa;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.poster-meta span {
    display: flex;
    align-items: center;
    gap: 3px;
}

.poster-play {
    display: inline-block;
    background: transparent;
    color: white;
    border: 2px solid white;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.poster:hover .poster-play {
    background: white;
    color: #1a1a1a;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* Efectos de poster */
.poster-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    opacity: 0.4;
    transition: opacity 0.3s;
    pointer-events: none;
}

.poster:hover .poster-overlay {
    opacity: 0.8;
}

.poster-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
    animation: rotate 10s linear infinite;
}

.poster:hover .poster-glow {
    opacity: 0.6;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Delay en animaciones */
.poster:nth-child(1) {
    animation-delay: 0.1s;
}

.poster:nth-child(2) {
    animation-delay: 0.2s;
}

.poster:nth-child(3) {
    animation-delay: 0.3s;
}

.poster:nth-child(4) {
    animation-delay: 0.4s;
}

.poster:nth-child(5) {
    animation-delay: 0.5s;
}

.poster:nth-child(6) {
    animation-delay: 0.6s;
}



/* ============================================ */
/* MEDIA QUERIES - TODOS JUNTOS */
/* ============================================ */

/* Tablets y móviles (hasta 768px) */
@media screen and (max-width: 768px) {

    /* Sidebar */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1000;
        transform: translateX(0);
        transition: transform 0.3s ease;
    }

    .sidebar.collapsed {
        transform: translateX(-100%);
        width: 260px;
    }

    main {
        margin-left: 0;
        width: 100%;
    }

    /* Header */
    .header-container {
        padding: 10px 15px;
        flex-wrap: wrap;
    }

    .logo-header span {
        font-size: 16px;
    }

    /* Buscador */
    .search-box {
        width: 140px;
    }

    .search-box:focus-within {
        width: 180px;
    }

    /* Tarjetas */
    .base-targetas {
        gap: 10px;
        padding: 10px;
    }

    .card-wrapper {
        width: 140px;
        height: 220px;
    }

    .card-wrapper.active {
        width: calc(100% - 20px);
        max-width: 400px;
    }

    .side-panel {
        min-width: 200px;
        padding: 10px;
    }

    .game-title h1 {
        font-size: 20px;
    }

    .panel-content h3 {
        font-size: 14px;
    }

    .panel-content p {
        font-size: 11px;
    }

    /* Inicio */
    .inicio-header h1 {
        font-size: 2.5rem;
    }

    .inicio-header p {
        font-size: 1rem;
    }

    .destacados-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }

    .inicio-footer {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .btn-discord,
    .btn-explorar {
        width: 80%;
        margin: 5px 0;
    }



    /* Mensajes */
    .resultados-mensaje-container {
        width: calc(100% - 20px);
        margin: 5px auto;
        padding: 0 10px;
    }

    .mensaje-resultado {
        padding: 10px;
        margin: 5px 0;
        font-size: 12px;
    }

    /* Sugerencias */
    .sugerencias-container {
        position: fixed;
        top: auto;
        left: 10px;
        right: 10px;
        max-height: 50vh;
        z-index: 2000;
    }

    .sugerencia-item {
        padding: 12px;
    }

    .sugerencia-imagen {
        width: 30px;
        height: 30px;
    }
}

/* Móviles pequeños (hasta 480px) */
@media screen and (max-width: 480px) {
    .header-container {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }

    .logo-header {
        margin-bottom: 10px;
    }

    .search-box {
        width: 100%;
        max-width: 280px;
    }

    .search-box:focus-within {
        width: 100%;
    }

    .card-wrapper {
        width: 130px;
        height: 300px;
    }

    .card-wrapper.active {
        width: 100%;
        flex-direction: column;
        height: 50vh;
    }

    .card-main {
        min-width: 100%;
        height: 180px;
    }

    .side-panel {
        min-width: 100%;
        height: 60vh;
    }

    .destacados-grid {
        grid-template-columns: 1fr 1fr;
    }

    .inicio-header h1 {
        font-size: 2rem;
    }

    .inicio-footer button {
        width: 100%;
    }

    .mensaje-resultado {
        font-size: 12px;
        padding: 10px;
    }
}

/* Landscape (móvil en horizontal) */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        overflow-y: auto;
    }

    .nav-item {
        padding: 8px;
    }

    .header-inicio {
        height: 80vh;
    }

    .header-inicio h1 {
        font-size: 30px;
    }

    .base-targetas {
        max-height: calc(100vh - 80px);
        overflow-y: auto;
    }
}

/* ============================================ */
/* UTILIDADES Y CLASES EXTRA */
/* ============================================ */
.navbar a {
    display: block;
    padding: 22px 10px;
    color: #000000;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 15px;
    transition: all 0.3s ease;
}

.b1:hover {
    background-color: #2fbaba;
}

.bottom-header {
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    color: var(--text-dim2);
    margin-bottom: 4px;
    transition: 0.2s;
    font-size: 13px;
}

.bottom-header:hover {
    color: rgb(13, 77, 120);
}

/* Ocultar scrollbars en app-container */
.app-container ::-webkit-scrollbar {
    display: none;
}