:root {
    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.5);
    --secondary: #a855f7;
    --bg-dark: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Animations */
.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    width: 500px;
    height: 500px;
    background: var(--primary);
    filter: blur(150px);
    opacity: 0.2;
    border-radius: 50%;
    animation: move 20s infinite alternate;
}

.blob-1 { top: -100px; left: -100px; }
.blob-2 { bottom: -100px; right: -100px; background: var(--secondary); }

@keyframes move {
    from { transform: translate(0, 0); }
    to { transform: translate(100px, 100px); }
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 10%;
    backdrop-filter: blur(10px);
    background: var(--bg-dark);
    opacity: 0.95;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.nav-logo {
    width: 35px;
    height: 35px;
    border-radius: 8px;
}

.nav-links {
    display: flex;
    gap: 30px;
    list-style: none;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-dim);
    transition: 0.3s;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--text-main);
}

.user-badge {
    background: var(--glass);
    padding: 8px 18px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.online-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 10px #10b981;
}

/* Hero Section */
.hero {
    padding: 100px 10% 60px;
    text-align: center;
}

h1 {
    font-size: 4.5rem;
    font-weight: 900;
    margin-bottom: 20px;
    letter-spacing: -2px;
}

.highlight {
    background: linear-gradient(to right, #6366f1, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-dim);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.6;
}

/* URL Bar */
.url-bar {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 8px;
    border-radius: 100px;
    display: flex;
    max-width: 700px;
    margin: 0 auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.url-bar input {
    background: transparent;
    border: none;
    color: white;
    padding: 15px 25px;
    flex-grow: 1;
    outline: none;
    font-size: 1rem;
}

.url-bar button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 35px;
    border-radius: 100px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
}

.url-bar button:hover {
    background: var(--secondary);
    transform: scale(1.05);
}

#home-section, #dashboard-section, #player-view-section {
    display: none;
}

/* Dashboard Layout */
.dashboard-container {
    padding: 40px 10%;
}

.dashboard-header {
    margin-bottom: 40px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    grid-template-rows: auto auto;
    gap: 25px;
}

.dash-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 30px;
    border-radius: 24px;
    backdrop-filter: blur(10px);
}

/* Profile Card */
.profile-box {
    grid-row: span 2;
    text-align: center;
}

.history-box {
    grid-column: 2;
    height: 400px; /* Fixed height to match sidebar */
    display: flex;
    flex-direction: column;
}

.friends-box {
    grid-column: 2;
    height: 400px; /* Fixed height for consistency */
    display: flex;
    flex-direction: column;
}

.activity-list {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
    margin-right: -5px;
}

/* Modern Scrollbar for Dashboard */
.activity-list::-webkit-scrollbar {
    width: 6px;
}

.activity-list::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.02);
    border-radius: 10px;
}

.activity-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.activity-list::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

.activity-item {
    width: 100%;
    box-sizing: border-box;
}

.avatar-circle {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    padding: 5px;
    background: var(--card-bg);
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.stats-group {
    display: flex;
    gap: 15px;
    margin: 25px 0;
}

.stat {
    flex: 1;
    background: rgba(255,255,255,0.03);
    padding: 15px;
    border-radius: 15px;
}

.stat span {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
}

.stat label {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.pro-btn {
    width: 100%;
    padding: 15px;
    border-radius: 50px;
    border: none;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    color: white;
    font-weight: 700;
    cursor: pointer;
}

/* History Card */
.history-box {
    min-height: 300px;
}

.activity-item {
    background: rgba(255,255,255,0.02);
    padding: 15px 20px;
    border-radius: 12px;
    margin-top: 15px;
    display: flex;
    flex-direction: column; /* Stack vertically instead of horizontally */
    gap: 8px;
    border: 1px solid var(--glass-border);
    position: relative;
    cursor: pointer;
    transition: background 0.3s;
}

.activity-item:hover {
    background: rgba(255,255,255,0.05);
}

.remove-history-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 5px;
    line-height: 1;
}

.remove-history-btn:hover {
    color: var(--primary);
}

.coin-progress {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    margin: 15px 0 8px;
    overflow: hidden;
}

.coin-progress .bar {
    height: 100%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Player Wrapper */
.player-wrapper {
    padding: 40px 10%;
}

.video-frame {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 30px;
    overflow: hidden;
    border: 1px solid var(--primary);
    box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}

.player-controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 0;
}

.btn-secondary {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 12px 25px;
    border-radius: 50px;
    cursor: pointer;
    margin-left: 10px;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 12px 25px;
    border-radius: 50px;
    cursor: pointer;
}

/* Features */
.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    padding: 60px 10%;
}

