/* Refactored style.css with improved readability & polished UI/UX */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:focus-visible {
  outline: 2px dashed var(--accent-link);
  outline-offset: 2px;
}

* {
  transition: background-color 0.3s, color 0.3s, box-shadow 0.3s, transform 0.2s;
}

[hidden] {
  display: none !important;
}


body {
  font-family: 'Roboto', sans-serif;
  background: var(--background);
  color: var(--on-surface);
  padding: 0;
  margin: 0;
  transition: background 0.3s, color 0.3s;
}

/* Top app bar */
.top-bar {
  background: var(--primary);
  color: var(--on-primary);
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 56px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  border-bottom: 2px solid var(--primary-container);
  position: relative;
  z-index: 1002;
}

.logo-title h1 {
  font-size: 1.25rem;
  margin: 0;
  line-height: 56px;
  color: var(--on-primary);
}

.nav-toggle-label {
  color: var(--on-primary);
  font-size: 1.5rem;
  margin-right: 16px;
  cursor: pointer;
}

.back-button {
  color: var(--on-primary);
  font-size: 1.25rem;
  margin-right: 16px;
  text-decoration: none;
}

nav {
  flex-grow: 1;
  transition: transform 0.4s ease-in-out;
}

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
}

nav li {
  margin-right: 16px;
}

nav a {
  color: var(--on-primary);
  text-decoration: none;
  font-weight: 500;
}

nav a:hover,
nav a.active,
.post-share a:hover,
footer nav a:hover {
  color: var(--accent-link);
  text-decoration: underline;
}

/* Keep existing styles untouched below here */
/* The rest of the existing style.css remains the same... */

#nav-toggle {
  display: none;
}

.nav-overlay {
  display: none;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--on-primary);
  cursor: pointer;
  font-size: 1.25rem;
  margin-left: 16px;
}

/* Generic sections */
section {
  background: var(--surface);
  margin: 20px auto;
  padding: 16px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  max-width: 960px;
}

.hero {
  text-align: center;
  padding: 40px 20px;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin: 20px auto;
}

.hero img {
  max-width: 100%;
  height: auto;
  margin-bottom: 16px;
}

/* Hero banner with image overlay */
.hero-banner {
  position: relative;
  text-align: center;
  margin: 20px auto;
  max-width: 960px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.hero-banner img {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

.hero-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.6);
  color: var(--on-primary);
  padding: 24px;
  border-radius: 8px;
  font-size: 1.1rem;
  line-height: 1.6;
}

/* Improve contrast for tagline in dark mode */
[data-theme="dark"] .hero-text {
  color: var(--on-primary-container);
}

/* Featured card layout */
.feature-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin: 40px auto;
  max-width: 960px;
}

.feature-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  text-align: center;
  flex: 1 1 250px;
}

.feature-card .material-icons {
  font-size: 48px;
  color: var(--primary);
  margin-bottom: 10px;
}

/* Blog list styling */
.blog-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.blog-post-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface-variant);
}

.blog-post-item:last-child {
  border-bottom: none;
}

.blog-post-item a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.blog-post-item a:hover {
  text-decoration: underline;
  color: var(--hover-link);
}

.blog-post-item .post-date {
  display: block;
  margin-top: 4px;
  font-size: 0.95rem;
  color: var(--on-surface-variant);
}

/* Channel navigation layout */
.youtube-section {
  display: flex;
  gap: 16px;
}

.youtube-section .channel-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 220px;
}

.youtube-section .channel-card {
  background: var(--surface);
  padding: 8px 16px;
  border-radius: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: box-shadow 0.2s, background 0.2s;
  user-select: none;
}

.youtube-section .channel-card:hover {
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.youtube-section .channel-card.active {
  background: var(--primary);
  color: var(--on-primary);
}

.video-section {
  margin-top: 16px;
}

.youtube-section .video-section {
  flex: 1;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
}

.video-section iframe {
  width: 100%;
  height: 315px;
  border: none;
  border-radius: 4px;
}

.video-section .video-list {
  flex: 1 1 auto;
  overflow-y: auto;
}

.video-list .video-item {
  display: flex;
  align-items: center;
  padding: 8px;
  border-bottom: 1px solid var(--surface-variant);
  cursor: pointer;
}

.video-list .video-item img {
  width: 120px;
  height: 67px;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 8px;
}

.video-list .video-item.active {
  background: rgba(0,100,0,0.1);
}

.video-list .video-item .video-details {
  display: flex;
  flex-direction: column;
}

.video-list .video-item .video-meta {
  font-size: 0.875rem;
  color: var(--on-surface-variant);
}

/* Responsive behaviour for channel list */
@media (max-width: 768px) {
  .youtube-section {
    display: block;
  }
  .youtube-section .channel-list {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 260px;
    max-width: 80%;
    background: var(--surface);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 5px rgba(0,0,0,0.3);
    overflow-y: auto;
    padding: 16px 8px;
    z-index: 1001;
  }
  .youtube-section .channel-list.open {
    transform: translateX(0);
  }
  .youtube-section .channel-toggle {
    display: inline-block;
    margin-bottom: 8px;
  }
}

@media (min-width: 769px) {
  .youtube-section .channel-toggle {
    display: none;
  }
  .youtube-section .channel-list {
    position: sticky;
    top: 72px;
    max-height: calc(100vh - 88px);
    overflow-y: auto;
  }
}

/* Buttons */
button,
.channel-toggle {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  border-radius: 12px;
  padding: 8px 16px;
  cursor: pointer;
}

button:hover,
.channel-toggle:hover {
  background: var(--primary-container);
}

.feature-card:hover,
button:hover,
.channel-toggle:hover {
  transform: scale(1.03);
  transition: transform 0.2s ease, background-color 0.2s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.play-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  cursor: pointer;
}

.play-pause-btn {
  position: relative;
}

.play-btn:hover {
  background: var(--primary-container);
}

/* Radio player controls */
.radio-player {
  background: linear-gradient(180deg, var(--surface), var(--surface-variant));
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.radio-list #player-container {
  position: sticky;
  top: 0;
  z-index: 1000;
}

.station-info {
  text-align: center;
}

.station-info img {
  width: 80px;
  height: 80px;
  object-fit: contain;
  margin-bottom: 8px;
}

.station-title {
  font-weight: 700;
  margin: 0;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 12px;
  background: var(--error-container, #ffebee);
  color: var(--error);
  font-size: 0.75rem;
  font-weight: 600;
}

.live-badge .dot {
  width: 8px;
  height: 8px;
  background: var(--error);
  border-radius: 50%;
  margin-right: 4px;
}

.not-live-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 12px;
  background: var(--surface-variant);
  color: var(--on-surface);
  font-size: 0.75rem;
  font-weight: 600;
}

.not-live-badge .dot {
  width: 8px;
  height: 8px;
  background: var(--on-surface);
  border-radius: 50%;
  margin-right: 4px;
}

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
}

