/*
    Archivo: css/styles.css
    Descripción: Variables y estilos principales para la UI de MusicTracker.
    - Variables CSS en :root para tema oscuro
    - Componentes: navegación, cards, cabecera, reproductor
*/
:root {
    /* Paleta Profesional Oscura */
    --bg-main: #0a0a0a;
    --bg-secondary: #161616;
    --bg-card: #222222;
    --bg-hover: #2a2a2a;
    
    --accent: #ffffff; /* Blanco puro para acentos fuertes */
    --accent-dim: #a0a0a0;
    
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-tertiary: #717171;
    
    --border: rgba(255, 255, 255, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 24px;
    
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- NAV --- */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
    cursor: pointer;
    user-select: none;
}

.search-container {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 99px;
    padding: 0.5rem 1rem;
    width: 350px;
    transition: var(--transition);
}

.search-container:focus-within {
    border-color: var(--text-secondary);
    background: var(--bg-main);
}

.search-container input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 100%;
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
}

.search-container button {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.search-container button:hover { color: var(--text-primary); }

/* --- HERO & SUGGESTIONS --- */
#suggestions-view {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.hero-header {
    margin-bottom: 4rem;
    text-align: center;
}

.hero-header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -1.5px;
    margin-bottom: 1rem;

    /* --- EFECTO DEGRADADO ANIMADO --- */
    
    /* 1. El degradado: Gris -> Blanco -> Gris (hace que el bucle sea invisible) */
    background: linear-gradient(
        to right, 
        #888888 0%, 
        #ffffff 50%, 
        #888888 100%
    );

    /* 2. Hacemos el fondo gigante (200%) para poder moverlo */
    background-size: 200% auto;
    
    /* 3. Recortamos el fondo para que solo se vea en las letras */
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;

    /* 4. La animación: Lenta (10s) y continua (linear) */
    animation: shineFlow 10s linear infinite;
}

/* --- DEFINICIÓN DE LA ANIMACIÓN --- */
@keyframes shineFlow {
    from {
        background-position: 0% center;
    }
    to {
        background-position: 200% center;
    }
}

.hero-header p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto;
}

.section-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 2rem;
}

/* CARDS ESTILO PRODUCTO */
.artist-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    border: 1px solid transparent;
}

.artist-card:hover {
    transform: translateY(-5px);
    background: var(--bg-hover);
    border-color: var(--border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.artist-card .img-container {
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
}

.artist-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.artist-card:hover img { transform: scale(1.05); }

.artist-card .card-info {
    padding: 1rem;
}

.artist-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- MAIN ARTIST VIEW --- */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 0 4rem 0;
}

/* CABECERA INMERSIVA */
.artist-header {
    position: relative;
    padding: 4rem 2rem;
    overflow: hidden;
    background-color: var(--bg-secondary);
    margin-bottom: 2rem;
    /* Imagen de fondo dinámica */
    background-size: cover;
    background-position: center;
}

/* Capa oscura sobre la imagen de fondo */
.overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(10,10,10,0.8) 0%, var(--bg-main) 100%);
    backdrop-filter: blur(20px); /* Efecto cristal desenfocado */
    z-index: 1;
}

.header-content {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 2.5rem;
    align-items: flex-end;
}

.img-wrapper {
    flex-shrink: 0;
    width: 240px;
    height: 240px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.info-wrapper { flex-grow: 1; }

.info-wrapper h1 {
    font-size: 4rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 1rem;
    letter-spacing: -2px;
}

.tags-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.tags-row span {
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 99px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.1);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* STATS BLOCKS */
.stats-row {
    display: flex;
    gap: 1.5rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 600;
}

/* --- CONTENT GRID --- */
.layout-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 3rem;
    padding: 0 2rem;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

/* Sidebar: Bio & Similar */
.bio-section p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 3rem;
    display: -webkit-box;
    -webkit-line-clamp: 8;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.similar-grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.similar-card {
    cursor: pointer;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    transition: var(--transition);
}

.similar-card:hover { opacity: 0.8; }

.similar-card img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    display: block;
    background: var(--bg-secondary);
}

