:root {
  --bg-base: #0a0a0c;
  --bg-surface: #141418;
  --bg-card: rgba(24, 24, 30, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 255, 255, 0.16);
  
  --primary: #ff0033;
  --primary-hover: #ff2255;
  --primary-glow: rgba(255, 0, 51, 0.35);
  
  --text-main: #f5f5f7;
  --text-muted: #8e8e93;
  --text-sub: #636366;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-base);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(255, 0, 51, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(30, 90, 255, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), #a80024);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 16px var(--primary-glow);
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text h1 span {
  color: var(--primary);
}

.brand-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

.status-badge, .server-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ff3b30;
}

.status-badge.connected .status-dot {
  background-color: #34c759;
  box-shadow: 0 0 8px rgba(52, 199, 89, 0.6);
}

/* Search Bar */
.search-section {
  width: 100%;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 8px 12px 8px 18px;
  transition: var(--transition);
}

.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: inherit;
}

.search-bar input::placeholder {
  color: var(--text-sub);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 14px var(--primary-glow);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 840px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

/* Player Card */
.player-card {
  align-items: center;
  text-align: center;
  gap: 20px;
}

.album-art-wrapper {
  width: 220px;
  height: 220px;
  margin: 10px 0;
}

.album-art {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.album-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-art-placeholder {
  color: var(--text-sub);
}

.track-details {
  width: 100%;
}

.track-details h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-details p {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress */
.progress-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #ff5577);
  transition: width 0.3s ease;
}

.time-display {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
}

/* Controls */
.controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.control-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.control-btn:hover {
  background: var(--bg-glass);
  color: #fff;
}

.btn-play {
  width: 58px;
  height: 58px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 18px var(--primary-glow);
}

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

.btn-subtle {
  color: var(--text-sub);
}

.btn-subtle:hover {
  color: var(--text-main);
}

/* Volume Slider */
.volume-container {
  width: 80%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

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

.slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  transition: transform 0.1s ease;
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

#volumeValue {
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

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

.card-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-title h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.queue-count {
  font-size: 0.75rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: var(--text-muted);
}

.queue-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--text-main);
  background: var(--bg-glass);
}

.queue-list {
  flex: 1;
  overflow-y: auto;
  max-height: 440px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.queue-list::-webkit-scrollbar {
  width: 6px;
}

.queue-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-glass);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.queue-item:hover {
  border-color: var(--border-color);
  background: rgba(255, 255, 255, 0.06);
}

.queue-item-idx {
  font-size: 0.8rem;
  color: var(--text-sub);
  width: 20px;
  font-variant-numeric: tabular-nums;
}

.queue-item-info {
  flex: 1;
  overflow: hidden;
}

.queue-item-title {
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.queue-item-remove {
  background: transparent;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.queue-item-remove:hover {
  color: #ff3b30;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 240px;
  color: var(--text-muted);
  text-align: center;
  gap: 8px;
}

.empty-state code {
  background: var(--bg-glass);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--primary);
}

.hidden {
  display: none !important;
}

/* Login Modal Overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 12, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.login-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), #a80024);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
  box-shadow: 0 6px 20px var(--primary-glow);
}

.login-card h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.login-btn {
  width: 100%;
  padding: 14px;
  font-size: 0.95rem;
}

.login-error {
  font-size: 0.8rem;
  color: #ff3b30;
  background: rgba(255, 59, 48, 0.1);
  border: 1px solid rgba(255, 59, 48, 0.2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-align: left;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-main);
}

.user-badge svg {
  color: var(--primary);
}

/* YouTube Modal Styles */
.yt-modal-card {
  max-width: 520px;
  text-align: left;
}

.yt-modal-card h2,
.yt-modal-card > p {
  text-align: center;
}

.yt-modal-card .login-icon {
  display: flex;
  margin: 0 auto 16px auto;
}

.yt-icon {
  background: linear-gradient(135deg, #ff0000, #cc0000);
  box-shadow: 0 6px 20px rgba(255, 0, 0, 0.35);
}

.yt-status-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.yt-status-box.active {
  border-color: rgba(48, 209, 88, 0.4);
  background: rgba(48, 209, 88, 0.08);
}

.yt-status-box.active .status-dot {
  background: #30d158;
  box-shadow: 0 0 10px #30d158;
}

.yt-instructions {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.yt-instructions ol {
  margin: 6px 0 0 18px;
  padding: 0;
}

.yt-instructions a {
  color: var(--primary);
  text-decoration: underline;
}

.cookie-upload-row {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}

.cookie-file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  cursor: pointer;
  border-radius: var(--radius-md);
  width: 100%;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.cookie-file-btn:hover {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.yt-modal-card textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  color: var(--text-main);
  font-family: monospace;
  font-size: 0.8rem;
  outline: none;
  resize: vertical;
  min-height: 80px;
  transition: var(--transition);
  margin-bottom: 8px;
}

.yt-modal-card textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.modal-btn-row {
  display: flex;
  gap: 10px;
}

.modal-btn-row button {
  flex: 1;
  padding: 12px;
  font-size: 0.85rem;
}

.yt-feedback-success {
  color: #30d158 !important;
  background: rgba(48, 209, 88, 0.1) !important;
  border-color: rgba(48, 209, 88, 0.3) !important;
}