.controls button {
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 4px;
  background: var(--primary);
  color: var(--on-primary);
  cursor: pointer;
}

.controls button:hover {
  background: var(--hover-primary);
}

.controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 8px;
  border-bottom: 1px solid var(--surface-variant);
}

th {
  text-align: left;
}

table tbody tr:not(:first-child) {
  cursor: pointer;
}

table tbody tr.favorite {
  background-color: var(--favorite-row);
  color: #FFFFFF;
}
/* Hover highlight for station rows on desktops */
@media (hover: hover) and (pointer: fine) {
  .radio-list table tbody tr:not(:first-child) {
    transition: background-color 0.2s ease-in-out;
  }

  .radio-list table tbody tr:not(:first-child):hover {
    background-color: var(--hover-primary);
  }
}

.radio-list td:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.radio-list td:first-child audio {
  display: none;
}

.station-row-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
}

/* Post layout */
.post-container {
  padding: 20px;
  max-width: 800px;
  margin: auto;
  box-sizing: border-box;
}

.post {
  background: var(--surface);
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.post h1 {
  font-size: 2em;
  margin-bottom: 10px;
  color: var(--on-surface);
}

.post-meta,
.post-author {
  color: var(--on-surface-variant);
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.post-featured-image {
  width: 100%;
  height: auto;
  margin: 20px 0;
  border-radius: 8px;
}

.post-content {
  line-height: 1.7;
  font-size: 1rem;
  color: var(--on-surface);
}

.post-share {
  margin-top: 30px;
  font-size: 0.9em;
  padding-top: 15px;
  border-top: 1px solid var(--outline);
}

.post-share a {
  text-decoration: none;
  margin-right: 10px;
  color: var(--accent-link);
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .post h1 {
    font-size: 1.5em;
  }

  .post-container {
    padding: 15px;
  }

  .post-content {
    font-size: 0.95rem;
  }

  .post-featured-image {
    margin: 15px 0;
  }

  nav {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 250px;
    background: var(--surface);
    color: var(--on-surface);
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    will-change: transform;
    box-shadow: 2px 0 5px rgba(0,0,0,0.3);
    z-index: 1001;
  }

  #nav-toggle:checked ~ nav {
    transform: translateX(0);
  }

  nav ul {
    flex-direction: column;
    padding: 16px;
  }

  nav li {
    margin: 8px 0;
  }

  nav a {
    color: var(--on-surface);
    display: block;
    padding: 8px 0;
  }

  .nav-overlay {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    z-index: 1000;
  }

  #nav-toggle:checked ~ .nav-overlay {
    display: block;
  }
}

@media (min-width: 601px) {
  .nav-toggle-label {
    display: none;
  }
  .back-button {
    display: none;
  }
  nav {
    margin-left: auto;
  }
  nav ul {
    justify-content: flex-end;
    flex-wrap: nowrap;
  }
}

/* Spinner styles for radio play buttons and main player */
.play-btn .spinner,
.play-pause-btn .spinner {
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

.play-btn.loading .spinner,
.play-pause-btn.loading .spinner {
  display: inline-block;
}

.play-btn.loading .label,
.play-pause-btn.loading .label {
  visibility: hidden;
}

@keyframes spin {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Utility page for nadraimage */
.utility-page {
  text-align: center;
  padding: 2rem;
}

.utility-page video,
.utility-page canvas,
.utility-page img {
  max-width: 100%;
  border: 1px solid var(--outline);
  margin-top: 1rem;
  border-radius: 4px;
}

.utility-page button {
  margin: 1rem;
}

footer {
  text-align: center;
  padding: 16px;
  margin-top: 40px;
  color: var(--on-surface);
}

footer nav {
  margin-bottom: 8px;
}

footer nav a {
  color: var(--on-surface);
  margin: 0 8px;
  text-decoration: none;
}

footer nav a:hover {
  text-decoration: underline;
  color: var(--hover-link);
}

.ad-container {
  margin: 20px 0;
  text-align: center;
}
