/* --- VARIABLES --- */
:root {
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --gradient-primary: linear-gradient(135deg, #FF6B6B 0%, #556270 100%);
    --text-main: #1f2937;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --radius: 16px;
    --header-height: auto;
    --player-height-mobile: 80px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- HEADER UNIFICADO (1 FILA ESCRITORIO / 2 FILAS MÓVIL) --- */
.main-header {
    background-color: var(--bg-card);
    display: flex;
    justify-content: center;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-soft);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1440px;
    padding: 0 30px;
    gap: 20px;
}

.logo {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0; /* No encoger logo */
}
.logo i { color: #FF6B6B; }

/* Buscador Central */
.search-bar-container { 
    flex: 1; /* Ocupa el espacio disponible en medio */
    max-width: 500px;
    position: relative; 
}
.search-bar { width: 100%; position: relative; }
.search-bar input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border-radius: 30px;
    border: 1px solid var(--border);
    background: #f9fafb;
    outline: none;
    transition: 0.2s;
    font-size: 15px;
}
.search-bar input:focus {
    background: #fff;
    border-color: #FF6B6B;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.1);
}
.search-bar i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #9ca3af; }

/* Navegación Derecha */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 15px;
}
.main-nav a {
    text-decoration: none;
    color: var(--text-light);
    font-weight: 600;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 14px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap; /* Evita que el texto baje */
}
.main-nav a.login-btn { border: 1px solid var(--border); }
.main-nav a:hover, .main-nav a.active {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fee2e2;
}

.mobile-icon { display: none; font-size: 20px; }
.desktop-text { display: inline; }

