/* Reset y variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-hover: #2a2a2a;
    --accent: #ffd700;
    --accent-hover: #ffed4e;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border: #333333;
    --shadow: rgba(0, 0, 0, 0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #000000 0%, #1a1a1a 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding-bottom: 80px;
    transition: padding-bottom 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

body.player-active {
    padding-bottom: 200px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 5px 20px 20px 20px;
}

/* Botón icono (usado en modal) */
.btn-icon {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-icon:hover {
    background: var(--bg-hover);
    transform: scale(1.05);
}

.btn-icon:active {
    transform: scale(0.95);
    background: var(--accent);
    color: #000000;
}

/* Categorías */
.categories-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
    margin-bottom: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-secondary);
}

.categories-container::-webkit-scrollbar {
    height: 6px;
}

.categories-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.categories-container::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 3px;
}

.category-chip {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}

.category-chip:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.category-chip.active {
    background: var(--accent);
    color: #000000;
    border-color: var(--accent);
    font-weight: 600;
}

/* Playlist */
.playlist-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 16px;
    max-height: 57.5vh;
    overflow-y: auto;
    margin-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-primary);
}

.playlist-container::-webkit-scrollbar {
    width: 8px;
}

.playlist-container::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 4px;
}

.playlist-container::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 4px;
}

.playlist {
    list-style: none;
}

.playlist-item {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--bg-primary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.playlist-item:hover {
    background: var(--bg-hover);
    transform: translateX(5px);
}

.playlist-item.active {
    background: var(--accent);
    color: #000000;
    font-weight: 600;
}

.song-name {
    flex: 1;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 10px;
}

.song-categories {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.mini-chip {
    padding: 2px 8px;
    background: rgba(255, 215, 0, 0.2);
    border-radius: 10px;
    font-size: 10px;
    color: var(--accent);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Reproductor */
.player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 16px;
    box-shadow: 0 -4px 20px var(--shadow);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.player.minimized {
    transform: translateY(calc(100% - 60px));
    opacity: 0.9;
}

.player.minimized:hover {
    transform: translateY(0);
    opacity: 1;
}

.player-info {
    margin-bottom: 12px;
    text-align: center;
}

.song-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.song-time {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 0 10px;
}

.progress-container {
    margin-bottom: 16px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-primary);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.progress-bar::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.btn-control {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-control:hover {
    background: var(--bg-hover);
    transform: scale(1.1);
}

.btn-control.active {
    color: var(--accent);
}

.btn-play {
    background: var(--accent);
    border: none;
    color: #000000;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-play:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.volume-bar {
    width: 100px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-primary);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.volume-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.volume-bar::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 20px;
}

.modal-header .btn-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
    z-index: 10;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
}

.edit-song-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 10px;
}

.categories-edit {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.categories-edit label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.categories-edit label:hover {
    background: var(--bg-hover);
}

.categories-edit input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent);
}

.btn-save {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: #000000;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-save:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 5px 10px 10px 10px;
    }

    .player {
        padding: 12px;
    }

    body {
        padding-bottom: 70px;
    }

    body.player-active {
        padding-bottom: 180px;
    }
}
