@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --bg-dark: #0a0b10;
    --bg-card: rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.1);
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    margin-bottom: 2.5rem;
    text-align: center;
}

header h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* App Layout Grid */
.app-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
}

@media (max-width: 1024px) {
    .app-layout {
        grid-template-columns: 1fr;
    }
}

/* Left Column: Input + Player + Queue */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Glassmorphism Card Style */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

/* Input Section */
.add-song-section {
    padding: 1rem;
}

.input-group {
    display: flex;
    gap: 1rem;
}

input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    color: white;
    font-size: 1rem;
    transition: all 0.2s ease;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.1);
}

#userName { width: 180px; }
#youtubeUrl { flex: 1; }

button {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

button:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* Player Section */
.player-section {
    position: relative;
}

#player-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: black;
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 1rem;
    position: relative;
}

.message-bar {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

#screenMessage {
    flex: 1;
}

.screen-msg {
    position: absolute;
    left: 100%;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-main);
    white-space: nowrap;
    max-width: 85%;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation-name: screenMsgMove;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@keyframes screenMsgMove {
    from { transform: translateX(0); }
    to { transform: translateX(calc(-100vw - 140%)); }
}

#youtube-player {
    width: 100%;
    height: 100%;
}

.player-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#current-song-info {
    font-weight: 500;
}

#no-song {
    color: var(--text-muted);
    font-style: italic;
}

/* Playlist Section */
.playlist-section h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.queue-badge {
    background: var(--accent);
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.8rem;
}

.playlist {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.song-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.song-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--glass-border);
}

.song-thumbnail {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 0.5rem;
}

.song-info {
    flex: 1;
}

.song-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.song-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.remove-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    transition: all 0.2s ease;
}

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

.remove-btn:hover {
    background: var(--danger);
    color: white;
}

/* Recommended Sidebar */
.sidebar-stack {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar {
    height: fit-content;
}

.chat {
    height: fit-content;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 420px;
    overflow: auto;
    padding-right: 0.25rem;
}

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.65rem 0.75rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
}

.chat-message:hover {
    background: var(--bg-card-hover);
    border-color: var(--glass-border);
}

.chat-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.chat-text {
    font-weight: 500;
    word-break: break-word;
}

.sidebar h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
}

.recommendation-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rec-item {
    display: flex;
    gap: 1rem;
    padding: 0.5rem;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.rec-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.rec-thumbnail {
    width: 100px;
    height: 56px;
    border-radius: 0.4rem;
    object-fit: cover;
}

.rec-info {
    flex: 1;
}

.rec-title {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.rec-channel {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tabs {
    display: flex;
    gap: 0.75rem;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.6rem 1rem;
    border-radius: 999px;
    font-weight: 600;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.tab-btn.active {
    background: var(--accent);
    border-color: transparent;
}

.tab-panel {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.tab-panel.hidden {
    display: none;
}

.search-bar {
    display: flex;
    gap: 1rem;
}

#searchQuery {
    flex: 1;
}

.search-results {
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--glass-border);
}

.history-thumbnail {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 0.5rem;
}

.history-info {
    flex: 1;
}

.history-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.history-add-btn {
    padding: 0.6rem 1rem;
    border-radius: 0.75rem;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.search-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--glass-border);
}

.search-thumbnail {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 0.5rem;
}

.search-info {
    flex: 1;
}

.search-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.search-add-btn {
    padding: 0.6rem 1rem;
    border-radius: 0.75rem;
}

.empty-search {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    border: 2px dashed var(--glass-border);
    border-radius: 1rem;
}

.connection-pill {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 100;
}

.empty-playlist {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    border: 2px dashed var(--glass-border);
    border-radius: 1rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.song-item {
    animation: fadeIn 0.3s ease forwards;
}
/* AVATARS */
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(255,255,255,0.1); flex-shrink: 0; }
.user-tag { display: flex; align-items: center; gap: 8px; }
