/* ========================================
   БАЗОВІ СТИЛІ
   ======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Кольори */
  --bg-main: #e8e6e3;
  --bg-card: #f5f4f2;
  --text-primary: #2c2c2c;
  --text-secondary: #666;
  --accent: #4a90e2;
  --accent-hover: #357abd;
  --border: #d0ccc7;
  --playing-glow: #4a90e2;
  
  /* Розміри */
  --header-height: 80px;
  --footer-height: auto;
  --gap: 12px;
  --border-radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ========================================
   HEADER
   ======================================== */
header {
  background-color: var(--bg-card);
  padding: 20px 5%;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: relative;
}

header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: linear-gradient(to bottom, rgba(208, 204, 199, 0.15), rgba(208, 204, 199, 0));
  pointer-events: none;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo-container {
  flex-shrink: 0;
}

.site-logo {
  height: 40px;
  width: auto;
  display: block;
}

.tagline {
  font-size: 32px;
  color: var(--text-primary);
  font-weight: 700;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
main {
  flex: 1;
  padding: 40px 5%;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

/* ========================================
   СІТКА РАДІОСТАНЦІЙ (FLEXBOX)
   ======================================== */
.stations-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  justify-content: center;
}

.station-card {
  background-color: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--border-radius);
  padding: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.station-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: var(--accent);
}

.station-card.playing {
  border-color: var(--playing-glow);
  box-shadow: 0 0 20px rgba(74, 144, 226, 0.3);
  background-color: #fff;
}

.station-card.playing::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 3px solid var(--playing-glow);
  border-radius: var(--border-radius);
  animation: pulse 2s infinite;
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

.station-logo {
  width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
}

.station-name {
  display: none;
}

/* ========================================
   FOOTER
   ======================================== */
footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 40px 5%;
  margin-top: 60px;
  position: relative;
}

footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: linear-gradient(to top, rgba(208, 204, 199, 0.15), rgba(208, 204, 199, 0));
  pointer-events: none;
  transform: translateY(-100%);
}

.footer-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.footer-about {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 600px;
}

.footer-brand-link {
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.2s ease;
}

.footer-brand-link:hover {
  color: var(--accent);
}

.footer-share {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.share-btn {
  background-color: #B657E2;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 32px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.share-btn:hover {
  background-color: #9f3dd1;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(182, 87, 226, 0.3);
}

.share-btn.copied {
  background-color: #27ae60;
}

/* ========================================
   АДАПТИВНІСТЬ (FLEXBOX MAGIC)
   ======================================== */

/* Desktop: 57% ширини, 5 карток в ряд */
@media (min-width: 1024px) {
  .stations-grid {
    width: 57%;
    margin: 0 auto;
  }
  
  .station-card {
    width: calc((100% - (var(--gap) * 4)) / 5);
    aspect-ratio: 1;
  }
}

/* Tablet (горизонтально і вертикально): 77%, 5 в ряд */
@media (min-width: 768px) and (max-width: 1023px) {
  .stations-grid {
    width: 77%;
    margin: 0 auto;
  }
  
  .station-card {
    width: calc((100% - (var(--gap) * 4)) / 5);
    aspect-ratio: 1;
  }
}

/* Smartphone (вертикально): 88%, 3 в ряд */
@media (max-width: 767px) {
  .stations-grid {
    width: 88%;
    margin: 0 auto;
  }
  
  .station-card {
    width: calc((100% - (var(--gap) * 2)) / 3);
    aspect-ratio: 1;
  }
  
  .header-content {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }
  
  .tagline {
    font-size: 24px;
  }
  
  .footer-content {
    gap: 20px;
  }
  
  .footer-about {
    font-size: 14px;
  }
}

/* Smartphone (горизонтально): 88%, 4 в ряд */
@media (max-width: 767px) and (orientation: landscape) {
  .station-card {
    width: calc((100% - (var(--gap) * 3)) / 4);
  }
}

/* Дуже маленькі екрани */
@media (max-width: 480px) {
  .site-logo {
    height: 32px;
  }
  
  .tagline {
    font-size: 20px;
  }
  
  main {
    padding: 24px 5%;
  }
}
