/* =========================================
   1. VARIABLES Y BASE
   ========================================= */
   :root {
    --bg-color: #000000;
    --card-bg: #1c1c1e;
    --accent-color: #34c759;
    --text-main: #ffffff;
    --text-dim: #8e8e93;
    --danger: #ff453a;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

/* =========================================
   2. CONTENEDOR PRINCIPAL
   ========================================= */
#controls {
    width: 100%;
    max-width: 450px;
    background: var(--card-bg);
    padding: 24px;
    border-radius: 40px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.7);
    transition: max-width 0.3s ease;
}

/* =========================================
   3. REPRODUCTOR Y TIMERS
   ========================================= */
.timer {
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 5px;
}

#currentPlay {
    display: block;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 20px;
}

progress {
    width: 100%;
    height: 8px;
    appearance: none;
    border: none;
    background: #3a3a3c;
    border-radius: 10px;
}
progress::-webkit-progress-value { background: var(--accent-color); border-radius: 10px; }
progress::-webkit-progress-bar { background: #3a3a3c; border-radius: 10px; }

.main-controls {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    margin: 25px 0;
}

.main-controls i { cursor: pointer; transition: transform 0.1s; }
.main-controls i:active { transform: scale(0.9); }

/* =========================================
   4. TARJETAS Y SECCIONES
   ========================================= */
.loop-master-container, .gestion-playlist {
    background: #2c2c2e;
    padding: 20px;
    border-radius: 28px;
    margin-top: 20px;
}

small {
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: block;
    margin-bottom: 15px;
}

/* =========================================
   5. BOTONES E INPUTS
   ========================================= */
.btn-loop {
    background: #3a3a3c;
    color: white;
    padding: 15px;
    border: none;
    border-radius: 16px;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
}

.btn-apply-manual {
    background: var(--accent-color);
    color: black;
    width: 100%;
    padding: 18px;
    border: none;
    border-radius: 18px;
    font-size: 1.1rem;
    font-weight: 800;
    margin-top: 15px;
    cursor: pointer;
}

.manual-inputs {
    display: flex;
    gap: 10px;
    justify-content: center;
    background: #1c1c1e;
    padding: 15px;
    border-radius: 20px;
}

.manual-inputs input {
    width: 65px;
    height: 50px;
    background: #3a3a3c;
    border: 2px solid transparent;
    border-radius: 12px;
    color: white;
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
}

/* =========================================
   6. SLIDERS UNIFICADOS (BPM, VOL, VEL)
   ========================================= */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #3a3a3c;
    border-radius: 10px;
    outline: none;
    margin: 15px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #1c1c1e;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.2);
}

.volume-container, .speed-container, .bpm-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

/* =========================================
   7. METRÓNOMO Y AFINADOR
   ========================================= */
.bpm-box {
    text-align: center;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#bpm-display { font-size: 4rem; font-weight: 800; }

#beat-indicators {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    min-height: 20px;
}

.beat-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3a3a3c;
    transition: all 0.1s ease;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

.metronome-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#canvas-wave {
    width: 100%;
    height: 100px;
    background: #1c1c1e;
    border: 1px solid #3a3a3c;
    border-radius: 15px;
    margin-top: 10px;
}

/* =========================================
   8. RESPONSIVIDAD PC
   ========================================= */
@media (min-width: 768px) {
    #controls {
        max-width: 800px;
        padding: 40px;
    }

    .timer { font-size: 4rem; }

    .manual-inputs input {
        width: 80px;
        height: 60px;
        font-size: 1.5rem;
    }

    .btn-loop:hover, .btn-apply-manual:hover {
        filter: brightness(1.2);
    }
}


/* Contenedor de pestañas de listas */
#selectorListas {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #3a3a3c;
}

.btn-lista-tab {
    background: #2c2c2e;
    color: var(--text-dim);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    white-space: nowrap;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
}

.btn-lista-tab.active {
    background: var(--accent-color);
    color: black;
}

/* Lista de canciones */
#playList {
    list-style: none;
    padding: 0;
    margin: 0;
}

#playList li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #2c2c2e;
    margin-bottom: 8px;
    border-radius: 12px;
    transition: 0.2s;
}

#playList li:hover {
    background: #3a3a3c;
}

