/* --- 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: 70px;
    --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 --- */
.main-header {
    height: var(--header-height);
    background-color: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5%;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-soft);
}

.logo {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo i { color: #FF6B6B; }

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 5px;
}
.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;
}
.main-nav a.active { background: #fee2e2; color: #b91c1c; }

/* --- BUSCADOR --- */
.search-bar { width: 30%; position: relative; }
.search-bar input {
    width: 100%;
    padding: 10px 15px 10px 35px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: #f9fafb;
    outline: none;
}
.search-bar i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9ca3af; }

/* Dropdown de 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;
    letter-spacing: 0.5px;
    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); }
}

/* --- LAYOUT 3 COLUMNAS --- */
.app-container {
    display: grid;
    /* Izquierda (Ranking) | Centro (Contenido) | Derecha (Player) */
    grid-template-columns: 240px 1fr 320px; 
    gap: 30px;
    max-width: 1440px;
    margin: 30px auto;
    padding: 0 30px;
    width: 100%;
    align-items: start;
}

/* --- COLUMNA IZQUIERDA (TOP 50) --- */
.sidebar-left {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 90px;
    max-height: calc(100vh - 120px);
    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: 8px;
    border-radius: 8px;
    transition: 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
}
.ranking-item:hover {
    background: #f9fafb;
    border-color: var(--border);
}

.rank-num {
    font-size: 16px;
    font-weight: 900;
    color: #e5e7eb;
    width: 20px;
    text-align: center;
}
.rank-1, .rank-2, .rank-3 { color: #FF6B6B; }

.rank-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.rank-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.rank-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rank-views {
    font-size: 11px;
    color: var(--text-light);
}

/* --- HERO & CONTENT --- */
.main-content { display: flex; flex-direction: column; gap: 20px; }

.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;
}
.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; }

/* --- PLAYLIST CON SCROLL --- */
.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 { font-size: 12px; text-align: right; color: var(--text-light); }

/* --- SIDEBAR DERECHA & PLAYER --- */
.sidebar-right { display: flex; flex-direction: column; gap: 20px; }

.player-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 90px;
    z-index: 50;
    transition: all 0.3s ease;
}

.video-frame {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 12px;
    background: #000;
    margin-bottom: 15px;
    overflow: hidden;
}

.track-info-player { text-align: center; margin-bottom: 15px; }
.track-info-player h3 { font-size: 16px; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-info-player p { font-size: 13px; color: #FF6B6B; font-weight: 600; }

.progress-area {
    width: 100%;
    height: 5px;
    background: #e5e7eb;
    border-radius: 5px;
    cursor: pointer;
    margin-bottom: 8px;
}
.progress-fill { height: 100%; background: #FF6B6B; border-radius: 5px; width: 0%; transition: width 0.1s; }

.time-display { display: flex; justify-content: space-between; font-size: 11px; color: #9ca3af; margin-bottom: 15px; }

/* CONTROLES */
.controls { display: flex; justify-content: center; align-items: center; gap: 10px; }

.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); }

/* Artist Chips */
.artists-grid { background: var(--bg-card); padding: 20px; border-radius: var(--radius); }
.artists-grid h3 { font-size: 13px; text-transform: uppercase; color: #9ca3af; margin-bottom: 15px; }
.artist-chip { display: flex; align-items: center; gap: 10px; padding: 8px; margin-bottom: 5px; cursor: pointer; border-radius: 8px; }
.artist-chip:hover { background: #f9fafb; }
.artist-chip img { width: 32px; height: 32px; border-radius: 50%; }

/* --- SECCIÓN GÉNEROS FULL WIDTH --- */
.genres-full-section {
    max-width: 1440px;
    margin: 40px auto 0 auto;
    padding: 0 30px;
}
.genres-wrapper {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-soft);
    text-align: center;
}
.genres-wrapper h3 {
    margin-bottom: 20px;
    color: var(--text-main);
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.genres-list-text {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
}
.genre-simple-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: 0.2s;
    padding: 6px 12px;
    border-radius: 20px;
    background: #f9fafb;
    border: 1px solid transparent;
}
.genre-simple-link:hover {
    color: #FF6B6B;
    background: #fff1f2;
    border-color: #fee2e2;
}
.genre-simple-link.active {
    background: #FF6B6B;
    color: white;
    border-color: #FF6B6B;
    font-weight: 700;
    box-shadow: 0 4px 6px rgba(255, 107, 107, 0.3);
}

/* --- 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; }
.footer-links a:hover { color: #FF6B6B; }
.social-icons a { font-size: 18px; margin: 0 10px; color: var(--text-light); }
.social-icons a:hover { color: #FF6B6B; }

/* --- 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: 1fr; padding: 0 15px; margin-top: 20px; }
    .main-header { padding: 0 15px; }
    .search-bar { display: none; }
    .main-nav a { padding: 5px 10px; font-size: 13px; }
    
    .desktop-only { display: none !important; }
    .mobile-spacer { display: block !important; }

    /* Player Móvil (Sticky Footer) */
    .player-card {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        border-radius: 0;
        padding: 10px 15px;
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        border-top: 1px solid var(--border);
        box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
        height: var(--player-height-mobile);
    }

    .video-frame { display: none; }
    
    .player-info-row { grid-column: 1; display: flex; flex-direction: column; justify-content: center; padding-right: 10px; }
    .track-info-player { text-align: left; margin: 0; }
    
    .controls { grid-column: 2; gap: 10px; }
    .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; }

    .song-row { grid-template-columns: 20px 1fr 0px 40px; gap: 10px; padding: 10px; }
    .col-artist { display: none; }
    
    .genres-full-section { padding: 0 15px; }
    .genres-wrapper { padding: 20px; }
    .main-footer { padding-bottom: 100px; }
}