:root {
    --primary-color: #fa2d48;
    --primary-hover: #d91a3d;
    --secondary-color: #1d1d1f;
    --background-color: #f5f5f7;
    --card-background: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --border-color: #d2d2d7;
    --success-color: #34c759;
    --warning-color: #ff9500;
    --error-color: #ff3b30;
    --player-bg: #181818;
    --player-text: #ffffff;
    --player-text-secondary: #b3b3b3;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 32px;
    color: var(--primary-color);
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s;
}

.nav-link:hover {
    background-color: rgba(250, 45, 72, 0.1);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

/* Main Content */
.main {
    flex: 1;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Search Section */
.search-section {
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-background);
    padding: 8px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.search-icon {
    font-size: 20px;
    color: var(--text-secondary);
    margin-left: 12px;
}

#search-input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    padding: 12px;
    background: transparent;
    color: var(--text-primary);
}

#search-input::placeholder {
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(250, 45, 72, 0.3);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #000;
}

.btn-download {
    background-color: var(--success-color);
    color: white;
    padding: 10px 20px;
}

.btn-download:hover {
    background-color: #30b350;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Progress Section */
.progress-section {
    margin-bottom: 30px;
}

.progress-card {
    background: var(--card-background);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.progress-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-weight: 600;
    color: var(--primary-color);
}

.progress-header i {
    font-size: 20px;
}

.progress-bar-container {
    height: 8px;
    background-color: #e8e8ed;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #ff6b7a);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Results Section */
.results-section {
    margin-top: 20px;
}

.search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* Song Card */
.song-card {
    background: var(--card-background);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    gap: 16px;
    transition: all 0.2s;
}

.song-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.song-artwork {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.song-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
}

.song-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-artist {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-album {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    color: var(--border-color);
}

.empty-state h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 16px;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Downloads Tab */
.downloads-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.downloads-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
}

.downloads-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.download-item {
    background: var(--card-background);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
}

.download-artwork {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.download-info {
    flex: 1;
    min-width: 0;
}

.download-title {
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.download-artist {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.download-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status-pending {
    background-color: #f5f5f7;
    color: var(--text-secondary);
}

.status-downloading {
    background-color: rgba(250, 45, 72, 0.1);
    color: var(--primary-color);
}

.status-completed {
    background-color: rgba(52, 199, 89, 0.1);
    color: var(--success-color);
}

.status-failed {
    background-color: rgba(255, 59, 48, 0.1);
    color: var(--error-color);
}

.download-progress {
    width: 100px;
}

.download-progress-bar {
    height: 4px;
    background-color: #e8e8ed;
    border-radius: 2px;
    overflow: hidden;
}

.download-progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 2px;
    transition: width 0.3s;
}

.download-date {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: var(--card-background);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    box-shadow: var(--shadow-hover);
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    min-width: 300px;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--error-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-secondary);
    font-size: 14px;
    border-top: 1px solid var(--border-color);
    margin-top: 40px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
    }
    
    .search-results {
        grid-template-columns: 1fr;
    }
    
    .song-card {
        flex-direction: column;
        text-align: center;
    }
    
    .song-artwork {
        width: 150px;
        height: 150px;
        margin: 0 auto;
    }
    
    .song-actions {
        justify-content: center;
    }
}

/* Preview Button */
.btn-preview {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 10px 20px;
}

.btn-preview:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Audio Preview */
.audio-preview {
    width: 100%;
    margin-top: 10px;
}

/* Library Styles */
.library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.library-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    color: var(--text-primary);
}

.library-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--card-background);
    padding: 8px 16px;
    border-radius: 24px;
    border: 1px solid var(--border-color);
    width: 280px;
    transition: all 0.2s;
}

.library-search-box:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(250, 45, 72, 0.1);
}

.library-search-box i {
    color: var(--text-secondary);
    font-size: 14px;
}

.library-search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 14px;
    background: transparent;
    color: var(--text-primary);
}

.library-search-box input::placeholder {
    color: var(--text-secondary);
}

.library-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 100px; /* Space for now playing bar */
}

.library-item {
    background: var(--card-background);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
}

.library-item:hover {
    box-shadow: var(--shadow-hover);
    transform: translateX(4px);
}

.library-item.playing {
    border-color: var(--primary-color);
    background: rgba(250, 45, 72, 0.05);
}

.library-play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

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

.library-play-btn i {
    font-size: 14px;
    margin-left: 2px;
}

.library-artwork {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.library-info {
    flex: 1;
    min-width: 0;
}

.library-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.library-item.playing .library-title {
    color: var(--primary-color);
}

.library-artist {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.library-duration {
    font-size: 13px;
    color: var(--text-secondary);
    margin-right: 12px;
}

.library-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.library-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.library-action-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary-color);
}

/* Now Playing Bar - Spotify-like */
.now-playing {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--player-bg);
    color: var(--player-text);
    padding: 16px 24px;
    z-index: 100;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.now-playing.hidden {
    display: none !important;
}

.now-playing-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

/* Track Info Section */
.now-playing-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 30%;
    min-width: 180px;
}

.np-artwork {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.np-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.np-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--player-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.np-artist {
    font-size: 12px;
    color: var(--player-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.np-btn:hover {
    color: var(--player-text);
}

.np-like.liked {
    color: var(--primary-color);
}

.np-like.liked i {
    font-weight: 900;
}

/* Player Controls Section */
.now-playing-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 500px;
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 16px;
}

.control-btn {
    font-size: 16px;
    padding: 8px;
}

.control-btn:hover {
    color: var(--player-text);
}

.play-btn {
    width: 40px;
    height: 40px;
    background: white;
    color: black;
    border-radius: 50%;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-btn:hover {
    transform: scale(1.1);
    color: black;
}

.play-btn i {
    margin-left: 2px;
}

.play-btn.playing i {
    margin-left: 0;
}

/* Progress Bar */
.progress-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.time {
    font-size: 11px;
    color: var(--player-text-secondary);
    min-width: 35px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.progress-bar-wrapper {
    flex: 1;
    height: 4px;
    position: relative;
    cursor: pointer;
}

.progress-bar-track {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: white;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
    position: relative;
}

.progress-bar-wrapper:hover .progress-bar-track {
    height: 6px;
    margin-top: -1px;
}

.progress-bar-wrapper:hover .progress-bar-fill::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Extras Section */
.now-playing-extras {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 0 30%;
    justify-content: flex-end;
    min-width: 180px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.volume-slider {
    width: 93px;
}

.volume-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.volume-fill {
    height: 100%;
    background: white;
    border-radius: 2px;
    position: relative;
}

.volume-bar:hover .volume-fill::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: white;
    border-radius: 50%;
}

/* Song Row Play Button */
.song-row-play {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    margin-right: 8px;
}

.library-item:hover .song-row-play {
    opacity: 1;
}

.song-row-play:hover {
    transform: scale(1.1);
    background: var(--primary-hover);
}

.song-row-play i {
    font-size: 12px;
    margin-left: 2px;
}
