/* Modern Premium CSS Stylesheet - Glassmorphism Theme */

:root {
  /* Color Palette (Harmonious HSL) */
  --bg-primary: hsl(230, 25%, 8%);
  --bg-card: hsla(230, 25%, 12%, 0.6);
  --bg-card-hover: hsla(230, 25%, 16%, 0.7);
  --border-color: hsla(230, 25%, 25%, 0.4);
  --border-focus: hsla(230, 25%, 45%, 0.6);
  
  --text-primary: hsl(210, 20%, 96%);
  --text-secondary: hsl(215, 15%, 72%);
  --text-muted: hsl(215, 12%, 50%);
  
  --spotify-green: hsl(142, 70%, 45%);
  --spotify-glow: hsla(142, 70%, 45%, 0.15);
  --tidal-cyan: hsl(190, 90%, 50%);
  --tidal-glow: hsla(190, 90%, 50%, 0.15);
  
  --accent-color: hsl(265, 85%, 65%);
  --accent-glow: hsla(265, 85%, 65%, 0.3);
  
  --danger-color: hsl(350, 75%, 55%);
  --success-color: hsl(145, 65%, 45%);
  
  /* Layout constraints */
  --border-radius-lg: 20px;
  --border-radius-md: 12px;
  --border-radius-sm: 8px;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --glass-blur: blur(16px);
}

/* Reset & Core Setup */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
}

/* Ambient Radial Glows */
.background-glows {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(130px);
  opacity: 0.25;
}

.glow-1 {
  top: -10%;
  left: 15%;
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, var(--spotify-green) 0%, transparent 80%);
  animation: float-slow 20s infinite alternate ease-in-out;
}

.glow-2 {
  bottom: 10%;
  right: 10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, var(--tidal-cyan) 0%, transparent 80%);
  animation: float-slow 25s infinite alternate-reverse ease-in-out;
}

@keyframes float-slow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 30px) scale(1.1); }
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: hsla(230, 25%, 25%, 0.5);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: hsla(230, 25%, 35%, 0.8);
}

/* Main Container Layout */
.app-container {
  width: 100%;
  max-width: 800px;
  padding: 40px 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Typography & Headers */
.app-header {
  text-align: center;
  margin-bottom: 10px;
}

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  color: var(--accent-color);
  filter: drop-shadow(0 0 10px var(--accent-glow));
}

.app-header h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #fff 40%, var(--accent-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.tagline {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
}

/* Glassmorphism Cards */
.card {
  background-color: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  padding: 30px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  transition: var(--transition-smooth);
}

.card h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  margin-bottom: 8px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

/* Connection Cards Grid */
.services-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

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

.service-box {
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--border-radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: var(--transition-smooth);
}

.service-box:hover {
  background-color: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-4px);
}

.service-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.service-icon.spotify {
  background-color: var(--spotify-glow);
  color: var(--spotify-green);
  border: 1px solid rgba(28, 185, 84, 0.3);
}

.service-icon.tidal {
  background-color: var(--tidal-glow);
  color: var(--tidal-cyan);
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.service-icon i {
  width: 28px;
  height: 28px;
}

.service-box h3 {
  font-family: 'Outfit', sans-serif;
  margin-bottom: 12px;
}

/* Status Indicators */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 20px;
  font-weight: 500;
  border: 1px solid transparent;
}

.status-indicator.connected {
  background-color: rgba(46, 213, 115, 0.1);
  color: hsl(145, 65%, 55%);
  border-color: rgba(46, 213, 115, 0.2);
}

.status-indicator.disconnected {
  background-color: rgba(255, 71, 87, 0.1);
  color: hsl(350, 75%, 65%);
  border-color: rgba(255, 71, 87, 0.2);
}

.status-indicator .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

.status-indicator.connected .dot {
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(46, 213, 115, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(46, 213, 115, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 213, 115, 0); }
}

/* Premium Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: var(--transition-smooth);
  width: 100%;
}

.btn-spotify {
  background-color: var(--spotify-green);
  color: #000;
}

.btn-spotify:hover {
  background-color: hsl(142, 70%, 55%);
  box-shadow: 0 0 15px rgba(28, 185, 84, 0.4);
}

.btn-tidal {
  background-color: var(--tidal-cyan);
  color: #000;
}

.btn-tidal:hover {
  background-color: hsl(190, 90%, 60%);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.4);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-color), hsl(265, 85%, 55%));
  color: #fff;
  box-shadow: 0 4px 15px rgba(106, 58, 237, 0.3);
}

.btn-primary:hover:not(.disabled) {
  background: linear-gradient(135deg, hsl(265, 85%, 70%), var(--accent-color));
  box-shadow: 0 8px 20px rgba(106, 58, 237, 0.5);
  transform: translateY(-2px);
}

.btn-primary.disabled, .btn-primary:disabled {
  background: #252836;
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-small {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.btn-large {
  padding: 14px 28px;
  font-size: 1.05rem;
  border-radius: var(--border-radius-md);
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-smooth);
}

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

/* Logout Container */
.logout-container {
  display: flex;
  justify-content: flex-end;
  margin-top: 15px;
  border-top: 1px solid var(--border-color);
  padding-top: 15px;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-logout:hover {
  color: var(--danger-color);
}

/* Playlist Selection Panel styling */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 10px;
}

