/* Custom styles for WishYourSong */

/* Base styles */
:root {
    --bg-color: #1a1a2e;
    --card-bg: #16213e;
    --text-color: #ffffff;
    --text-secondary: #a0aec0;
    --highlight-color: #00C389;
    --border-color: #374151;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    padding: 20px 0 30px;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: var(--highlight-color);
}

header p {
    color: var(--text-secondary);
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

/* Section header with badge */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-header h2 {
    margin-bottom: 0;
}

/* Badge */
.badge {
    background: var(--highlight-color);
    color: var(--bg-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Buttons */
.btn-primary {
    background: var(--highlight-color);
    color: var(--bg-color);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
}

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

.btn-icon {
    background: transparent;
    color: var(--text-color);
    border: none;
    padding: 8px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--border-color);
}

.btn-remove {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}

.btn-remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Zone selector */
.zone-selector {
    display: flex;
    gap: 12px;
    align-items: center;
}

.zone-selector select {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    font-size: 1rem;
}

.status-text {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

.empty-state p {
    margin-bottom: 16px;
}

/* Now playing */
.now-playing {
    display: flex;
    align-items: center;
    gap: 16px;
}

.album-art {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--border-color);
}

.track-info {
    flex: 1;
}

.track-info h3 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.track-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Progress bar */
.progress-container {
    margin-top: 12px;
}

.progress-bar {
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--highlight-color);
    border-radius: 3px;
    width: 0%;
    transition: width 1s linear;
}

.progress-time {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.playback-controls {
    display: flex;
    gap: 8px;
}

/* Volume control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.volume-icon {
    font-size: 1.2rem;
}

.volume-control input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--highlight-color);
    border-radius: 50%;
    cursor: pointer;
}

#volume-value {
    min-width: 45px;
    text-align: right;
    color: var(--text-secondary);
}

/* Queue list */
.queue-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.queue-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-color);
    border-radius: 8px;
    animation: slide-in 300ms ease-out;
}

.queue-position {
    font-size: 0.9rem;
    color: var(--text-secondary);
    width: 24px;
    text-align: center;
}

.queue-item-art {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    background: var(--border-color);
}

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

.queue-item-title {
    display: block;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-item-artist {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.queue-item-votes {
    color: var(--highlight-color);
    font-weight: 600;
    font-size: 0.9rem;
}

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

.btn-add-playlist {
    background: var(--highlight-color);
    color: var(--bg-color);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-add-playlist:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

/* Two column layout */
.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .two-column-layout {
        grid-template-columns: 1fr;
    }
}

/* Playlist section */
.playlist-name {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: normal;
}

.playlist-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 500px;
    overflow-y: auto;
}

.playlist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-color);
    border-radius: 8px;
    font-size: 0.9rem;
}

.playlist-item.now-playing {
    background: rgba(0, 195, 137, 0.15);
    border: 1px solid var(--highlight-color);
}

.playlist-item-position {
    font-size: 0.85rem;
    color: var(--text-secondary);
    width: 24px;
    text-align: center;
}

.playlist-item-art {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    background: var(--border-color);
}

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

.playlist-item-title {
    display: block;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
}

.playlist-item-artist {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playlist-item .btn-remove {
    opacity: 0.5;
}

.playlist-item:hover .btn-remove {
    opacity: 1;
}

/* Loading state */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

/* Playlist loading - use visibility to preserve space */
#playlist-loading {
    display: block !important;
    visibility: visible;
}

#playlist-loading.hidden {
    visibility: hidden;
}

/* Control buttons */
.control-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

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

/* Smooth transitions */
* {
    transition-property: background-color, border-color, color, opacity;
    transition-duration: 150ms;
    transition-timing-function: ease-in-out;
}

/* Vote button animation */
.vote-btn {
    transition: transform 200ms ease-in-out;
}

.vote-btn:active {
    transform: scale(0.95);
}

.vote-btn.voted {
    animation: vote-pulse 300ms ease-out;
}

@keyframes vote-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Queue item entrance animation */
.queue-item {
    animation: slide-in 300ms ease-out;
}

@keyframes slide-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Now playing pulse */
.now-playing-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Album art placeholder */
.album-art-placeholder {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Search result hover */
.search-result {
    transition: background-color 150ms ease-in-out, transform 150ms ease-in-out;
}

.search-result:hover {
    transform: translateX(4px);
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1f2937;
    border: 1px solid #374151;
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    transition: transform 300ms ease-out, opacity 300ms ease-out;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: #10b981;
}

.toast.error {
    border-color: #ef4444;
}

.toast.info {
    border-color: #3b82f6;
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .queue-item {
        padding: 12px;
    }

    #player-album-art {
        width: 200px;
        height: 200px;
    }
}

/* Audio player styling */
#audio-volume {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #374151;
    border-radius: 3px;
    outline: none;
}

#audio-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--scheme-primary, #8b5cf6);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 150ms ease;
}

#audio-volume::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#audio-volume::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--scheme-primary, #8b5cf6);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#audio-progress-bar {
    transition: width 100ms linear;
}

#btn-audio-play:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#btn-audio-play:not(:disabled):hover {
    transform: scale(1.05);
}

#btn-audio-play:not(:disabled):active {
    transform: scale(0.95);
}

/* Audio visualizer animation */
.audio-playing-indicator {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
}

.audio-playing-indicator span {
    width: 3px;
    background: var(--scheme-primary, #8b5cf6);
    border-radius: 1px;
    animation: audio-bar 0.5s infinite ease-in-out;
}

.audio-playing-indicator span:nth-child(1) { animation-delay: 0s; }
.audio-playing-indicator span:nth-child(2) { animation-delay: 0.1s; }
.audio-playing-indicator span:nth-child(3) { animation-delay: 0.2s; }

@keyframes audio-bar {
    0%, 100% { height: 4px; }
    50% { height: 16px; }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1f2937;
}

::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}
