/* Blinking effect for timer when 5s or less left */
.timer-blink {
  animation: timerBlink 0.7s steps(1) infinite alternate;
}
@keyframes timerBlink {
  0% { opacity: 1; }
  100% { opacity: 0.2; }
}

/* nostr-banner.css - Final Optimized Version */
#event-banner {
  position: fixed;
  /* Desktop: original-style placement near the logo (upper-left). */
  top: 12px;
  left: 102px; /* logo (34px) + ~50px + gap */
  right: auto;
  transform: translateY(-100%);
  width: 100%;
  max-width: 600px;
  background: rgba(15, 15, 15, 0.32);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: white;
  padding: 8px 14px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  border-radius: 10px;
  box-shadow: 0 5px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
              opacity 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-sizing: border-box;
  visibility: hidden;
}

/* Large desktop: allow a bit more width so the banner fills the nav space better */
@media (min-width: 1280px) {
  #event-banner { max-width: 680px; }
}

#event-banner.visible {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.banner-flex {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 20px;
}

#banner-media {
  width: 80px;
  height: 48px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  background-color: rgba(30, 30, 30, 0.6);
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1), opacity 0.6s;
  opacity: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transform: translateX(-100%);
}

#banner-media.media-in {
  opacity: 1;
  transform: translateX(10%);
}

#banner-media.has-media::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.35);
  transition: opacity 0.3s;
  z-index: 1;
}

#banner-media.has-media:hover::after {
  opacity: 0;
}

#banner-media:hover {
  transform: scale(2);
}

#banner-media.image {
  background-size: cover;
  background-position: center;
}

#banner-media.video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#banner-media .play-icon {
  position: absolute;
  font-size: 24px;
  color: white;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

#banner-content {
  flex-grow: 1;
  min-width: 0;
  max-width: calc(100% - 20px);
  padding: 5px 12px;
}

#banner-message {
  font-size: 0.74em;
  line-height: 1.45;
  margin-bottom: 6px;
  font-weight: 300;
  letter-spacing: 0.3px;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  text-align: left;
}

#banner-message strong {
  font-weight: 700;
}

#banner-message a.banner-link {
  color: #FF6666;
  text-decoration: underline;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 0.84em;
  transition: color 0.2s;
}

#banner-message a.banner-link:hover {
  color: #FF3333;
  text-decoration: none;
}

#banner-message .highlight {
  color: #FFCC00;
  font-weight: 600;
  background: rgba(255, 204, 0, 0.15);
  padding: 0 4px;
  border-radius: 4px;
}

#banner-timer {
  display: none;
  gap: 10px;
  font-size: 13px;
  justify-content: flex-start;
  margin-top: 4px;
  flex-wrap: wrap;
  font-weight: 500;
}

.timer-unit {
  padding: 6px 12px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  min-width: 55px;
  text-align: center;
  font-weight: bold;
  font-size: 0.92em;
  color: #fff;
}

.close-banner {
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  border: none;
  font-size: 18px;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
  transition: all 0.3s;
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 10;
}

.close-banner:hover {
  color: white;
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(90deg);
}

/* YouTube specific styles */
#banner-media.youtube .youtube-thumbnail {
  position: relative;
  width: 100%;
  height: 100%;
}

#banner-media.youtube img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

#banner-media.youtube:hover img {
  transform: scale(1.05);
}

#banner-media.youtube .play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 36px;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 0 15px rgba(0,0,0,0.7);
  z-index: 2;
  opacity: 0.9;
  transition: opacity 0.3s, transform 0.3s;
}

#banner-media.youtube:hover .play-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.1);
}

/* Responsive styles */
@media (max-width: 1024px) {
  #event-banner {
    width: 90%;
    padding: 18px;
  }

  #banner-media {
    width: 120px;
    height: 70px;
  }
}