@media (max-width: 600px) {
  .section-header {
    flex-direction: column;
    align-items: stretch;
  }
}

.search-box {
  position: relative;
  flex-grow: 1;
  max-width: 300px;
}

@media (max-width: 600px) {
  .search-box {
    max-width: 100%;
    margin-bottom: 10px;
  }
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 8px 12px 8px 36px;
  color: var(--text-primary);
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.search-box input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 10px rgba(106, 58, 237, 0.15);
}

.playlist-controls {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
}

.playlists-container {
  min-height: 150px;
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  background-color: rgba(0, 0, 0, 0.15);
  padding: 10px;
  margin-bottom: 20px;
}

.playlists-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--border-radius-sm);
  padding: 12px;
  cursor: pointer;
  user-select: none;
  transition: var(--transition-smooth);
}

.playlist-item:hover {
  background-color: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.1);
}

.playlist-item.selected {
  background-color: rgba(106, 58, 237, 0.1);
  border-color: hsla(265, 85%, 65%, 0.3);
}

.playlist-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition-smooth);
  background-color: transparent;
}

.playlist-item.selected .playlist-checkbox {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
}

.playlist-checkbox i {
  color: #fff;
  width: 12px;
  height: 12px;
  opacity: 0;
  transition: var(--transition-smooth);
}

.playlist-item.selected .playlist-checkbox i {
  opacity: 1;
}

.playlist-img {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  object-fit: cover;
  background-color: rgba(255, 255, 255, 0.05);
}

.playlist-details {
  min-width: 0;
  flex-grow: 1;
}

.playlist-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.playlist-tracks-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Spinner and Loading styles */
.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 15px;
  color: var(--text-secondary);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Progress bar & console log panel */
.progress-container {
  margin-bottom: 24px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.progress-status-text {
  color: var(--text-primary);
}

.progress-percentage-text {
  color: var(--accent-color);
}

.progress-bar-wrapper {
  background-color: rgba(255, 255, 255, 0.05);
  height: 8px;
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar {
  background: linear-gradient(90deg, var(--accent-color), var(--tidal-cyan));
  width: 0%;
  height: 100%;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
  transition: width 0.3s cubic-bezier(0.1, 0.8, 0.3, 1);
}

.console-wrapper {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  background-color: hsl(230, 25%, 5%);
}

.console-header {
  background-color: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.live-tag {
  color: var(--danger-color);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  animation: pulse-red-dot 1.5s infinite;
}

@keyframes pulse-red-dot {
  0% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.5); }
  70% { box-shadow: 0 0 0 5px rgba(255, 71, 87, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); }
}

.console-body {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  padding: 16px;
  height: 250px;
  overflow-y: auto;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.console-log-item {
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-all;
}

.console-log-item.success { color: var(--success-color); }
.console-log-item.error { color: var(--danger-color); }
.console-log-item.warning { color: hsl(45, 85%, 55%); }

/* Report / Summary panel styles */
.success-header {
  text-align: center;
  margin-bottom: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.success-icon-wrapper {
  width: 80px;
  height: 80px;
  background-color: rgba(46, 213, 115, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 0 20px rgba(46, 213, 115, 0.2);
}

.success-icon {
  width: 44px;
  height: 44px;
  color: var(--success-color);
}

.unmatched-container {
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
  margin-bottom: 24px;
}

.unmatched-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.unmatched-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 15px;
}

.unmatched-list-wrapper {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  background-color: rgba(0, 0, 0, 0.2);
}

.unmatched-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  text-align: left;
}

.unmatched-table th, .unmatched-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.unmatched-table th {
  background-color: rgba(0, 0, 0, 0.3);
  font-weight: 600;
  color: var(--text-muted);
  position: sticky;
  top: 0;
}

.unmatched-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* Action Footers */
.action-footer {
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
  margin-top: 10px;
}

/* Footer Section */
.app-footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: auto;
  width: 100%;
}

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