.feature-card {
    background: var(--glass);
    padding: 40px;
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    text-align: center;
}

.footer {
    text-align: center;
    padding: 60px;
    color: var(--text-dim);
}

@media (max-width: 1000px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    h1 { font-size: 3rem; }
    .features { grid-template-columns: 1fr; }
}

/* Join Room Bar */
.join-bar {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.join-label {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.join-input-group {
    display: flex;
    gap: 10px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 8px;
    border-radius: 100px;
    max-width: 500px;
    width: 100%;
}

.join-input-group input {
    background: transparent;
    border: none;
    color: white;
    padding: 10px 20px;
    flex-grow: 1;
    outline: none;
    font-size: 1rem;
    letter-spacing: 2px;
    font-weight: 600;
}

.join-input-group input::placeholder {
    letter-spacing: normal;
    font-weight: 400;
}

.btn-join {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 10px 28px;
    border-radius: 100px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    white-space: nowrap;
}

.btn-join:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--primary-glow);
}

/* Room Info Bar */
.room-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.members-badge {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Player Layout with Sidebar */
.player-layout {
    display: flex;
    gap: 20px;
    padding: 20px 5%;
    height: calc(100vh - 100px);
}

.player-main {
    flex: 1;
    min-width: 0;
}

.player-sidebar {
    width: 300px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.02);
}

.sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.sidebar-members {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

/* Sidebar Member Item */
.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    margin-bottom: 10px;
    border: 1px solid transparent;
    transition: 0.3s;
}

.sidebar-user-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--glass-border);
}

.sidebar-user-card.is-me {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.user-avatar-circle {
    width: 40px;
    height: 40px;
    background: var(--card-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 1px solid var(--glass-border);
}

.user-details {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    display: block;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Avatar Picker Grid */
.avatar-picker-group {
    margin-top: 20px;
    text-align: left;
}

.avatar-picker-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 10px;
    margin-left: 10px;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 15px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.avatar-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 12px;
    transition: 0.2s;
    border: 2px solid transparent;
}

.avatar-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.avatar-item.selected {
    background: var(--primary);
    border-color: white;
}

/* Themes System */
body.theme-default {
    --primary: #6366f1;
    --secondary: #a855f7;
    --bg-dark: #0f172a;
    --card-bg: #1e293b;
}

body.theme-ocean {
    --primary: #0ea5e9;
    --secondary: #2dd4bf;
    --bg-dark: #0c1a25;
    --card-bg: #152b3c;
}

body.theme-sunset {
    --primary: #f43f5e;
    --secondary: #fb923c;
    --bg-dark: #1a0f0f;
    --card-bg: #2d1a1a;
}

body.theme-forest {
    --primary: #10b981;
    --secondary: #84cc16;
    --bg-dark: #0a1a10;
    --card-bg: #142d1d;
}

body.theme-royal {
    --primary: #d946ef;
    --secondary: #facc15;
    --bg-dark: #1a0a1a;
    --card-bg: #2d142d;
}

body.theme-galaxy {
    --primary: #8b5cf6;
    --secondary: #ec4899;
    --bg-dark: #050510;
    --card-bg: #0f0f2d;
}

body.theme-auroria {
    --primary: #00fa9a;
    --secondary: #00ffcc;
    --bg-dark: #001a11;
    --card-bg: #003322;
}

/* Locked / Pro States */
.avatar-item.locked, .theme-item.locked {
    opacity: 0.7;
    pointer-events: none;
    cursor: not-allowed;
    position: relative;
}


.coins-display-badge {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #ffd700;
    padding: 12px 15px;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    margin-top: 5px;
}

#user-coins-count {
    font-size: 1.3rem;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.theme-item.locked .theme-dot {
    filter: blur(2px);
}

/* Theme Picker UI */
.theme-picker-group {
    margin-top: 25px;
    text-align: left;
}

.theme-picker-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 12px;
    margin-left: 10px;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.theme-item {
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.3s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-item:hover { transform: scale(1.1); }
.theme-item.selected { border-color: white; box-shadow: 0 0 15px var(--primary); }

.theme-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.pro-badge-mini {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--secondary);
    font-size: 0.6rem;
    padding: 2px 4px;
    border-radius: 4px;
    color: white;
}

.pro-grid {
    border-color: rgba(168, 85, 247, 0.2);
    background: rgba(168, 85, 247, 0.05);
}

.avatar-item.is-pro::after {
    content: "💎";
    position: absolute;
    font-size: 0.5rem;
    top: 2px;
    right: 2px;
}

@media (max-width: 1200px) {
    .player-layout { flex-direction: column-reverse; height: auto; }
    .player-sidebar { width: 100%; height: 400px; }
}

/* Remote Control Toggle */
.remote-control-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--glass);
    padding: 8px 15px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
}