/* Dropdown Resultados */
.search-results-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-card); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); margin-top: 10px; z-index: 1000; border: 1px solid var(--border); display: none; overflow: hidden;
}
.search-results-dropdown.active { display: block; animation: fadeIn 0.2s ease-out; }
.search-section-label { padding: 12px 15px 5px; font-size: 11px; font-weight: 800; color: var(--text-light); text-transform: uppercase; background: #f8fafc; }
.search-item { display: flex; align-items: center; gap: 12px; padding: 10px 15px; text-decoration: none; transition: 0.2s; border-bottom: 1px solid rgba(0,0,0,0.03); }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #f0fdf4; }
.search-item img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.search-icon-placeholder { width: 32px; height: 32px; border-radius: 50%; background: #f1f5f9; display: flex; align-items: center; justify-content: center; color: #FF6B6B; font-size: 14px; }
.search-info { display: flex; flex-direction: column; overflow: hidden; }
.search-title { font-size: 14px; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-subtitle { font-size: 12px; color: var(--text-light); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

/* --- HERO SECTION --- */
.hero-full-container { max-width: 1440px; margin: 20px auto 0; padding: 0 30px; width: 100%; }
.hero-card { background: var(--gradient-primary); border-radius: var(--radius); padding: 40px; color: white; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); position: relative; overflow: hidden; margin-bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 40px; }
.hero-text-content { flex: 1; z-index: 2; text-align: left; }
.hero-tag { background: rgba(255,255,255,0.2); padding: 4px 10px; border-radius: 10px; font-size: 11px; font-weight: 700; letter-spacing: 1px; margin-bottom: 10px; display: inline-block; }
.hero-title { font-size: 2.5rem; font-weight: 800; line-height: 1.1; margin-bottom: 10px; }
.hero-desc { font-size: 1rem; opacity: 0.9; }
.hero-video-wrapper { flex: 0 0 300px; width: 300px; max-width: 100%; z-index: 2; order: -1; background: transparent; padding: 0; border-radius: 0; }
.video-frame { width: 100%; height: 0; padding-bottom: 56.25%; border-radius: 12px; background: rgba(0,0,0,0.2); overflow: hidden; position: relative; box-shadow: 0 8px 20px rgba(0,0,0,0.2); }
.video-frame iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* --- LAYOUT 3 COLUMNAS --- */
.app-container { display: grid; grid-template-columns: 320px 1fr 320px; gap: 30px; max-width: 1440px; margin: 30px auto; padding: 0 30px; width: 100%; align-items: start; }

/* SIDEBAR IZQUIERDA */
.sidebar-left { background: var(--bg-card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-soft); position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; display: flex; flex-direction: column; }
.ranking-title { font-size: 14px; font-weight: 800; color: var(--text-main); margin-bottom: 15px; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.ranking-title i { color: #FF6B6B; }
.ranking-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ranking-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; transition: 0.2s; cursor: pointer; border: 1px solid transparent; background: #f9fafb; }
.ranking-item:hover { background: #f0fdf4; border-color: var(--border); }
.ranking-item.active { background: #fee2e2; border-color: #fee2e2; box-shadow: 0 2px 4px rgba(255, 107, 107, 0.1); }
.ranking-item.active .rank-name { color: #b91c1c; }
.ranking-item.active .rank-num { color: #FF6B6B; }
.rank-num { font-size: 14px; font-weight: 900; color: #a0aec0; min-width: 20px; text-align: center; }
.rank-name { font-size: 13px; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }

/* MAIN CONTENT */
.main-content { display: flex; flex-direction: column; gap: 20px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-light); margin-bottom: 5px; flex-wrap: wrap; background: white; padding: 10px 15px; border-radius: 12px; box-shadow: var(--shadow-soft); }
.breadcrumb a { color: var(--text-light); text-decoration: none; transition: 0.2s; font-weight: 500; }
.breadcrumb a:hover { color: #FF6B6B; text-decoration: underline; }
.breadcrumb .separator { font-size: 10px; opacity: 0.5; color: #cbd5e0; }
.breadcrumb span.current { color: #FF6B6B; font-weight: 700; }

/* PLAYER CONTROL */
.player-card { background: var(--bg-card); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-soft); margin-bottom: 20px; display: flex; flex-direction: column; gap: 15px; position: relative; top: auto; }
.player-content-wrapper { width: 100%; }
.player-info-row { text-align: center; margin-bottom: 15px; overflow: hidden; position: relative; width: 100%; padding: 0 10px; }
.track-info-scroller { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.track-info-text { font-size: 16px; color: var(--text-main); font-weight: 600; }
.track-info-text span { color: var(--text-light); font-weight: 400; }
.progress-area { width: 100%; height: 6px; background: #e5e7eb; border-radius: 5px; cursor: pointer; margin-bottom: 10px; position: relative; }
.progress-fill { height: 100%; background: #FF6B6B; border-radius: 5px; width: 0%; transition: width 0.1s linear; }
.time-tooltip { position: absolute; top: -35px; background: #1f2937; color: #fff; font-size: 11px; padding: 4px 8px; border-radius: 4px; pointer-events: none; opacity: 0; transform: translateX(-50%); transition: opacity 0.2s; white-space: nowrap; font-weight: 600; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }
.time-tooltip::after { content: ''; position: absolute; bottom: -4px; left: 50%; margin-left: -4px; border-width: 4px; border-style: solid; border-color: #1f2937 transparent transparent transparent; }
.progress-area:hover .time-tooltip { opacity: 1; }
.controls-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.controls { display: flex; justify-content: center; align-items: center; gap: 10px; flex: 1; }
.btn-mini { background: #f3f4f6; border: none; width: 36px; height: 36px; border-radius: 50%; color: #4b5563; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; }
.btn-mini:hover { background: #e2e8f0; color: #2d3748; }
.btn-mini.active { color: #FF6B6B; background: #fff1f2; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); }
.btn-main { background: #FF6B6B; border: none; width: 50px; height: 50px; border-radius: 50%; color: white; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 6px rgba(255, 107, 107, 0.4); transition: 0.2s; }
.btn-main:hover { transform: scale(1.05); }
.time-display { font-size: 11px; color: #9ca3af; min-width: 35px; text-align: center; }

/* PLAYLIST */
.playlist-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.playlist-container { display: flex; flex-direction: column; gap: 8px; max-height: 600px; overflow-y: auto; padding-right: 10px; scrollbar-width: thin; scrollbar-color: #cbd5e0 transparent; }
.playlist-container::-webkit-scrollbar { width: 6px; }
.playlist-container::-webkit-scrollbar-track { background: transparent; }
.playlist-container::-webkit-scrollbar-thumb { background-color: #cbd5e0; border-radius: 10px; }
.playlist-container::-webkit-scrollbar-thumb:hover { background-color: #a0aec0; }
.song-row { background: var(--bg-card); border-radius: 12px; padding: 12px 15px; display: grid; grid-template-columns: 30px 1fr 1fr 50px; align-items: center; cursor: pointer; transition: 0.2s; border: 1px solid transparent; flex-shrink: 0; }
.song-row:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.song-row.active { border-left: 4px solid #FF6B6B; background: #fff1f2; }
.song-row.active strong { color: #b91c1c; }
.col-num { font-weight: 700; color: #d1d5db; }
.col-title strong { display: block; color: var(--text-main); font-size: 15px; }
.col-artist { color: var(--text-light); font-size: 13px; }
.col-time { text-align: right; }
.play-link-icon { color: #FF6B6B; font-size: 24px; transition: 0.2s; display: inline-flex; }
.play-link-icon:hover { transform: scale(1.2); color: #b91c1c; }

/* SIDEBAR DERECHA */
.sidebar-right { display: flex; flex-direction: column; gap: 20px; }
.sidebar-genres { background: var(--bg-card); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow-soft); position: sticky; top: 20px; }
.sidebar-genres h3 { font-size: 13px; text-transform: uppercase; color: #9ca3af; margin-bottom: 15px; }
.genres-scroll-list { display: flex; flex-direction: column; gap: 8px; max-height: calc(100vh - 100px); overflow-y: auto; padding-right: 5px; scrollbar-width: thin; scrollbar-color: #cbd5e0 transparent; }
.genres-scroll-list::-webkit-scrollbar { width: 4px; }
.genres-scroll-list::-webkit-scrollbar-thumb { background-color: #cbd5e0; border-radius: 4px; }
.genre-sidebar-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #f9fafb; border-radius: 8px; color: var(--text-main); text-decoration: none; font-size: 14px; transition: 0.2s; }
.genre-sidebar-link:hover, .genre-sidebar-link.active { background: #FF6B6B; color: white; }
.genre-sidebar-link i { opacity: 0.7; }

/* GÉNEROS MÓVIL (OCULTO EN PC) */
.genres-full-section { display: none; }

/* FOOTER */
.main-footer { background: var(--bg-card); border-top: 1px solid var(--border); padding: 40px 5%; margin-top: 40px; text-align: center; color: var(--text-light); font-size: 14px; margin-bottom: 0; }
.footer-content { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.footer-links a { color: var(--text-main); text-decoration: none; margin: 0 10px; font-weight: 600; position: relative; }
.footer-links a:hover { color: #FF6B6B; }
.footer-links a::after { content: ''; position: absolute; width: 0; height: 2px; bottom: -2px; left: 0; background-color: #FF6B6B; transition: width 0.3s; }
.footer-links a:hover::after { width: 100%; }
.footer-legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; margin-top: 10px; padding-top: 20px; border-top: 1px solid rgba(0,0,0,0.05); }
.footer-legal-links a { color: var(--text-light); text-decoration: none; font-size: 12px; transition: color 0.2s; }
.footer-legal-links a:hover { color: var(--text-main); }
.social-icons a { font-size: 18px; margin: 0 10px; color: var(--text-light); transition: 0.2s; }
.social-icons a:hover { color: #FF6B6B; transform: translateY(-3px); display: inline-block; }

/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 1100px) {
    .app-container { grid-template-columns: 1fr 300px; }
    .sidebar-left { display: none; }
}

@media (max-width: 900px) {
    .app-container { grid-template-columns: minmax(0, 1fr); padding: 0 15px; margin-top: 5px; width: 100%; overflow-x: hidden; }

    /* Header Móvil Reorganizado */
    .header-content { flex-wrap: wrap; padding: 0 15px; gap: 10px; }
    .logo { order: 1; flex: 1; }
    .main-nav { order: 2; }
    .search-bar-container { 
        order: 3; 
        width: 100%; 
        max-width: none; 
        margin: 5px 0 0 0;
    }

    .desktop-text { display: none; }
    .mobile-icon { display: block; font-size: 18px; color: #4b5563; }
    .main-nav ul { gap: 10px; }
    .main-nav a { padding: 8px; border-radius: 50%; width: 40px; height: 40px; justify-content: center; background: #f3f4f6; border: none; }
    .search-bar input { font-size: 16px; }
    
    .desktop-only { display: none !important; }
    .mobile-spacer { display: none !important; } /* CORRECCIÓN: Apagamos el espaciador de 100px para eliminar el hueco gigante */

    /* Ajuste del Hero en Móvil */
    .hero-card { flex-direction: column; text-align: center; padding: 25px; gap: 20px; }
    .hero-video-wrapper { flex: auto; width: 100%; order: 0; margin-bottom: 10px; }
    .hero-text-content { text-align: center; }

    /* Artistas (Carrusel) */
    .sidebar-left { display: block !important; position: static; width: 100%; max-width: 100vw; max-height: none; background: transparent; box-shadow: none; padding: 0; overflow: hidden; margin-bottom: 5px; }
    .ranking-title { font-size: 15px; margin-bottom: 5px; padding-left: 5px; }
    .ranking-list { display: flex; flex-direction: row; overflow-x: auto; padding-bottom: 15px; gap: 8px; width: 100%; padding-left: 5px; padding-right: 5px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
    .ranking-list::-webkit-scrollbar { display: none; }
    .ranking-item { min-width: 120px; max-width: 120px; flex-direction: column; justify-content: center; text-align: center; padding: 12px 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.03); scroll-snap-align: start; flex-shrink: 0; height: auto; }
    .rank-num { font-size: 12px; margin-bottom: 4px; }
    .rank-name { font-size: 12px; white-space: normal; line-height: 1.2; max-height: 2.4em; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; width: 100%; }

    /* MAIN CONTENT COMPACTO */
    .main-content { gap: 10px; }

    /* Géneros (Carrusel Móvil) */
    .genres-full-section { display: block; padding: 0 15px; width: 100%; max-width: 100vw; overflow: hidden; margin-top: 0px; }
    .genres-wrapper { padding: 5px 0 0 0; text-align: left; background: transparent; box-shadow: none; }
    .genres-wrapper h3 { padding-left: 5px; margin-bottom: 10px; font-size: 15px; }
    .genres-list-text { display: flex !important; flex-wrap: nowrap !important; overflow-x: auto !important; justify-content: flex-start !important; gap: 10px; width: 100%; padding-bottom: 10px; padding-left: 5px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
    .genres-list-text::-webkit-scrollbar { display: none; }
    .genre-simple-link { flex-shrink: 0; white-space: nowrap; background: var(--bg-card); border: 1px solid var(--border); scroll-snap-align: start; padding: 8px 16px; box-shadow: 0 2px 5px rgba(0,0,0,0.03); }

    /* CLASES DINÁMICAS PARA CAJAS SEO Y ALFABETO (NUEVO) */
    .seo-box-container { margin-top: 15px !important; padding: 0 15px !important; }
    .seo-box-content { padding: 20px 15px !important; font-size: 0.85rem !important; }
    .alphabet-container { margin-top: 20px !important; margin-bottom: 20px !important; padding: 0 15px !important; }

    /* Player Móvil */
    .player-card { position: fixed !important; bottom: 0 !important; left: 0 !important; right: 0 !important; top: auto !important; width: 100% !important; border-radius: 0 !important; padding: 10px 15px !important; display: grid !important; grid-template-columns: 1fr auto !important; align-items: center !important; border-top: 1px solid var(--border); box-shadow: 0 -4px 10px rgba(0,0,0,0.05); height: var(--player-height-mobile); margin-bottom: 0 !important; z-index: 9999; }
    .video-frame { display: none; }
    .player-content-wrapper { width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: center; }
    .player-info-row { grid-column: 1; display: flex; flex-direction: column; justify-content: center; padding-right: 10px; text-align: left; margin: 0; }
    .track-info-player { text-align: left; margin: 0; }
    .controls-row { display: contents; }
    .controls { grid-column: 2; gap: 10px; flex: initial; }
    .btn-mini { width: 32px; height: 32px; font-size: 12px; }
    .btn-main { width: 40px; height: 40px; font-size: 16px; }
    .progress-area { position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: 0; margin: 0; background: transparent; }
    .progress-fill { background: #FF6B6B; }

    /* Otros */
    .song-row { grid-template-columns: 20px 1fr 0px 40px; gap: 10px; padding: 10px; }
    .col-artist { display: none; }
    .main-footer { padding-bottom: 100px; }
}