* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    max-width: 100%;
}

html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2d5a27 0%, #4a7c59 50%, #5fb3a3 100%);
    min-height: 100vh;
    padding: 8px;
    margin: 0;
    /* Evitar scroll horizontal */
    overflow-x: hidden;
    width: 100%;
    /* Mejorar experiencia táctil en móviles */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Permitir selección de texto solo donde sea necesario */
.song-title, .song-artist, .song-card-title, .song-card-artist, p {
    -webkit-user-select: text;
    user-select: text;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    /* Asegurar que el contenedor no exceda el viewport */
    width: calc(100% - 16px);
    box-sizing: border-box;
}

header {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 20px;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.header-text {
    text-align: center;
}

.header-text h1 {
    font-size: 2.2em;
    margin-bottom: 8px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header-text p {
    font-size: 1.1em;
    opacity: 0.9;
}

.search-section {
    padding: 20px;
    background: #f8f9fc;
    border-bottom: 1px solid #e9ecef;
}

.search-container {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

#searchInput {
    flex: 1;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    outline: none;
    transition: all 0.3s ease;
    min-width: 0; /* Permite que se contraiga en móviles */
}

#searchInput:focus {
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

#searchBtn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 16px;
    white-space: nowrap; /* Evita que el botón se rompa en líneas */
}

#searchBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.4);
}

/* Estilos específicos para dispositivos táctiles */
#searchBtn:active, .propose-btn:active, .vote-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

/* Mejorar área de toque para botones pequeños */
.propose-btn, .vote-btn {
    min-height: 44px; /* Tamaño mínimo recomendado para móviles */
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 15px;
    background: white;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.song-result {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.song-result:hover {
    background: #f8f9fc;
    transform: translateX(5px);
}

.song-result:last-child {
    border-bottom: none;
}

.song-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    margin-right: 15px;
    object-fit: cover;
}

.song-info {
    flex: 1;
}

.song-title {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    margin-bottom: 5px;
}

.song-artist {
    color: #666;
    font-size: 14px;
}

.propose-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #16a085, #1abc9c);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.propose-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(22, 160, 133, 0.4);
}

.proposed-songs {
    padding: 20px;
}

.songs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.proposed-songs h2 {
    color: #333;
    margin: 0;
    font-size: 1.6em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-stats-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
}