#playList li span {
    flex: 1;
    cursor: pointer;
    font-weight: 500;
}

/* Botones de borrar */
.btn-delete {
    color: #ff453a;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    opacity: 0.6;
    transition: 0.3s;
}

.btn-delete:hover {
    opacity: 1;
    transform: scale(1.2);
}

.playlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.biblioteca-controles {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center;
}

.input-moderno {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    border: none;
    background: #1c1c1e;
    color: white;
    font-size: 0.9rem;
    outline: none;
}

.btn-action {
    background: #3a3a3c;
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.btn-action:hover {
    background: #4a4a4c;
    transform: translateY(-2px);
}

.btn-action.primary {
    background: var(--accent-color);
    color: black;
}

.btn-action i {
    font-size: 1.1rem;
}

/* Añade esto a tu CSS */
#playList li.session-broken {
    opacity: 0.6;
}
#playList li.session-broken i {
    color: #ff9500; /* Naranja indicando que necesita atención */
}

/* Canciones que necesitan ser cargadas de nuevo tras refrescar */
li.session-broken {
    border-left: 3px solid #ff9500; /* Borde naranja de aviso */
    opacity: 0.7;
}

li.session-broken span {
    color: #ff9500;
}

li.session-broken:hover {
    opacity: 1;
    background: #3a3a3c;
}

.btn-micro-off {
    background: #3a3a3c;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
}

.btn-micro-on {
    background: var(--danger);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(255, 69, 58, 0.4);
}

@keyframes zumbido {
    0% { transform: translate(0, 0); }
    25% { transform: translate(1px, -1px); }
    50% { transform: translate(-1px, 1px); }
    75% { transform: translate(1px, 1px); }
    100% { transform: translate(0, 0); }
}

.zumbando {
    animation: zumbido 0.1s infinite;
    color: #ffcc00 !important; /* Cambia a un color vibrante al sonar */
}

.loop-controls-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.btn-action {
    flex: 1; /* Esto hace que ambos midan lo mismo */
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.3s;
}

.btn-action:hover {
    filter: brightness(1.2);
}

/* Contenedor principal de la biblioteca */
.library-section {
    background: rgba(44, 44, 46, 0.4);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Encabezado y botones de acción */
.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.library-actions {
    display: flex;
    gap: 10px;
}

.library-actions button {
    background: #3a3a3c;
    color: white;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.library-actions button:hover {
    background: var(--accent-color); /* El color verde/azul que uses */
    transform: translateY(-2px);
}

.btn-delete-list:hover {
    background: #ff453a !important; /* Rojo para borrar */
}

/* Pestañas de las Listas/Carpetas */
.selector-listas {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    overflow-x: auto;
    padding-bottom: 5px;
}

/* Estilo de cada pestaña */
.btn-lista-tab {
    background: rgba(255, 255, 255, 0.05);
    color: #ebebf5;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-lista-tab.active {
    background: var(--accent-color);
    color: #000;
    font-weight: bold;
    border-color: var(--accent-color);
}

/* Lista de canciones */
.playlist-container li {
    background: rgba(255, 255, 255, 0.03);
    margin-bottom: 5px;
    padding: 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.playlist-container li:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Contenedor que mantiene la proporción 16:9 */
.video-responsive {
    position: relative;
    padding-bottom: 56.25%; /* Proporción 16:9 (9 / 16 = 0.5625) */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: #000;
    border-radius: 12px; /* Opcional: para que combine con tu diseño */
}

/* Forzamos al iframe de YouTube a ocupar todo el contenedor */
.video-responsive iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: 0;
}

/* Ajuste para móviles en tu contenedor principal #controls */
@media (max-width: 480px) {
    #controls {
        padding: 15px; /* Menos padding para ganar espacio */
        border-radius: 20px;
    }
    
    .main-controls i {
        font-size: 3rem; /* Iconos un poco más pequeños para que quepan */
    }
}

.note-sharp { color: var(--danger); }
.note-flat { color: #ffcc00; }
.note-perfect { color: var(--accent-color); text-shadow: 0 0 10px var(--accent-color); }

/* Centrar el contenido en la landing */
.landing-page .landing-container {
    margin: auto;
    display: flex;
    flex-direction: column;
}

.feature-item h3 {
    color: var(--text-main);
}