/* ---------------------------- */
/* Variables para temas */
/* ---------------------------- */
:root {
    --background-color: #f5f5dc;
    --text-color: #222;
    --header-bg: #333;
    --footer-bg: #333;
    --highlight-color: #ffdf00;
}

body.dark-mode {
    --background-color: #222;
    --text-color: #f5f5dc;
    --header-bg: #444;
    --footer-bg: #444;
    --highlight-color: #ffc107;
}

body.no-scroll {
    overflow: hidden;
}

/* ---------------------------- */
/* Estilos generales */
/* ---------------------------- */
body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    /*overflow-x: hidden;  Evitar scroll horizontal */
}

h1, h2, h3, h4, .header h1 {
    font-family: 'Caveat', cursive;
    color: var(--text-color);
}

/* ---------------------------- */
/* Estilos del header */
/* ---------------------------- */
.header {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5em;
    position: relative;
}

.header .highlight {
    font-weight: 700;
    position: relative;
    color: var(--text-color);
}

.header .highlight::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    bottom: 20%;
    background-color: var(--highlight-color);
    z-index: -1;
    transform: rotate(-2deg);
    padding: 0 5px;
}

.subtitle {
    margin: 0;
    font-size: 14px;
    color: gray;
    padding-top: 0px; /* Space between header and subtitle */
}

/* ---------------------------- */
/* Estilos del main content */
/* ---------------------------- */
#main-content { 
    display: flex;
    flex-direction: column;
    /* align-items: center; */ /* Eliminado */
}

#visualization {
    width: 100%;
    display: flex;
    flex-direction: column;
    /* align-items: center; */ /* Eliminado */
}

#chart {
    padding-top: 70px; /* Evitar solapamiento con la barra de búsqueda fija */
    padding-bottom: 40px;
    overflow-x: auto; /* Permitir desplazamiento horizontal */
    flex-shrink: 0; /* Evitar que el gráfico se reduzca */
}

/* Estilos personalizados de la barra de desplazamiento (opcional) */
#chart::-webkit-scrollbar {
    height: 10px; /* Ajustado para ser más visible */
    width: 10px;
}

#chart::-webkit-scrollbar-track {
    background: transparent;
}

#chart::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

#chart::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.5);
}


/* ---------------------------- */
/* Estilos de la barra de búsqueda */
/* ---------------------------- */
/* Contenedor de búsqueda */
#search-container {
    position: relative; /* Relative to its parent container */
    margin: 20px auto; /* Center horizontally with margin on top and bottom */
    text-align: center; /* Center align the content inside */
    width: 100%; /* Take full width of its container */
    max-width: 800px; /* Limit maximum width */
}



/* Estilo del input de búsqueda */
#song-search {
    width: 100%; /* Ocupa todo el ancho del contenedor */
    max-width: 400px;
    padding: 10px;
    font-size: 16px;
    border: none;
    border-bottom: 2px solid #ccc; /* Solo línea debajo */
    outline: none;
    color: var(--text-color);
    background-color: transparent;
    text-align: center;
    transition: border-color 0.3s ease;
}

#song-search:focus {
    border-bottom-color: var(--highlight-color); /* Cambia el color al enfocar */
}

/* Estilo del botón para limpiar búsqueda */
#clear-button {
    margin-left: 10px;
    cursor: pointer;
    font-size: 18px;
    color: #888;
    position: absolute; /* Fijado dentro del contenedor */
    right: calc(50% - 200px); /* Ajustado al lado del input */
    top: 50%;
    transform: translateY(-50%);
    transition: color 0.3s ease;
}

#clear-button:hover {
    color: var(--highlight-color);
}

/* Contenedor de sugerencias (autocompletado) */
#autocomplete-suggestions {
    position: absolute;
    top: calc(100% + 5px); /* Justo debajo del buscador */
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    max-height: 200px;
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: none;
}

#autocomplete-suggestions.show {
    display: block;
    opacity: 1;
}

.suggestion-item {
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: left; /* Alineado a la izquierda */
}

.suggestion-item:hover {
    background-color: #fff2cc;
}


/* ---------------------------- */
/* Estilos del tooltip */
/* ---------------------------- */
.tooltip {
    position: absolute;
    background: rgba(245, 245, 245, 0.9);
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    color: #333;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    max-width: 200px;
}