/* Mobile expanded banner: full-width, no horizontal overflow, close X always visible */
@media (max-width: 768px) {
  #event-banner {
    width: 100vw;
    max-width: 100vw;
    left: 0;
    right: 0;
    top: 70px;
    flex-direction: column;
    padding: 12px 0 12px 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow-x: hidden;
    overflow-y: visible;
    border-radius: 8px;
    box-sizing: border-box;
  }

  .banner-flex {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  #banner-media {
    width: 100%;
    height: 170px;
    margin-bottom: 0;
    border-radius: 10px;
    transform: none;
  }

  #banner-media.image {
    height: auto;
  }

  #banner-media.image img {
    width: 100%;
    height: auto;
    max-height: 340px;
    object-fit: contain;
    display: block;
  }

  #banner-media.media-in {
    transform: none;
  }

  #banner-content {
    max-width: 100%;
    text-align: center;
    padding: 0 8px;
  }

  #banner-message {
    font-size: 15px;
    padding: 0 12px;
    text-align: center;
  }

  #banner-timer {
    width: 100%;
    justify-content: center;
    margin-top: 10px;
    padding: 0 12px;
    font-size: 14px;
  }

  #banner-media:hover {
    transform: none;
  }

  .close-banner {
    top: 8px;
    right: 8px;
    width: 38px;
    height: 38px;
    font-size: 24px;
    z-index: 20;
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
  }
}

@media (max-width: 480px) {
  #event-banner {
    top: 60px;
    border-radius: 8px;
    width: 100vw;
    max-width: 100vw;
    left: 0;
    right: 0;
    padding: 8px 0 8px 0;
    box-sizing: border-box;
  }

  .timer-unit {
    padding: 5px 8px;
    font-size: 13px;
    min-width: 45px;
  }

  #banner-media {
    height: 140px;
  }

  #banner-message {
    padding: 0 8px;
  }

  .close-banner {
    top: 4px;
    right: 4px;
    width: 32px;
    height: 32px;
    font-size: 20px;
  }
}

/* Compact navbar banner (mobile, placed between logo and hamburger) */
#mobile-nostr-banner {
  display: none;              /* JS toggles */
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 6px;

  align-self: stretch;

  flex: 1;
  min-width: 0;

  margin: 0;
  height: 100%;

  /* Reserve space on the right so text never sits under the dismiss X */
  padding: 12px 40px 12px 12px;
  min-height: 72px;
  position: relative;

  border-radius: 4px;
  background: rgba(15, 15, 15, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.10);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  color: #fff;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
}

#mobile-nostr-banner .mobile-banner-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

#mobile-nostr-banner.visible {
  display: flex;
}

#mobile-nostr-banner .mobile-banner-thumb {
  width: 66px;
  height: 40px;
  border-radius: 8px;
  flex-shrink: 0;
  background: rgba(30, 30, 30, 0.6);
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}

#mobile-nostr-banner .mobile-banner-text {
  min-width: 0;
  font-size: 9px;
  line-height: 1.18;
  flex: 1;

  white-space: normal;
  display: -webkit-box;
  line-clamp: 4;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

#mobile-nostr-banner .mobile-banner-timer {
  flex-shrink: 0;
  margin-left: 0;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.9;
  white-space: nowrap;
  font-family: 'Courier New', monospace;
  align-self: flex-start;
}

#mobile-nostr-banner strong {
  font-weight: 700;
}

#mobile-nostr-banner .mobile-banner-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 20;
}

#mobile-nostr-banner .mobile-banner-dismiss:hover {
  background: rgba(255, 255, 255, 0.2);
}

#mobile-nostr-banner .mobile-banner-text a {
  color: #FF6666;
  text-decoration: underline;
}

/* Narrow devices */
@media (max-width: 425px) {
  #mobile-nostr-banner,
  #mobile-nostr-banner.visible {
    max-width: 100vw;
    left: 0;
    right: 0;
    margin: 0 auto;
  }
}

@media (max-width: 380px) {
  #mobile-nostr-banner {
    padding-right: 34px;
  }

  #mobile-nostr-banner .mobile-banner-dismiss {
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
  }

  #mobile-nostr-banner .mobile-banner-text {
    font-size: 9px;
  }

  #mobile-nostr-banner .mobile-banner-thumb {
    width: 46px;
    height: 28px;
  }
}

@media (max-width: 360px) {
  #mobile-nostr-banner {
    padding-right: 30px;
  }
}
