:root {
    --primary-color: #007AFF;
    --background-color: #FFFFFF;
    --surface-color: #F8F9FA;
    --text-color: #1D1D1F;
    --text-secondary: #86868B;
    --accent-color: #007AFF;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --border-radius: 16px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

.app-container {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: var(--background-color);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.upload-section {
    background: var(--surface-color);
    padding: 16px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.upload-section form {
    display: flex;
    gap: 12px;
}

input[type="file"] {
    display: none;
}

.custom-file-upload {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px dashed #DDD;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.btn {
    padding: 10px 20px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:active {
    transform: scale(0.98);
}

.search-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface-color);
    border: none;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 16px;
    outline: none;
}

.playlist-container {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 120px;
    /* Space for the player */
}

.playlist-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.playlist-item:hover {
    background: var(--surface-color);
}

.playlist-item.active {
    background: rgba(0, 122, 255, 0.08);
}

.playlist-item .icon {
    width: 48px;
    height: 48px;
    background: #E5E5EA;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    font-size: 20px;
    color: var(--primary-color);
}

.playlist-item .info {
    flex: 1;
}

.playlist-item .title {
    font-weight: 600;
    font-size: 16px;
    display: block;
}

.playlist-item .meta {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Fixed Bottom Player */
.player-bar {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 460px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

.player-info {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.current-title {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.progress-container {
    width: 100%;
    height: 8px;
    /* Thicker bar */
    background: #E5E5EA;
    border-radius: 4px;
    margin-bottom: 12px;
    cursor: pointer;
    position: relative;
    transition: height 0.2s;
}

.progress-container:hover {
    height: 10px;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    border-radius: 4px;
    width: 0%;
    position: relative;
}

/* Add a handle/knob on hover */
.progress-bar::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.2s;
}

.progress-container:hover .progress-bar::after {
    opacity: 1;
}

.time-row {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: -8px;
    margin-bottom: 8px;
}

.player-controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.control-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-color);
    cursor: pointer;
}

.play-pause-btn {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.lyrics-btn {
    font-size: 14px;
    color: var(--primary-color);
    background: none;
    border: none;
    font-weight: 600;
}

.lyrics-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 2000;
    display: none;
    flex-direction: column;
    padding: 40px 24px;
}

.lyrics-overlay.show {
    display: flex;
}

.lyrics-content {
    flex: 1;
    overflow-y: auto;
    font-size: 20px;
    line-height: 1.6;
    font-weight: 600;
    text-align: center;
    padding: 40px 0;
}

.close-lyrics {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
}

.youtube-btn {
    font-size: 14px;
    color: #FF0000;
    background: none;
    border: none;
    font-weight: 600;
    margin-left: 10px;
}

.youtube-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.youtube-overlay.show {
    display: flex;
}

.youtube-container {
    width: 90%;
    max-width: 800px;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

#youtubePlayerFrame {
    width: 100%;
    height: 100%;
}

.close-youtube {
    position: absolute;
    top: 10px;
    right: 10px;
    color: white;
    font-size: 20px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 10;
}

@media (min-width: 501px) {
    .app-container {
        border-right: 1px solid #EEE;
        border-left: 1px solid #EEE;
    }
}