.tooltip-title {
    font-size: 16px;
    font-weight: bold;
    color: #222;
    margin-bottom: 4px;
}

.tooltip-subtitle {
    font-size: 14px;
    color: #555;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
}

.tooltip-icon {
    margin-right: 6px;
    font-size: 14px;
    color: #555;
    vertical-align: middle;
}

.tooltip-details {
    font-size: 14px;
    color: #333;
}

.tooltip-details strong {
    font-size: 16px;
    color: #222;
}

.tooltip-details span {
    font-size: 12px;
    color: #777;
}

/* ---------------------------- */
/* Estilos de los círculos y líneas */
/* ---------------------------- */
circle {
    opacity: 0.8;
    stroke: none;
    fill: #FFD700;
    transition: none;
}

circle:hover {
    stroke: #000;
    stroke-width: 2px;
}

circle.selected {
    stroke: blue;
    stroke-width: 2px;
}

.set-circle {
    fill: #FFD700;
}

.encore-circle {
    fill: #87CEEB;
}

.cover-label {
    pointer-events: none;
}

.song-line {
    stroke: gray;
    stroke-width: 2;
}

.vertical-line {
    stroke: gray;
    stroke-width: 2px;
    opacity: 1;
    transition: opacity 0.3s ease;
}


.song-lines {
    opacity: 0;
}

/* ---------------------------- */
/* Estilos de etiquetas y leyendas */
/* ---------------------------- */
.legend {
    font-size: 14px;
    font-weight: bold;
}

.legend-label {
    fill: #333;
}

.legend-label.set-circle {
    fill: #FFD700;
}

.legend-label.encore-circle {
    fill: #87CEEB;
}

.concert-name {
    font-size: 13px;
    fill: #333;
    font-family: 'Caveat', sans-serif;
}

.concert-name:hover {
    font-size: 16px;
    font-weight: bold;
}

/* ---------------------------- */
/* Estilos del footer */
/* ---------------------------- */
.footer {
    background-color: var(--footer-bg);
    color: #fff;
    padding: 40px 20px;
}

.footer-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    text-align: center;
}

.footer-section {
    max-width: 200px;
    margin: 10px;
}

.footer-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    font-family: 'Caveat', sans-serif;
    font-weight: bold;
    color: var(--highlight-color);
}

.footer-section p,
.footer-section a {
    font-size: 14px;
    color: #ccc;
    font-family: 'Roboto', sans-serif;
    text-decoration: none;
}

.footer-section a:hover {
    color: var(--highlight-color);
}

.footer .social-icons {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.footer .social-icons i {
    font-size: 24px;
    margin: 0 10px;
    color: #ccc;
    transition: color 0.3s ease;
}

.footer .social-icons i:hover {
    color: var(--highlight-color);
}

/* ---------------------------- */
/* Estilos adicionales */
/* ---------------------------- */
.tour-label {
    font-family: 'Caveat', sans-serif;
    font-size: 18px;
    fill: gray;
    cursor: pointer;
    transition: none;
}

.tour-label.selected {
    fill: black;
    font-weight: bold;
}

.tour-label-arrow {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    color: black;
    position: absolute;
    white-space: nowrap;
}

#tour-label-arrow::after {
    content: "→";
    margin-left: 5px;
}

.tour-horizontal-line {
    stroke: gray; /* Default gray for non-highlighted lines */
    stroke-width: 2px;
    opacity: 0.5; /* Dim for non-highlighted lines */
    transition: stroke 0.3s, opacity 0.3s, stroke-width 0.3s; /* Smooth transitions */
}

.tour-horizontal-line.selected {
    stroke: red; /* Red for highlighted lines */
    stroke-width: 3px;
    opacity: 1;
}


.rank-label,
.song-label,
.score-label {
    font-size: 12px;
    fill: #333;
    transition: font-size 0.2s ease, font-weight 0.2s ease;
}

.bar {
    fill: #9d9d9d;
    transition: fill 0.2s ease, stroke-width 0.2s ease;
}

.bar-background {
    fill: #e0e0e0;
}

.bar-group:hover .bar {
    fill: #1f77b4;
  
}

.bar-group:hover .rank-label,
.bar-group:hover .song-label,
.bar-group:hover .score-label {
    font-size: 14px;
    font-weight: bold;
}

.bar-group.selected .bar {
    fill: #1f77b4;
    stroke: black;
    stroke-width: 2px;
}

