
*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --bg: #000000;
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  background: #000000;
  color: var(--text-main);
}

body {
  display: flex;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 1100px;
  min-height: 100vh;
  padding: 1.75rem 1rem 3.5rem;
}

.sg-main {
  display: flex;
  flex-direction: column;
}

/* Top bar */
.flag-top-bar {
  position: fixed;
  left: 50%;
  bottom: 0px; /* flush against floating bar */ /* closer gap */ /* 3px gap */ /* 6px gap */
  transform: translateX(-50%);
  width: min(900px, 100% - 1.5rem);
  margin: 0 auto;
  padding: 10px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.35), rgba(15, 23, 42, 0.55));
  border: 1px solid rgba(148, 163, 184, 0.45);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(18px);
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: center;
}

.flag-bar {
  display: inline-flex;
  align-items: center;
  gap: 14px; /* slightly reduced gap to help spacing on small screens */
}

.flag-round {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
}

.flag-tab,
.flag-action-tab {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.flag-tab.active .flag-round {
  border-width: 3px;
  border-color: #4f46e5;
}

.flag-round-icon {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 26px; /* slightly smaller so icons don't hit bar edges */
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.9);
}

.flag-heart-icon {
  background: #ef4444;
  color: #ffffff;
}

.flag-search-icon {
  background: #ffffff;
  color: #000000;
}

/* Search */
.search-container {
  width: min(900px, 100% - 1.5rem);
  margin: 0 auto 12px auto;
}

.search-container input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.95);
  color: #f9fafb;
  font-size: 0.9rem;
}

.search-container input::placeholder {
  color: #6b7280;
}

.hidden { display: none !important; }

/* Grid */
.sg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}

.sg-card {
  position: relative;
  background: transparent;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
}

.sg-card-logo-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 1.1rem;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: #020617;
}

.sg-card-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.sg-card-info {
  text-align: center;
  margin-top: 0.25rem;
}

.sg-card-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
}

/* Heart overlay */
.sg-card-heart {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(148, 163, 184, 0.25);
  border: 1px solid rgba(148, 163, 184, 0.7);
  font-size: 13px;
  cursor: pointer;
  z-index: 5;
  color: #ffffff;
}

.sg-card-heart span { pointer-events: none; }

.sg-card-heart.is-favorite {
  background: #ef4444;
  border-color: #fca5a5;
  color: #ffffff;
}

/* Now playing bar */
.sg-now-playing {
  position: fixed;
  left: 50%;
  bottom: 3.0rem; /* moved slightly lower to sit closer above floating bar */
  transform: translateX(-50%);
  width: min(900px, 100% - 1.5rem);
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.98));
  border: 1px solid rgba(148, 163, 184, 0.5);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.9);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  backdrop-filter: blur(20px);
  z-index: 40;
}

.sg-now-playing.hidden {
  opacity: 0;
  pointer-events: none;
}

.np-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.np-logo {
  width: 62px;
  height: 62px;          /* slightly smaller to avoid clipping */
  border-radius: 0;
  border: none;
  padding: 0;
  object-fit: cover;
  display: block;
  margin-left: 0.25rem;  /* nudge logo slightly to the right */
  border-radius: 12px;
}

.np-text {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}

.np-name {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.np-heart {
  font-size: 1.6rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
  margin-left: 8px;
}

.np-heart.is-favorite {
  color: #ff4d4d;
}

.np-button {
  border: none;
  border-radius: 999px;
  width: 44px;
  height: 44px;
  min-width: 44px;
  background: transparent !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.np-icon-play::before,
.np-icon-pause::before {
  color: #ffffff !important;
}

.np-pause-icon {
  width: 20px;
  height: 20px;
}

/* Mobile */
@media (max-width: 640px) {
  #app {
    padding-inline: 0.75rem;
    padding-bottom: 3.5rem;
  }
  .sg-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}


/* Centered play icon and smaller pause */
.np-icon-play {
  width: 0;
  height: 0;
  border-top: 13px solid transparent;
  border-bottom: 13px solid transparent;
  border-left: 22px solid #ffffff; /* white play icon */
}
.np-icon-pause {
  position: relative;
  width: 22px;
  height: 26px;
}
.np-icon-pause::before,
.np-icon-pause::after {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 4px;
  background: #ffffff; /* white bars */
  border-radius: 2px;
}
.np-icon-pause::before { left: 4px; }
.np-icon-pause::after { right: 4px; }

/* Transparent favourite buttons */
.fav-button {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}
.fav-button i,
.fav-button svg,
.fav-button .heart-icon {
  color: #ff0000;
  font-size: 24px;
}


/* Heart circle icon: white background, red heart and border */
.flag-heart-icon {
  background: #ffffff;
  color: #ef4444;
  border: 2px solid #ef4444;
}

/* Base icon styling inside now playing button */
.np-icon {
  display: inline-block;
}

/* Bigger, centered play triangle */
.np-icon-play {
  width: 0;
  height: 0;
  border-top: 15px solid transparent;
  border-bottom: 15px solid transparent;
  border-left: 26px solid #ffffff; /* white play icon */
}

/* Bigger, centered pause icon */
.np-icon-pause {
  position: relative;
  width: 26px;
  height: 28px;
}

.np-icon-pause::before,
.np-icon-pause::after {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 5px;
  background: #000000;
  border-radius: 3px;
}

.np-icon-pause::before { left: 4px; }
.np-icon-pause::after  { right: 4px; }

/* Default icon visibility: show play, hide pause */
.np-button .np-icon-play {
  display: inline-block;
}
.np-button .np-icon-pause {
  display: none;
}

/* When playing, show pause instead of play */
.np-button.is-playing .np-icon-play {
  display: none;
}
.np-button.is-playing .np-icon-pause {
  display: inline-block;
}


/* ---- Final overrides: now playing position & play/pause icon styling ---- */
.sg-now-playing { bottom: 6.6rem; /* approx 6px gap above flag-top-bar */
}

.np-button {
  background: #000000;
}

.np-icon-play {
  width: 0;
  height: 0;
  border-top: 15px solid transparent;
  border-bottom: 15px solid transparent;
  border-left: 26px solid #ffffff; /* white play icon */
}

.np-icon-pause {
  position: relative;
  width: 26px;
  height: 28px;
}

.np-icon-pause::before,
.np-icon-pause::after {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  width: 4px;
  background: #ffffff; /* white bars */
  border-radius: 3px;
  left: auto;
}

.np-icon-pause::before { left: 4px; }
.np-icon-pause::after  { right: 4px; }

.np-button .np-icon-play { display: inline-block; }
.np-button .np-icon-pause { display: none; }
.np-button.is-playing .np-icon-play { display: none; }
.np-button.is-playing .np-icon-pause { display: inline-block; }


/* Global search (RadioBrowser) */
.global-search {
  width: 100%;
}

.global-search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.search-button {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.95);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-button-icon {
  font-size: 0.9rem;
}

.country-scroll {
  display: none;
}

.country-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  font-size: 0.7rem;
  white-space: nowrap;
  cursor: pointer;
}

.country-pill.active {
  background: rgba(37, 99, 235, 0.85);
  border-color: rgba(59, 130, 246, 1);
  color: #f9fafb;
}

.country-flag {
  font-size: 0.9rem;
}

.country-name {
  letter-spacing: 0.02em;
}

/* Empty / status messages for the grid */
.sg-empty {
  width: min(900px, 100% - 1.5rem);
  margin: 24px auto;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}
