/* Media Enhancer CSS for Wiki.js */

/* YouTube embed container */
.youtube-embed-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  max-width: 100%;
  margin: 1.5rem 0;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.youtube-embed-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

/* GIF enhancements */
img[src$=".gif"], .tenor-gif, .giphy-gif {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1rem auto;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  max-height: 500px;
}

/* GIF preview container */
.gif-preview-container {
  display: block;
  margin: 1rem auto;
  max-width: 500px;
  width: 100%;
  text-align: center;
  min-height: 100px;
}

/* GIF preview wrapper */
.gif-preview-wrapper {
  position: relative;
  display: inline-block;
  cursor: pointer;
  max-width: 100%;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* GIF preview image */
.gif-preview {
  display: block;
  max-width: 100%;
  height: auto;
  transition: filter 0.2s ease;
  filter: brightness(0.9);
  max-height: 500px;
}

/* Play button overlay */
.gif-play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 2;
}

/* Hide play button when playing */
.gif-preview-wrapper.playing .gif-play-button {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.8);
}

/* Adjust brightness when playing */
.gif-preview-wrapper.playing .gif-preview {
  filter: brightness(1);
}

/* Hover effects */
.gif-preview-wrapper:hover .gif-play-button {
  background-color: rgba(0, 0, 0, 0.7);
}

.gif-preview-wrapper:hover .gif-preview:not(.playing) {
  filter: brightness(0.95);
}

/* Tenor loading and error messages */
.tenor-loading, .tenor-error {
  padding: 1rem;
  background-color: #f5f5f5;
  border-radius: 4px;
  margin: 1rem 0;
  text-align: center;
}

.tenor-error a {
  color: #0366d6;
  text-decoration: underline;
}

/* Tenor iframe fallback */
.tenor-iframe {
  max-width: 100%;
  margin: 1rem auto;
  display: block;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Giphy embed */
.giphy-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 480px;
  margin: 1rem auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.giphy-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

/* Imgur embed */
.imgur-embed {
  display: block;
  max-width: 100%;
  margin: 1rem auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Direct GIF container */
.gif-container {
  margin: 1rem auto;
  max-width: 500px;
  text-align: center;
}

.gif-container img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Code block enhancements */
pre {
  position: relative;
  border-radius: 6px !important;
  margin: 1.5rem 0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
  overflow: visible !important; /* Allow copy button to be visible outside the pre */
}

pre code {
  font-family: 'Fira Code', 'Roboto Mono', monospace !important;
  padding: 1rem !important;
  border-radius: 6px !important;
}

.code-copy-button {
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.code-copy-button:hover {
  opacity: 1;
}

/* General media enhancements */
.v-card img:not([src$=".gif"]) {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Video element styling */
video {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Audio element styling */
audio {
  width: 100%;
  margin: 1rem 0;
}

/* Iframe general styling */
iframe:not(.youtube-embed-container iframe):not(.giphy-embed):not(.imgur-embed) {
  border: none;
  max-width: 100%;
  margin: 1rem 0;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Media caption styling */
.media-caption {
  text-align: center;
  font-style: italic;
  color: #666;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

/* Responsive media queries */
@media (max-width: 768px) {
  .youtube-embed-container,
  .giphy-container {
    margin: 1rem 0;
  }
  
  pre {
    margin: 1rem 0 !important;
  }
} 