.bar-group.selected .rank-label,
.bar-group.selected .song-label,
.bar-group.selected .score-label {
    font-size: 14px;
    font-weight: bold;
    fill: black;
}

.chart-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.chart-container.expanded {
    max-height: none;
    overflow: visible;
}

#tab-container {
    display: flex;
    justify-content: space-around;
    background-color: #f3f3f3;
    border-radius: 5px;
    padding: 5px;
    margin-bottom: 10px;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    cursor: pointer;
    font-size: 14px;
    color: #666;
}

.tab.active {
    background-color: #ffffff;
    color: #000;
    border-radius: 5px;
}

.tour-title {
    font-size: 14px;
    font-weight: bold;
    fill: #333;
    margin-left: 60px;
}

/* Popup Container */
#popup {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--popup-width, 550px); /* Default width, adjustable via CSS variable */
    height: 100vh; /* Full height */
    background-color: rgba(245, 245, 245, 0.95); /* Light semi-transparent background */
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.3); /* Subtle shadow for depth */
    overflow-y: auto; /* Enable vertical scrolling */
    display: none; /* Start hidden */
    flex-direction: column;
    padding: 20px;
    z-index: 1000;
}

/* Visibility classes for Popup */
#popup.hidden {
    display: none !important;
}

#popup.visible {
    display: flex !important;
}

/* Toggle Button */
#toggle-popup {
    position: fixed;
    top: 20px; /* Distance from the top of the viewport */
    right: 20px; /* Distance from the right of the viewport */
    width: 50px;
    height: 50px;
    background-color: #333; /* Dark background */
    color: white; /* White text */
    border: none; /* Remove default border */
    border-radius: 50%; /* Make it circular */
    font-size: 24px; /* Increase font size for visibility */
    cursor: pointer; /* Pointer cursor for interactivity */
    z-index: 1000; /* Place above other elements */
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2); /* Add shadow for depth */
    transition: background-color 0.3s ease; /* Smooth hover transition */
}

#toggle-popup:hover {
    background-color: #555; /* Change background color on hover */
}

/* Close Button Inside Popup */
#popup button#close-popup {
    align-self: flex-end; /* Align close button to the right */
    padding: 10px 20px;
    font-size: 1em;
    color: #fff;
    background-color: var(--highlight-color, #ffc107); /* Highlight color for button */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#popup button#close-popup:hover {
    background-color: #e0a800; /* Slightly darker on hover */
}

/* Content inside the popup */
#popup h2 {
    font-size: 1.5em;
    margin-bottom: 20px;
    color: var(--text-color);
}

#popup-chart {
    width: 100%;
    overflow-x: auto; /* Allow horizontal scrolling for wide content */
}

/* ---------------------------- */
/* Estilos para dispositivos móviles */
/* ---------------------------- */
@media (max-width: 768px) {
    body {
        font-size: 14px;
        line-height: 1.5;
    }

    .header h1 {
        font-size: 1.8em;

    }

    .subtitle {
        margin: 0; /* Remove any unnecessary margins */
        padding-top: 0px; /* Adjust the space between header and subtitle */
        font-size: 14px;
        color: gray;
        text-align: center; /* Ensure it's centered */
    }
    
    .footer-section h3 {
        font-size: 16px;
    }

    .footer-section p,
    .footer-section a {
        font-size: 12px;
    }

    #main-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        height: calc(100vh - 100px); /* Ajustar según la altura del header/footer */
        overflow-y: auto; /* Allow vertical scrolling */

    }

    #visualization {
        width: 100%;
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    #chart {
        display: flex;
        flex-direction: column;
        width: 90%;
        flex-grow: 1;
        overflow-y: auto; /* Allow vertical scrolling */
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        
    }

    #search-container {

        z-index: 1000; /* Ensure it stays above other elements */
    }
    

    #song-search {
        width: 100%; /* Occupy the full container */
        font-size: 16px; /* Adjust for readability */
    }


    #popup {
        width: 100vw;
        max-width: none;
        padding: 10px;
    }

    #popup h2 {
        font-size: 1.2em;
    }

    #popup-chart {
        width: 100%;
        overflow-x: auto;
    }

    #toggle-popup {
        width: 40px;
        height: 40px;
        top: 10px;
        right: 10px;
        font-size: 20px;
    }

    
}
