:root {
  --bg-main: #121212;
  --bg-card: #181818;
  --bg-card-alt: #242424;
  --bg-input: #1f1f1f;
  --border-color: #282828;
  --border-highlight: #3e3e3e;
  --text-main: #ffffff;
  --text-muted: #b3b3b3;
  --text-dim: #727272;
  --primary: #1ed760;
  --primary-hover: #1fdf64;
  --primary-glow: rgba(30, 215, 96, 0.4);
  --accent: #1ed760;
  --accent-glow: rgba(30, 215, 96, 0.35);
  --success: #1ed760;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: var(--bg-main);
  background-image: 
    radial-gradient(at 0% 0%, rgba(30, 215, 96, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(18, 18, 18, 0.9) 0px, transparent 50%);
  color: var(--text-main);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  line-height: 1.5;
  padding-bottom: 84px;
}

a {
  color: #1ed760;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 14px;
}

@media (min-width: 768px) {
  .wrap {
    padding: 20px;
  }
}

/* Nav Bar */
.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(18, 18, 18, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: max(12px, env(safe-area-inset-top));
}

.brand {
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}
.brand .brand-icon {
  color: #1ed760;
  font-size: 20px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge-sync {
  background: rgba(30, 215, 96, 0.12);
  color: #1ed760;
  border-color: rgba(30, 215, 96, 0.3);
}

.badge-connecting {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.3);
}

.badge-code {
  background: #242424;
  color: #fff;
  border-color: #3e3e3e;
  cursor: pointer;
  user-select: all;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

/* Room Header */
.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.room-title {
  font-size: clamp(20px, 4vw, 26px);
  font-weight: 800;
  line-height: 1.25;
}

.room-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

/* SPOTIFY NOW PLAYING CARD */
.player-card {
  background: #181818;
  border: 1px solid #282828;
  border-radius: 16px;
  padding: 20px 16px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Hidden Audio-Only YouTube Iframe container (Hemat Kuota: 144p audio-only, no video rendering) */
.hidden-audio-frame {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0.01;
  pointer-events: none;
  overflow: hidden;
  left: -9999px;
}

/* Spotify Album Artwork */
.spotify-artwork-box {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0 16px;
}

.spotify-cover-img {
  width: 180px;
  height: 180px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  border: 1px solid #333;
}

@media (min-width: 480px) {
  .spotify-cover-img {
    width: 220px;
    height: 220px;
  }
}

.spotify-cover-placeholder {
  width: 180px;
  height: 180px;
  border-radius: 14px;
  background: #242424;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
  color: #1ed760;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  border: 1px solid #333;
}

@media (min-width: 480px) {
  .spotify-cover-placeholder {
    width: 220px;
    height: 220px;
  }
}

/* Now Playing Meta */
.spotify-meta {
  text-align: left;
  margin-bottom: 12px;
  padding: 0 4px;
}

.now-playing-title {
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.now-playing-author {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Timeline Scrubber */
.timeline-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
}

.timeline-time {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  width: 36px;
}
.timeline-time.right {
  text-align: right;
}

.scrub-bar {
  flex: 1;
  height: 4px;
  background: #4d4d4d;
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: height 0.1s;
}
.scrub-bar:hover {
  height: 6px;
}
.scrub-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}
.scrub-bar:hover::-webkit-slider-thumb {
  background: #1ed760;
  transform: scale(1.2);
}

/* Spotify Playback Controls */
.player-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.controls-left-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-ctrl {
  background: transparent;
  color: var(--text-muted);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 18px;
}
.btn-ctrl:hover {
  color: #fff;
  transform: scale(1.08);
}
.btn-ctrl:active {
  transform: scale(0.92);
}

.btn-ctrl-primary {
  width: 52px;
  height: 52px;
  background: #1ed760;
  color: #000;
  border: none;
  box-shadow: 0 4px 16px rgba(30, 215, 96, 0.4);
  font-size: 20px;
}
.btn-ctrl-primary:hover {
  background: #1fdf64;
  transform: scale(1.06);
}

.controls-right-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-slider {
  width: 75px;
  height: 4px;
  accent-color: #1ed760;
  cursor: pointer;
}

/* Autoplay Unlock Overlay */
.player-unlock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 20px;
  text-align: center;
  cursor: pointer;
}
.player-unlock-overlay.active {
  display: flex;
}

.btn-big-play {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #1ed760;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 0 24px rgba(30, 215, 96, 0.6);
  margin-bottom: 10px;
}

/* VOICE CHAT BAR */
.voice-bar {
  background: #181818;
  border: 1px solid #282828;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.voice-status-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.voice-indicator-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #727272;
  flex-shrink: 0;
}
.voice-indicator-dot.active {
  background: #1ed760;
  box-shadow: 0 0 10px #1ed760;
}
.voice-indicator-dot.muted {
  background: #f59e0b;
}

.voice-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}
.voice-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.btn-voice {
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.btn-voice-join {
  background: #1ed760;
  color: #000;
}
.btn-voice-join:hover {
  background: #1fdf64;
}

.btn-voice-mute {
  background: #282828;
  color: #fff;
  border: 1px solid #3e3e3e;
}
.btn-voice-mute.muted {
  background: #7c2d12;
  color: #fed7aa;
}

.btn-voice-leave {
  background: #dc2626;
  color: #fff;
}

.voice-members-pill-wrap {
  width: 100%;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid #282828;
}

.voice-pill {
  font-size: 11px;
  padding: 3px 8px;
  background: #242424;
  border-radius: 12px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.voice-pill.speaking {
  color: #1ed760;
}

/* FIXED BOTTOM DOCK (Spotify Nav Bar Style) */
.bottom-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(18, 18, 18, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid #282828;
  padding: 6px 12px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 150;
}

.dock-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 10px;
  transition: all 0.2s;
  position: relative;
}
.dock-item:hover, .dock-item:active {
  color: #fff;
}
.dock-item.active {
  color: #1ed760;
}
.dock-item .dock-icon {
  font-size: 18px;
}
.dock-item-primary {
  background: #1ed760;
  color: #000 !important;
  border-radius: 20px;
  padding: 6px 16px;
}
.dock-badge {
  position: absolute;
  top: 2px;
  right: 8px;
  background: #ef4444;
  color: #fff;
  border-radius: 10px;
  padding: 0 5px;
  font-size: 9px;
  font-weight: 700;
}

/* DATA MASTER MODAL / DRAWER */
.datamaster-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.datamaster-modal-overlay.active {
  display: flex;
}

@media (min-width: 768px) {
  .datamaster-modal-overlay {
    align-items: center;
    padding: 20px;
  }
}

.datamaster-sheet {
  background: #121212;
  border: 1px solid #282828;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
  animation: slideUp 0.25s ease-out;
}

@media (min-width: 768px) {
  .datamaster-sheet {
    border-radius: 16px;
    max-height: 80vh;
  }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.datamaster-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: #181818;
  border-bottom: 1px solid #282828;
}
.datamaster-title {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-close-modal {
  background: #242424;
  color: #fff;
  border: 1px solid #333;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
}

/* Modal Tabs */
.datamaster-tabs {
  display: flex;
  background: #181818;
  border-bottom: 1px solid #282828;
  overflow-x: auto;
}
.datamaster-tabs::-webkit-scrollbar {
  display: none;
}

.dm-tab-btn {
  flex: 1;
  min-width: 100px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 12px 10px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}
.dm-tab-btn.active {
  color: #fff;
  border-bottom-color: #1ed760;
}

.datamaster-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

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

/* Card */
.card {
  background: #181818;
  border: 1px solid #282828;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 12px;
  color: #fff;
}

/* Search Box (Clean, NO history tags under it) */
.search-box-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.search-input {
  flex: 1;
  background: #242424;
  border: 1px solid #3e3e3e;
  border-radius: 20px;
  padding: 12px 18px;
  color: #fff;
  font-size: 14px;
  outline: none;
}
.search-input:focus {
  border-color: #1ed760;
}

.btn-search {
  background: #1ed760;
  color: #000;
  border: none;
  border-radius: 20px;
  padding: 0 20px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}
.btn-search:hover {
  background: #1fdf64;
}

/* Search Results Cards */
.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 420px;
  overflow-y: auto;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: #181818;
  border-radius: 8px;
  transition: background 0.15s;
}
.search-item:hover {
  background: #282828;
}

.search-item-thumb {
  width: 46px;
  height: 46px;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  background: #242424;
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.search-item-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item-author {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.search-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-play-now {
  background: #1ed760;
  color: #000;
  font-weight: 700;
  font-size: 11px;
  padding: 8px 14px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
}
.btn-play-now:hover {
  background: #1fdf64;
}

.btn-add-queue {
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid #444;
  cursor: pointer;
}
.btn-add-queue:hover {
  color: #fff;
  border-color: #fff;
}

/* Queue List */
.queue-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
}

.queue-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #1f1f1f;
  border-radius: 8px;
  gap: 10px;
}

.queue-item-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-meta {
  font-size: 11px;
  color: var(--text-dim);
}

.queue-btn-del {
  background: transparent;
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 6px;
}
.queue-btn-del:hover {
  color: #ef4444;
}

/* Chat & Users */
.online-users-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.user-pill {
  background: #242424;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
}

.user-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1ed760;
}

.chat-messages {
  height: 260px;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.chat-msg {
  background: #242424;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
}

.chat-msg-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2px;
  font-size: 11px;
}

.chat-msg-user {
  font-weight: 700;
  color: #1ed760;
}

.chat-msg-time {
  color: var(--text-dim);
}

.chat-msg-text {
  color: #fff;
  word-break: break-word;
}

.chat-input-wrap {
  display: flex;
  gap: 8px;
}

.chat-input {
  flex: 1;
  background: #242424;
  border: 1px solid #333;
  border-radius: 20px;
  padding: 10px 16px;
  color: #fff;
  font-size: 13px;
  outline: none;
}
.chat-input:focus {
  border-color: #1ed760;
}

.btn-chat-send {
  background: #1ed760;
  color: #000;
  border: none;
  border-radius: 20px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* General Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 20px;
  padding: 8px 16px;
  background: #1ed760;
  color: #000;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover {
  background: #1fdf64;
}

.btn.secondary {
  background: #242424;
  color: #fff;
  border: 1px solid #3e3e3e;
}
.btn.secondary:hover {
  border-color: #fff;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 11px;
  border-radius: 16px;
}

.field {
  display: block;
  width: 100%;
  padding: 10px 14px;
  margin: 6px 0 12px;
  border-radius: 10px;
  border: 1px solid #3e3e3e;
  background: #242424;
  color: #fff;
  font-size: 13px;
  outline: none;
}
.field:focus {
  border-color: #1ed760;
}

.error {
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 12px;
}

.muted {
  color: var(--text-muted);
}
