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

:root {
  /* Adwaita Light Mode */
  --bg: #ffffff;
  --surface: #f6f5f4;
  --surface-dim: #ebebeb;
  --border: #d0cfce;
  --text: #2e2c2c;
  --text-secondary: #5e5c5c;
  --accent: #0061ff;
  --accent-bg: #e8f2ff;
  --destructive: #e01b24;
  --success: #26a269;
  --warning: #f57d00;
  
  /* Dark mode support */
  color-scheme: light dark;
  font-family: "Cantarell", "Liberation Sans", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Adwaita Dark Mode */
    --bg: #1e1e1e;
    --surface: #303030;
    --surface-dim: #242424;
    --border: #454545;
    --text: #ffffff;
    --text-secondary: #c6c6c6;
    --accent: #62a0ea;
    --accent-bg: #1a3a52;
    --destructive: #ff7b7b;
    --success: #8ff0a4;
    --warning: #ffbe6f;
  }
}

* { 
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body, #root { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  transition: background-color 0.2s, color 0.2s;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
}

.brand { 
  display: flex; 
  align-items: center; 
  gap: 1rem;
}

.dial-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 600;
}

.brand h1 {
  font-family: "Cantarell", system-ui, sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.tagline { 
  margin: 0.2rem 0 0; 
  color: var(--text-secondary); 
  font-size: 0.85rem;
}

.topbar-hint {
  color: var(--text-secondary);
  font-size: 0.85rem;
  max-width: 360px;
  text-align: right;
  line-height: 1.5;
  margin-left: auto;
}
.topbar-hint code { 
  color: var(--accent);
  background: var(--accent-bg);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-family: "monospace";
  font-size: 0.8rem;
}

.grid-wrap { 
  flex: 1; 
  padding: 2rem;
  overflow-y: auto;
}

.status-msg { 
  color: var(--text-secondary); 
  font-size: 0.95rem;
  text-align: center;
  padding: 2rem 1rem;
}
.status-error { 
  color: var(--destructive);
  background: var(--accent-bg);
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid var(--destructive);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  max-width: 1400px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.3, 0, 0.5, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.card:hover { 
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}
.card-active { 
  border-color: var(--accent);
  background: var(--accent-bg);
}

.card-art {
  position: relative;
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--surface-dim), var(--surface));
  overflow: hidden;
}
.card-art img { 
  width: 100%; 
  height: 100%; 
  object-fit: contain;
  padding: 0.75rem;
  display: block;
  background: var(--surface);
}

.freq {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.05);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  letter-spacing: 0.02em;
  font-weight: 500;
}

.live-pill {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--success);
  background: rgba(38, 162, 105, 0.1);
  padding: 0.3rem 0.6rem;
  border-radius: 12px;
}
.live-dot {
  width: 6px; 
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 4px var(--success);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; scale: 1; }
  50% { opacity: 0.5; scale: 0.8; }
}

.card-body { 
  padding: 1rem; 
  flex: 1; 
  display: flex;
  flex-direction: column;
}
.card-body h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
  color: var(--text);
}
.card-body p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.4;
}

.copy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: none;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s ease;
  margin-top: auto;
}
.copy-row code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "monospace";
  color: var(--accent);
  background: var(--accent-bg);
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
}
.copy-row:hover { 
  background: var(--surface-dim); 
  color: var(--text);
}
.copy-label {
  flex-shrink: 0;
  color: var(--accent);
  font-weight: 500;
  font-size: 0.75rem;
}

.nowplaying {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}
.nowplaying-active {
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.12);
}
.np-placeholder { 
  color: var(--text-secondary); 
  font-size: 0.85rem; 
}
.np-art { 
  width: 48px; 
  height: 48px; 
  border-radius: 8px; 
  object-fit: contain;
  background: white;
  padding: 0.25rem;
  flex-shrink: 0;
}
.np-info { 
  display: flex; 
  flex-direction: column; 
  margin-right: auto; 
  min-width: 0;
}
.np-info strong { 
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.np-info span { 
  color: var(--text-secondary); 
  font-size: 0.75rem; 
  text-transform: uppercase; 
  letter-spacing: 0.05em;
  font-weight: 500;
}

.np-toggle {
  width: 44px; 
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--accent);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-weight: 500;
}
.np-toggle:hover { 
  box-shadow: 0 2px 8px rgba(0, 97, 255, 0.2);
  transform: scale(1.05);
}
.np-toggle:active {
  transform: scale(0.98);
}

.np-volume { 
  width: 120px;
  height: 4px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.np-lastfm {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-dim);
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-weight: 500;
}

.np-lastfm:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.np-lastfm:active {
  transform: translateY(0);
}

.now-playing-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  margin: 0 1rem;
  padding: 0.5rem;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.np-track {
  min-width: 0;
}

.np-track-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-track-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.2rem;
}

@media (max-width: 768px) {
  .topbar { 
    padding: 1.25rem 1.5rem;
    gap: 1rem;
  }
  .topbar-hint { 
    display: none;
  }
  .grid-wrap { 
    padding: 1.5rem;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }
  .np-volume { 
    width: 80px; 
  }
  .nowplaying {
    padding: 0.75rem 1rem;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .nowplaying-active {
    flex-wrap: nowrap;
  }
  .np-info strong {
    font-size: 0.9rem;
  }
  .now-playing-info {
    display: none;
  }
  .np-lastfm {
    width: 40px;
    height: 40px;
  }
}

/* Legal & Disclaimer Styles */
.disclaimer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.disclaimer-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.disclaimer-modal h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--text);
}

.disclaimer-modal p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 1rem;
}

.disclaimer-modal strong {
  color: var(--text);
  font-weight: 600;
}

.disclaimer-modal ul {
  margin: 0 0 1rem 1.5rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.disclaimer-modal li {
  margin-bottom: 0.5rem;
}

.disclaimer-modal a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.disclaimer-modal a:hover {
  text-decoration: underline;
}

.disclaimer-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.disclaimer-btn {
  flex: 1;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.disclaimer-btn:hover {
  box-shadow: 0 4px 12px rgba(0, 97, 255, 0.3);
  transform: translateY(-1px);
}

.disclaimer-btn:active {
  transform: translateY(0);
}

.disclaimer-link {
  flex: 1;
  background: var(--surface-dim);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.disclaimer-link:hover {
  background: var(--border);
  text-decoration: none;
}

.legal-footer {
  position: fixed;
  bottom: 4.5rem;
  left: 0;
  right: 0;
  background: var(--accent-bg);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  font-size: 0.8rem;
  z-index: 100;
}

.legal-footer p {
  margin: 0;
  color: var(--accent);
}

.legal-footer a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.legal-footer a:hover {
  text-decoration: underline;
}