.similar-card p {
    font-size: 0.85rem;
    margin-top: 0.5rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tracks List */
.tracks-header {
    display: grid;
    grid-template-columns: 40px 1fr 100px;
    padding: 0 1rem 0.5rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.tracks-list { list-style: none; }

.track-item {
    display: grid;
    grid-template-columns: 40px 1fr 100px;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    align-items: center;
    transition: var(--transition);
    cursor: default;
    color: var(--text-secondary);
}

.track-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}

.track-num { color: var(--text-tertiary); font-size: 0.9rem; }
.track-name { font-weight: 500; color: var(--text-primary); }
.track-plays { text-align: right; font-size: 0.9rem; font-variant-numeric: tabular-nums; }

/* UTILS */
.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.5s ease-out; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loading Spinner */
.spinner {
    width: 40px; height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 100px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 900px) {
    .layout-grid { grid-template-columns: 1fr; }
    .header-content { flex-direction: column; align-items: center; text-align: center; }
    .info-wrapper { width: 100%; }
    .info-wrapper h1 { font-size: 2.5rem; }
    .tags-row, .stats-row { justify-content: center; }
    .hero-header h1 { font-size: 2.5rem; }
}

.play-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.play-btn:hover {
    background: var(--text-primary);
    color: var(--bg-main);
    transform: scale(1.1);
}

/* --- REPRODUCTOR AUDIO PROFESIONAL --- */
.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90px;
    background: rgba(22, 22, 22, 0.95);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(20px);
    z-index: 2000;
    transform: translateY(100%); /* Oculto inicialmente */
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
}

.player-bar.active {
    transform: translateY(0);
}

.player-content {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: relative;
    z-index: 2;
}

/* Info Track */
.track-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 30%;
}

.track-info img {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.track-text h4 {
    font-size: 0.95rem;
    margin: 0;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.track-text p {
    font-size: 0.8rem;
    margin: 0;
    color: var(--text-secondary);
}

/* Controles Centrales */
.player-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.control-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
}

.control-btn:hover { color: var(--text-primary); }

.play-btn-large {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--text-primary);
    color: var(--bg-main);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.play-btn-large:hover { transform: scale(1.1); }

/* Barra Progreso y Extras */
.player-extras {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 30%;
    justify-content: flex-end;
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-grow: 1;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

input[type="range"] {
    -webkit-appearance: none;
    background: transparent;
    width: 100%;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 12px;
    width: 12px;
    border-radius: 50%;
    background: var(--text-primary);
    margin-top: -4px; /* Centrar verticalmente */
    opacity: 0;
    transition: opacity 0.2s;
}

.progress-container:hover input[type="range"]::-webkit-slider-thumb {
    opacity: 1;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100px;
}

/* Animación de entrada */
@media (max-width: 768px) {
    .player-bar { height: 120px; }
    .player-content { flex-direction: column; padding: 1rem; }
    .track-info, .player-extras, .player-controls { width: 100%; justify-content: center; }
    .player-extras { display: none; } /* Ocultar volumen en móvil para ahorrar espacio */
}


/* =========================
   MOBILE OPTIMIZATION
   ========================= */
@media (max-width: 600px) {

    /* GENERAL SPACING */
    body {
        font-size: 0.95rem;
    }

    nav {
        padding: 0.75rem 1rem;
        flex-direction: column;
        gap: 0.75rem;
    }

    .logo {
        font-size: 1.1rem;
    }

    .search-container {
        width: 100%;
    }

    /* HERO */
    #suggestions-view {
        padding: 2rem 1rem;
    }

    .hero-header {
        margin-bottom: 2rem;
    }

    .hero-header h1 {
        font-size: 2rem;
        letter-spacing: -0.5px;
    }

    .hero-header p {
        font-size: 1rem;
    }

    /* GRID CARDS */
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .artist-card h3 {
        font-size: 0.9rem;
    }

    /* ARTIST HEADER */
    .artist-header {
        padding: 2rem 1rem;
    }

    .img-wrapper {
        width: 160px;
        height: 160px;
    }

    .info-wrapper h1 {
        font-size: 2rem;
        letter-spacing: -1px;
    }

    .stats-row {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    /* LAYOUT GRID */
    .layout-grid {
        padding: 0 1rem;
        gap: 2rem;
    }

    /* TRACKS */
    .tracks-header {
        grid-template-columns: 30px 1fr 70px;
        font-size: 0.65rem;
    }

    .track-item {
        grid-template-columns: 30px 1fr 70px;
        padding: 0.6rem 0.5rem;
    }

    .track-name {
        font-size: 0.9rem;
    }

    .track-plays {
        font-size: 0.8rem;
    }

    /* SIMILAR GRID */
    .similar-grid-layout {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }

    .similar-card p {
        font-size: 0.75rem;
    }

    /* PLAYER */
    .player-bar {
        height: 110px;
    }

    .player-content {
        padding: 0.75rem;
    }

    .track-info img {
        width: 48px;
        height: 48px;
    }

    .track-text h4 {
        font-size: 0.85rem;
    }

    .track-text p {
        font-size: 0.7rem;
    }

    .player-controls {
        gap: 1rem;
    }

    .play-btn-large {
        width: 40px;
        height: 40px;
    }

    /* Para que el player no tape contenido */
    main {
        padding-bottom: 140px;
    }

}