.user-stats-indicator.available {
    background: linear-gradient(135deg, #e8f5e8, #d4edda);
    color: #155724;
    border: 1px solid #c3e6cb;
}

.user-stats-indicator.warning {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    color: #856404;
    border: 1px solid #ffeaa7;
}

.user-stats-indicator.full {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.admin-mode-indicator {
    background: linear-gradient(135deg, #ff6b6b, #ee5a5a);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
    animation: adminPulse 2s ease-in-out infinite;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

@keyframes adminPulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3); }
    50% { box-shadow: 0 4px 15px rgba(255, 107, 107, 0.6); }
}

.songs-queue {
    display: grid;
    gap: 12px;
}

.song-card {
    background: white;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 10px 12px;
    transition: all 0.3s ease;
    border-left: 4px solid #27ae60;
    min-height: 80px;
    /* Asegurar ancho completo sin overflow */
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.song-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.song-card.top-voted {
    border-left-color: #16a085;
    background: linear-gradient(135deg, #e8f8f5, #ffffff);
}

/* Columna izquierda: Número + Imagen */
.song-left-column {
    grid-column: 1;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.song-position {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
    transition: all 0.3s ease;
}

/* Estilo especial para administradores - número clickeable */
.song-position.admin-deletable {
    cursor: pointer;
    position: relative;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}

.song-position.admin-deletable:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #c0392b, #a93226);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.6);
}

.song-position.admin-deletable::after {
    content: "🗑️";
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 12px;
    background: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.song-position.admin-deletable:hover::after {
    opacity: 1;
}

.song-card.top-voted .song-position {
    background: linear-gradient(135deg, #16a085, #1abc9c);
}

/* Columna derecha: Info de la canción */
.song-right-column {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* Permite text overflow */
    overflow: hidden; /* Evita overflow horizontal */
}

/* Fila inferior: Información adicional y votos */
.song-bottom-section {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    overflow: hidden;
}

.song-card-image {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative; /* Necesario para overlays */
}

/* Estilo para imagen clickeable (solo administradores) */
.song-card-image.clickable-image.admin-playlist {
    cursor: pointer;
    position: relative;
}

.song-card-image.clickable-image.admin-playlist:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
    border: 2px solid #27ae60;
}

.song-card-image.clickable-image.admin-playlist:active {
    transform: scale(0.98);
}

/* Indicador visual para usuarios no admin */
.song-card-image:not(.admin-playlist) {
    opacity: 0.9;
}

.song-card-image:not(.admin-playlist):hover {
    opacity: 0.7;
    cursor: help;
}

/* Icono de Spotify en hover (solo para admins) */
.song-card-image.clickable-image.admin-playlist::after {
    content: '\f1bc'; /* Icono de Spotify de FontAwesome */
    font-family: 'Font Awesome 5 Brands';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #1DB954;
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.song-card-image.clickable-image.admin-playlist:hover::after {
    opacity: 1;
}

/* Icono de "admin only" para usuarios regulares */
.song-card-image:not(.admin-playlist)::before {
    content: '\f505'; /* Icono de candado de FontAwesome */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    bottom: 2px;
    right: 2px;
    color: #95a5a6;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

.song-card-title {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    margin-bottom: 2px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.song-card-artist {
    color: #666;
    font-size: 13px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.song-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #888;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.song-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.vote-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    max-width: 180px; /* Aumentar ancho para acomodar botón de eliminar */
}

.vote-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.vote-btn {
    background: linear-gradient(135deg, #16a085, #1abc9c);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 32px;
    white-space: nowrap;
}

.vote-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(22, 160, 133, 0.4);
}

.vote-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.delete-btn {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.delete-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.delete-btn:active {
    transform: scale(0.95);
}

.vote-count {
    background: #e8f8f5;
    padding: 6px 10px;
    border-radius: 16px;
    font-weight: 600;
    color: #27ae60;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    min-height: 32px;
}

/* ============================
   ESTILOS PARA CANCIONES PROPUESTAS POR EL USUARIO
   ============================ */

.song-card.user-proposed {
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f9f0 100%);
    border: 2px solid #4CAF50;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.2);
    position: relative;
    overflow: hidden;
}

.song-card.user-proposed::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4CAF50, #8BC34A, #4CAF50);
    animation: userProposedShimmer 3s ease-in-out infinite;
}

@keyframes userProposedShimmer {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.song-card.user-proposed:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3);
}

.song-card.user-proposed .song-position {
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: white;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
}

.user-proposed-badge {
    display: inline-block;
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 8px;
    animation: userBadgePulse 2s ease-in-out infinite;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.3);
}

@keyframes userBadgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Si la canción es tanto top-voted como propuesta por el usuario */
.song-card.user-proposed.top-voted {
    background: linear-gradient(135deg, #fff3cd 0%, #f9f7d9 50%, #e8f5e8 100%);
    border: 2px solid #FFD700;
}

.song-card.user-proposed.top-voted::before {
    background: linear-gradient(90deg, #FFD700, #4CAF50, #FFD700);
}

.song-card.user-proposed.top-voted .song-position {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: #333;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #27ae60;
}

.loading-spinner i {
    font-size: 3em;
    margin-bottom: 15px;
}

/* Estado vacío */
.no-songs, .no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.no-songs i {
    display: block;
    font-size: 3em;
    color: #ccc;
    margin-bottom: 15px;
}

.no-results {
    padding: 20px;
    font-style: italic;
}

.message-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.message {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    transform: translateX(300px);
    opacity: 0;
    transition: all 0.3s ease;
    border-left: 4px solid #27ae60;
}

.message.show {
    transform: translateX(0);
    opacity: 1;
}

.message.error {
    border-left-color: #ff6b6b;
    background: #fff5f5;
}

.message.success {
    border-left-color: #27ae60;
    background: #e8f8f5;
}

/* Responsive Design para Móviles */

/* Desktop/Tablet - Mantener layout original en grid */
@media (min-width: 769px) {
    .song-card {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 10px 12px;
    }
    
    .song-left-column {
        grid-column: 1;
        grid-row: 1 / -1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .song-right-column {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-width: 0;
    }
    
    .song-bottom-section {
        grid-column: 1 / -1;
        grid-row: 2;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .vote-section {
        display: flex;
        align-items: center;
        gap: 8px;
    }
}

/* Tablets y pantallas medianas */
@media (max-width: 768px) {
    body {
        padding: 4px;
        overflow-x: hidden;
    }
    
    .container {
        margin: 4px;
        border-radius: 15px;
        width: calc(100% - 8px);
    }
    
    .header-text h1 {
        font-size: 1.8em;
    }
    
    .header-text p {
        font-size: 1em;
    }
    
    .logo {
        width: 60px;
        height: 60px;
    }
    
    .search-section {
        padding: 15px;
    }
    
    .proposed-songs {
        padding: 15px;
    }
    
    .proposed-songs h2 {
        font-size: 1.4em;
    }
    
    .song-card {
        grid-template-columns: auto 1fr;
        gap: 8px 10px;
        padding: 10px;
        width: 100%;
        max-width: 100%;
    }
    
    .song-left-column {
        gap: 6px;
    }
    
    .song-position {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .song-card-image {
        width: 45px;
        height: 45px;
    }
    
    .song-bottom-section {
        gap: 6px;
    }
    
    .vote-section {
        gap: 6px;
    }
}

/* Móviles pequeños */
@media (max-width: 480px) {
    body {
        padding: 2px;
        overflow-x: hidden;
    }
    
    .container {
        margin: 2px;
        border-radius: 10px;
        width: calc(100% - 4px);
    }
    
    header {
        padding: 15px;
    }
    
    .logo-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo {
        width: 50px;
        height: 50px;
    }
    
    .header-text h1 {
        font-size: 1.5em;
        margin-bottom: 5px;
    }
    
    .header-text p {
        font-size: 0.9em;
    }
    
    .search-section {
        padding: 10px;
    }
    
    .search-container {
        gap: 5px;
    }
    
    #searchInput {
        padding: 10px 12px;
        font-size: 14px;
    }
    
    #searchBtn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    .song-result {
        padding: 10px;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .song-image {
        width: 50px;
        height: 50px;
        margin-right: 0;
    }
    
    .song-info {
        flex: 1;
        min-width: 150px;
    }
    
    .song-title {
        font-size: 14px;
    }
    
    .song-artist {
        font-size: 12px;
    }
    
    .propose-btn {
        padding: 6px 12px;
        font-size: 12px;
        white-space: nowrap;
    }
    
    .proposed-songs {
        padding: 10px;
    }
    
    .proposed-songs h2 {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
    
    .song-card {
        padding: 8px;
        gap: 6px 8px;
        min-height: 70px;
        width: 100%;
        max-width: 100%;
    }
    
    .song-left-column {
        gap: 4px;
    }
    
    .song-position {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    
    .song-card-image {
        width: 40px;
        height: 40px;
    }
    
    .song-card-title {
        font-size: 13px;
        line-height: 1.2;
    }
    
    .song-card-artist {
        font-size: 11px;
    }
    
    .song-meta {
        display: flex;
        flex-direction: row;
        gap: 8px;
        font-size: 9px;
        color: #888;
        flex-wrap: wrap;
    }
    
    /* Reorganizar layout completo para móviles */
    .song-card {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px;
    }
    
    .song-left-column {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        flex: 1;
        min-width: 0;
    }
    
    .song-right-column {
        display: flex;
        flex-direction: column;
        flex: 1;
        min-width: 0;
        gap: 2px;
    }
    
    .song-bottom-section {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 8px;
        flex-shrink: 0;
    }
    
    .vote-section {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }
    
    .song-meta {
        order: 1;
    }
    
    .vote-btn {
        padding: 8px 12px;
        font-size: 11px;
        min-height: 32px;
        border-radius: 20px;
        white-space: nowrap;
    }
    
    .vote-count {
        padding: 4px 8px;
        font-size: 12px;
        min-height: 24px;
        border-radius: 12px;
        font-weight: bold;
    }
    
    .message-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .message {
        padding: 10px 15px;
        font-size: 14px;
        transform: translateY(-50px);
    }
    
    .message.show {
        transform: translateY(0);
    }
    
    .loading-spinner {
        padding: 20px;
    }
    
    .loading-spinner i {
        font-size: 2em;
    }
}

/* Móviles extra pequeños */
@media (max-width: 320px) {
    .header-text h1 {
        font-size: 1.3em;
    }
    
    .logo {
        width: 40px;
        height: 40px;
    }
    
    .search-container {
        flex-direction: column;
        gap: 8px;
    }
    
    #searchBtn {
        align-self: stretch;
    }
    
    .song-result {
        flex-direction: column;
        text-align: center;
    }
    
    .song-image {
        margin: 0 0 8px 0;
    }
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #219a52, #27ae60);
}

/* Estilos para información del usuario */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 15px;
    border-radius: 20px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-left: auto;
}

.user-info i {
    font-size: 16px;
    color: #ffffff;
}

/* Estilos para el Modal de Registro */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: white;
    margin: 5% auto;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

.modal-header {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: white;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #f1c40f;
}

.modal-body {
    padding: 25px;
}

.modal-description {
    color: #666;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
    line-height: 1.5;
}

.registration-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group input[type="text"],
.form-group input[type="tel"] {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
}

.form-group input[type="text"]:focus,
.form-group input[type="tel"]:focus {
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

.checkbox-group {
    margin: 10px 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    line-height: 1.4;
    font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    position: relative;
    flex-shrink: 0;
    transition: all 0.3s ease;
    margin-top: 2px;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-color: #27ae60;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-weight: bold;
    font-size: 12px;
}

.checkbox-text {
    color: #666;
    line-height: 1.4;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 10px;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #219a52, #27ae60);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
}

.btn-secondary {
    background: #f8f9fa;
    color: #666;
    border: 2px solid #e9ecef;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.registration-loading {
    text-align: center;
    padding: 30px;
    color: #666;
}

.registration-loading i {
    font-size: 2em;
    color: #27ae60;
    margin-bottom: 15px;
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        transform: translateY(-50px);
        opacity: 0;
    }
    to { 
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive para el modal */
@media (max-width: 480px) {
    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h2 {
        font-size: 1.2em;
    }
    
    .modal-body {
        padding: 20px 15px;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .user-info {
        font-size: 12px;
        padding: 6px 12px;
    }
}

/* ============================
   ESTILOS PARA MENÚ LATERAL DE ADMINISTRADOR
   ============================ */

.user-info {
    transition: all 0.3s ease;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
}

.user-info:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.user-info::after {
    content: "🚪";
    position: absolute;
    right: -25px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 12px;
}

.user-info:hover::after {
    opacity: 1;
}

/* Estilos para el logo cuando el usuario es administrador */
.logo.admin-logo {
    cursor: pointer !important;
    transition: all 0.3s ease;
    border-radius: 12px;
    padding: 4px;
}

.logo.admin-logo:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.8));
}

.logo-container.admin-container {
    position: relative;
}

.logo-container.admin-container::after {
    content: "👑";
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 20px;
    background: rgba(255, 215, 0, 0.9);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: adminGlow 2s ease-in-out infinite alternate;
}

@keyframes adminGlow {
    from {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    to {
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.6);
    }
}

.admin-sidebar {
    position: fixed;
    top: 0;
    left: -350px;
    width: 350px;
    height: 100vh;
    background: #ffffff;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.2);
    z-index: 9999; /* Z-index más alto */
    transition: left 0.3s ease-in-out;
    overflow-y: auto;
    display: block !important;
}

.admin-sidebar.open {
    left: 0 !important;
}

/* Botón temporal de debug */
.debug-admin-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 5px;
    z-index: 10000;
    cursor: pointer;
    font-size: 12px;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.sidebar-overlay.show {
    opacity: 1 !important;
    pointer-events: auto !important;
}

.sidebar-header {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.close-sidebar-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.close-sidebar-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.sidebar-content {
    padding: 20px;
}

.config-section {
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.config-section:last-child {
    border-bottom: none;
}

.config-section h4 {
    color: #27ae60;
    margin-bottom: 15px;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-item {
    margin-bottom: 15px;
}

.config-item label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.config-item input[type="number"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.config-item input[type="number"]:focus {
    outline: none;
    border-color: #27ae60;
}

.toggle-label {
    display: flex !important;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0 !important;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 24px;
    background-color: #ccc;
    border-radius: 12px;
    margin-right: 10px;
    transition: background-color 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: left 0.3s ease;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider {
    background-color: #27ae60;
}

.toggle-label input[type="checkbox"]:checked + .toggle-slider::before {
    left: 28px;
}

.admin-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
}

.admin-btn.primary {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
}

.admin-btn.primary:hover {
    background: linear-gradient(135deg, #229954, #27ae60);
    transform: translateY(-2px);
}

.admin-btn.danger {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
}

.admin-btn.danger:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-2px);
}

.admin-btn:not(.primary):not(.danger) {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    color: #495057;
}

.admin-btn:not(.primary):not(.danger):hover {
    background: #e9ecef;
    border-color: #dee2e6;
    transform: translateY(-2px);
}

.config-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Modal para usuarios */
.large-modal {
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.large-modal .modal-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.large-modal .users-table {
    flex: 1;
    margin-top: 15px;
    min-height: 200px;
}

.users-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-item {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    flex: 1;
    min-width: 120px;
}

.stat-number {
    display: block;
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
}

.users-table {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    overflow: hidden;
}

.table-scroll-container {
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
}

.users-data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.users-data-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: white;
}

.users-data-table th,
.users-data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    white-space: nowrap;
}

.users-data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #27ae60;
}

.users-data-table tbody tr:hover {
    background: #f8f9fa;
    cursor: pointer;
}

.users-data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Scrollbar personalizado para el contenedor de scroll */
.table-scroll-container::-webkit-scrollbar {
    width: 8px;
}

.table-scroll-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.table-scroll-container::-webkit-scrollbar-thumb {
    background: #27ae60;
    border-radius: 4px;
}

.table-scroll-container::-webkit-scrollbar-thumb:hover {
    background: #229954;
}

/* Indicador de scroll */
.scroll-indicator {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 8px 12px;
    text-align: center;
    font-size: 0.9em;
    border-radius: 6px 6px 0 0;
    margin-bottom: 0;
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.user-type-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
}

.user-type-badge.admin {
    background: #e74c3c;
    color: white;
}

.user-type-badge.user {
    background: #3498db;
    color: white;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 500;
}

.status-badge.active {
    background: #27ae60;
    color: white;
}

.status-badge.inactive {
    background: #95a5a6;
    color: white;
}

/* Responsive para el menú lateral */
@media (max-width: 768px) {
    .admin-sidebar {
        width: 300px;
        left: -300px;
    }
    
    .users-stats {
        flex-direction: column;
    }
    
    .stat-item {
        min-width: auto;
    }
    
    .large-modal {
        width: 98%;
        max-height: 95vh;
    }
    
    .table-scroll-container {
        max-height: 300px; /* Altura reducida en móviles */
    }
    
    .users-data-table th,
    .users-data-table td {
        padding: 8px 6px;
        font-size: 0.85em;
    }
    
    .logo-container.admin-container::after {
        font-size: 16px;
        width: 24px;
        height: 24px;
        top: -3px;
        right: -3px;
    }
    
    .scroll-indicator {
        font-size: 0.8em;
        padding: 6px 10px;
    }
    
    .user-proposed-badge {
        font-size: 9px;
        padding: 1px 6px;
        margin-left: 4px;
    }
    
    .vote-section {
        max-width: 160px;
        gap: 4px;
    }
    
    .vote-actions {
        gap: 4px;
    }
    
    .delete-btn {
        min-width: 28px;
        min-height: 28px;
        padding: 4px 6px;
        font-size: 10px;
    }
    
    .songs-header {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 10px;
    }
    
    .user-stats-indicator {
        justify-self: center;
        align-self: center;
        font-size: 0.8em;
        padding: 6px 10px;
    }
    
    .song-position.admin-deletable::after {
        font-size: 10px;
        width: 16px;
        height: 16px;
        top: -6px;
        right: -6px;
    }
    
    .admin-mode-indicator {
        font-size: 0.75em;
        padding: 6px 10px;
        text-align: center;
        width: 100%;
        order: -1; /* Mover arriba en móviles */
    }
}

/* ============================================
   ESTILOS PARA SELECTOR DE PLAYLISTS
   ============================================ */

.playlist-selector {
    margin: 20px 0;
}

.playlist-selector label {
    display: block;
    font-weight: 600;
    margin-bottom: 15px;
    color: #2c3e50;
}

.playlist-info {
    margin-bottom: 15px;
}

.playlist-description {
    background: #e8f5e8;
    border: 1px solid #c3e6c3;
    border-radius: 6px;
    padding: 12px;
    margin: 0;
    color: #155724;
    font-size: 0.9em;
    display: flex;
    align-items: center;
}

.playlist-description i {
    margin-right: 8px;
    color: #28a745;
}

.playlist-loading, .playlist-error {
    text-align: center;
    padding: 20px;
    border-radius: 8px;
    margin: 10px 0;
}

.playlist-loading {
    background: #f8f9fa;
    color: #6c757d;
}

.playlist-loading i {
    font-size: 1.2em;
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

.playlist-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.playlist-error .retry-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
}

.playlist-error .retry-btn:hover {
    background: #c82333;
}

/* Estilos para errores específicos de Spotify */
.spotify-error-container, .no-playlists-container {
    text-align: center;
    padding: 30px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.spotify-error-container i, .no-playlists-container i {
    font-size: 48px;
    color: #dc3545;
    margin-bottom: 15px;
    display: block;
}

.no-playlists-container i {
    color: #6c757d;
}

.spotify-error-container h4, .no-playlists-container h4 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #495057;
}

.spotify-error-container p, .no-playlists-container p {
    color: #6c757d;
    margin-bottom: 20px;
    line-height: 1.5;
}

.error-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.retry-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.retry-btn:hover {
    background: #c82333;
}

.spotify-link-btn {
    background: #1db954;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.spotify-link-btn:hover {
    background: #1ed760;
}

/* Estilos para mensajes de error amigables */
.friendly-error-container {
    text-align: center;
    padding: 30px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.friendly-error-container i {
    font-size: 48px;
    color: #6c757d;
    margin-bottom: 15px;
    display: block;
}

.friendly-error-container h4 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #495057;
    font-weight: 600;
}

.friendly-error-container p {
    color: #6c757d;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Ajustar iconos según el contexto */
.spotify-error-container i.fa-spotify {
    color: #1db954;
}

.no-playlists-container i.fa-music {
    color: #17a2b8;
}

.playlist-options {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px;
    background: #f8f9fa;
    /* Mejora el scrolling */
    scrollbar-width: thin;
    scrollbar-color: #ccc #f8f9fa;
}

.playlist-options::-webkit-scrollbar {
    width: 6px;
}

.playlist-options::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 3px;
}

.playlist-options::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.playlist-options::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.playlist-option {
    margin-bottom: 10px;
    position: relative;
}

.playlist-option:last-child {
    margin-bottom: 0;
}

.playlist-option input[type="radio"] {
    display: none;
}

.playlist-label {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 12px;
}

.playlist-label:hover {
    border-color: #27ae60;
    box-shadow: 0 2px 8px rgba(39, 174, 96, 0.1);
}

.playlist-option input[type="radio"]:checked + .playlist-label {
    border-color: #27ae60;
    background: #f0f8f4;
    box-shadow: 0 2px 12px rgba(39, 174, 96, 0.2);
}

.playlist-image {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    background: #e9ecef;
}

.playlist-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.playlist-info {
    flex: 1;
    min-width: 0;
}

.playlist-name {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-description {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.playlist-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: #868e96;
}

.track-count, .playlist-visibility {
    display: flex;
    align-items: center;
    gap: 4px;
}

.track-count::before {
    content: '\f001'; /* Icono de música */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
}

.playlist-visibility::before {
    content: '\f0c0'; /* Icono de público */
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
}

.playlist-option input[type="radio"]:checked + .playlist-label .playlist-visibility::before {
    content: '\f023'; /* Icono de privado si está seleccionado */
}

.no-playlists {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.no-playlists i {
    font-size: 2em;
    margin-bottom: 10px;
    display: block;
}

/* Responsive para selector de playlists */
@media (max-width: 768px) {
    .playlist-options {
        max-height: 250px;
    }
    
    .playlist-label {
        padding: 10px;
        gap: 10px;
    }
    
    .playlist-image {
        width: 40px;
        height: 40px;
    }
    
    .playlist-name {
        font-size: 13px;
    }
    
    .playlist-description {
        font-size: 11px;
    }
    
    .playlist-meta {
        gap: 8px;
        font-size: 10px;
    }
}

/* Estilos para información de origen de playlists */
.playlist-source-info {
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    font-size: 0.9em;
    font-weight: 500;
}

.playlist-source-info i {
    margin-right: 8px;
}

.playlist-source-info.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.playlist-source-info.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Estilos para badges de origen */
.source-badge {
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    margin-left: 8px;
    text-transform: uppercase;
}

.source-badge.user-playlist {
    background: #28a745;
    color: white;
}

.source-badge.default-playlist {
    background: #ffc107;
    color: #212529;
}

/* Mejora en el texto pequeño */
.small-text {
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 5px;
}

/* Advertencia de token expirado */
.token-warning {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
    padding: 10px 15px;
    margin: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    animation: slideIn 0.3s ease-out;
}

.token-warning-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.token-warning-content i {
    margin-right: 8px;
    font-size: 1.1em;
}

.refresh-token-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 5px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
}

.refresh-token-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.refresh-token-btn i {
    margin-right: 5px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer dividido en modal de Spotify */
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.footer-left {
    display: flex;
    gap: 10px;
}

.footer-right {
    display: flex;
    gap: 10px;
}

@media (max-width: 768px) {
    .modal-footer {
        flex-direction: column;
    }
    
    .footer-left,
    .footer-right {
        width: 100%;
        justify-content: center;
    }
}

/* ===============================================
   ESTILOS PARA MODAL DE PLAYLIST
   =============================================== */

/* Modal de playlist específico */
#playlistModal .modal-content {
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    /* Mejora el scrolling */
    scrollbar-width: thin;
    scrollbar-color: #ccc #f8f9fa;
}

#playlistModal .modal-content::-webkit-scrollbar {
    width: 8px;
}

#playlistModal .modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#playlistModal .modal-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

#playlistModal .modal-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

#playlistModal .modal-body {
    flex: 1;
    overflow-y: auto;
    max-height: calc(90vh - 120px); /* Resta altura del header */
}

/* Información del Usuario de Spotify */
.spotify-user-info {
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #1db954 0%, #1ed760 100%);
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 15px rgba(29, 185, 84, 0.3);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    position: relative;
    flex-shrink: 0;
}

.user-image {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

.user-status {
    position: absolute;
    bottom: -5px;
    right: -5px;
    background: #fff;
    color: #1db954;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 3px;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.user-email {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.user-stats {
    display: flex;
    gap: 15px;
    font-size: 12px;
}

.user-stats .stat {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(255, 255, 255, 0.9);
}

.user-actions {
    flex-shrink: 0;
}

.spotify-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.spotify-link:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.spotify-user-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #6c757d;
    font-size: 14px;
}

.spotify-user-loading i {
    color: #1db954;
}

/* Información de la canción en el modal */
.song-info {
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #dee2e6;
}

.song-preview {
    display: flex;
    align-items: center;
    gap: 15px;
}

.playlist-song-image {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.song-details h3 {
    color: #333;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
    line-height: 1.3;
}

.song-details p {
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* Selector de posición */
.position-selector {
    margin-bottom: 25px;
}

.position-selector label {
    color: #333;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 15px;
    display: block;
}

.position-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.position-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: #fff;
    transition: all 0.3s ease;
    cursor: pointer;
}

.position-option:hover {
    border-color: #27ae60;
    background: #f8fff9;
}

.position-option input[type="radio"] {
    margin: 0;
}

.position-option label {
    margin: 0;
    cursor: pointer;
    font-weight: 500;
    flex: 1;
    color: #555;
}

.position-option.selected,
.position-option:has(input[type="radio"]:checked) {
    border-color: #27ae60;
    background: #f8fff9;
}

.position-option input[type="number"] {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    margin-left: 10px;
}

.position-option input[type="number"]:disabled {
    background: #f8f9fa;
    color: #6c757d;
}

/* Información de la playlist */
.playlist-info {
    margin-bottom: 25px;
    padding: 15px;
    background: #e8f5e9;
    border-radius: 8px;
    border-left: 4px solid #27ae60;
}

.playlist-info .info-text {
    color: #2d5a27;
    font-size: 14px;
    margin: 0;
    line-height: 1.4;
}

.playlist-info .info-text i {
    color: #27ae60;
    margin-right: 8px;
}

/* Responsive para modal de playlist */
@media (max-width: 768px) {
    #playlistModal .modal-content {
        width: 95%;
        margin: 10px;
        max-height: 95vh;
    }
    
    #playlistModal .modal-body {
        max-height: calc(95vh - 100px);
    }
    
    .user-profile {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .user-image {
        width: 50px;
        height: 50px;
    }
    
    .user-stats {
        justify-content: center;
        gap: 10px;
    }
    
    .user-stats .stat {
        font-size: 11px;
    }
    
    .spotify-link {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .song-preview {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .playlist-song-image {
        width: 60px;
        height: 60px;
    }
    
    .song-details h3 {
        font-size: 16px;
    }
    
    .position-option {
        padding: 10px 12px;
    }
    
    .position-option input[type="number"] {
        width: 60px;
        margin-left: 5px;
    }
}

/* ===============================================
   ESTILOS PARA MODAL DE CONFIGURACIÓN DE SPOTIFY
   =============================================== */

/* Botón de Spotify en el panel de administración */
.admin-btn.spotify {
    background: linear-gradient(135deg, #1db954 0%, #1ed760 100%);
    border: none;
    color: white;
}

.admin-btn.spotify:hover {
    background: linear-gradient(135deg, #1aa34a 0%, #1bc653 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(29, 185, 84, 0.3);
}

/* Modal de configuración de Spotify */
#spotifyConfigModal .modal-content {
    max-width: 900px;
    width: 95%;
    max-height: 95vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

#spotifyConfigModal .modal-body {
    flex: 1;
    overflow-y: auto;
    max-height: calc(95vh - 120px);
    /* Scrollbars personalizados */
    scrollbar-width: thin;
    scrollbar-color: #ccc #f8f9fa;
}

#spotifyConfigModal .modal-content::-webkit-scrollbar,
#spotifyConfigModal .modal-body::-webkit-scrollbar {
    width: 8px;
}

#spotifyConfigModal .modal-content::-webkit-scrollbar-track,
#spotifyConfigModal .modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#spotifyConfigModal .modal-content::-webkit-scrollbar-thumb,
#spotifyConfigModal .modal-body::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

#spotifyConfigModal .modal-content::-webkit-scrollbar-thumb:hover,
#spotifyConfigModal .modal-body::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Pestañas */
.config-tabs {
    width: 100%;
}

.tab-buttons {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 25px;
    gap: 0;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: #f8f9fa;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tab-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.tab-btn.active {
    background: white;
    color: #1db954;
    border-bottom-color: #1db954;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Secciones de formulario */
.form-section {
    margin-bottom: 30px;
}

.form-section h4 {
    color: #343a40;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    width: 100%;
    margin-bottom: 20px;
}

.form-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1db954;
    box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
}

.form-group .help-text {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
    font-style: italic;
}

/* Campo de contraseña con botón de mostrar/ocultar */
.form-group {
    position: relative;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 5px;
    margin-top: 12px;
}

.toggle-password:hover {
    color: #495057;
}

/* Advertencia de API */
.api-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.api-warning i {
    color: #856404;
    font-size: 18px;
}

.api-warning p {
    color: #856404;
    margin: 0;
    font-weight: 500;
}

/* Acciones de API */
.api-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Configuración de playlists */
.playlists-config {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.playlist-config-item {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    border: 1px solid #e9ecef;
}

.playlist-config-item:last-child {
    margin-bottom: 0;
}

.playlist-config-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 15px;
}

.playlist-config-title {
    font-weight: 600;
    color: #495057;
    flex: 1;
}

.remove-playlist-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
}

.remove-playlist-btn:hover {
    background: #c82333;
}

/* Estado de configuración */
.config-status {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.config-status.success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.config-status.error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Responsive para modal de configuración */
@media (max-width: 768px) {
    #spotifyConfigModal .modal-content {
        width: 98%;
        margin: 10px;
        max-height: 98vh;
    }
    
    #spotifyConfigModal .modal-body {
        max-height: calc(98vh - 100px);
    }
    
    .tab-buttons {
        flex-direction: column;
    }
    
    .tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .tab-btn.active {
        border-left-color: #1db954;
        border-bottom-color: transparent;
    }
    
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .api-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .api-actions .btn {
        width: 100%;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .playlists-config {
        max-height: 300px;
    }
    
    .playlist-config-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .toggle-password {
        margin-top: 8px;
    }
}

/* === ESTILOS PARA DIAGNÓSTICO === */
.diagnostic-log {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.diagnostic-content {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    background: #fff;
    padding: 10px;
    border: 1px solid #e1e5e9;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.diagnostic-entry {
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 4px;
    border-left: 4px solid #007bff;
}

.diagnostic-entry.success {
    background: #d4edda;
    border-left-color: #28a745;
    color: #155724;
}

.diagnostic-entry.error {
    background: #f8d7da;
    border-left-color: #dc3545;
    color: #721c24;
}

.diagnostic-entry.warning {
    background: #fff3cd;
    border-left-color: #ffc107;
    color: #856404;
}

.diagnostic-entry.info {
    background: #d1ecf1;
    border-left-color: #17a2b8;
    color: #0c5460;
}

.diagnostic-timestamp {
    font-weight: bold;
    margin-right: 8px;
}

.admin-btn.secondary {
    background: #6c757d;
    color: white;
}

.admin-btn.secondary:hover {
    background: #5a6268;
}

.admin-btn.warning {
    background: #ffc107;
    color: #212529;
}

.admin-btn.warning:hover {
    background: #e0a800;
}

.admin-btn.info {
    background: #17a2b8;
    color: white;
}

.admin-btn.info:hover {
    background: #138496;
}

.admin-btn.small {
    padding: 6px 12px;
    font-size: 12px;
    margin-top: 8px;
}

.diagnostic-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.diagnostic-actions .admin-btn.small {
    margin-top: 0;
}

/* Mejorar la selección de texto en el log */
.diagnostic-content {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

.diagnostic-entry {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Modal para copiar log */
.log-copy-modal {
    max-width: 600px;
    width: 90%;
}

.log-copy-modal .modal-body {
    padding: 20px;
}

.log-copy-textarea {
    width: 100%;
    height: 300px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.4;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    background: #f8f9fa;
    color: #333;
    margin: 10px 0;
}

.log-copy-textarea:focus {
    outline: 2px solid #007bff;
    border-color: #007bff;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 15px;
    flex-wrap: wrap;
}

.modal-actions .btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.modal-actions .btn-primary {
    background: #007bff;
    color: white;
}

.modal-actions .btn-primary:hover {
    background: #0056b3;
}

.modal-actions .btn-secondary {
    background: #6c757d;
    color: white;
}

.modal-actions .btn-secondary:hover {
    background: #545b62;
}