.switch-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input { 
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: .4s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

.sync-badge {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Edit Name Group */
.edit-name-group {
    text-align: left;
    margin-top: 20px;
}

.edit-name-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    margin-left: 10px;
}

.edit-name-group input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    outline: none;
    transition: 0.3s;
}

.edit-name-group input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.1);
}

/* Inline Members List */
.members-list-inline {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    max-width: 300px;
}

.member-chip {
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.8rem;
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 5px;
}

.member-chip.is-host {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.member-chip.is-me {
    font-weight: bold;
    border-style: dashed;
}

.host-crown {
    font-size: 0.7rem;
}

/* Profile Upload & History Styling */
.profile-upload-wrapper { position: relative; cursor: pointer; overflow: hidden; }
.upload-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s; color: white; pointer-events: none; }
.profile-upload-wrapper:hover .upload-overlay { opacity: 1; }
.activity-item { display: flex; flex-direction: column; padding: 12px; background: rgba(255,255,255,0.03); border-radius: 12px; margin-bottom: 10px; border: 1px solid rgba(255,255,255,0.05); transition: 0.3s; cursor: pointer; }
.activity-item:hover { background: rgba(255,255,255,0.07); transform: translateX(5px); }
.activity-item .room-name { font-weight: bold; color: var(--primary); margin-bottom: 4px; }
.activity-item .room-meta { font-size: 0.75em; color: var(--text-dim); }
.activity-item .room-link { font-size: 0.7em; color: var(--primary-light); text-decoration: none; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.7; }

/* Sidebar User Cards */
.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--glass-border);
    transition: 0.3s;
}

.sidebar-user-card.is-me {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.user-avatar-circle {
    width: 35px;
    height: 35px;
    background: var(--card-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border: 1px solid var(--glass-border);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.btn-micro {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
    color: white;
}

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

.btn-add-friend:hover {
    background: #10b981; /* Green for add friend */
}

/* History Remove Button */
.remove-history-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s;
    padding: 5px;
}

.remove-history-btn:hover {
    color: #ef4444;
    transform: scale(1.2);
}

/* Galaxy Theme Stars */
.galaxy-stars {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: -2;
    background: transparent url('data:image/svg+xml;utf8,<svg width="200" height="200" xmlns="http://www.w3.org/2000/svg"><circle cx="20" cy="20" r="1" fill="white" opacity="0.8"/><circle cx="150" cy="50" r="1.5" fill="white" opacity="0.6"/><circle cx="80" cy="180" r="1" fill="white" opacity="0.9"/><circle cx="180" cy="120" r="2" fill="white" opacity="0.4"/></svg>') repeat;
    animation: twinkle 5s infinite linear;
}

body.theme-galaxy .galaxy-stars {
    display: block;
}

body.theme-galaxy .bg-blobs {
    opacity: 0.5; /* Tone down blobs to let stars shine */
}

@keyframes twinkle {
    0% { background-position: 0 0; }
    100% { background-position: -100px 100px; }
}
