/* Popup styles */
.popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(0px);
  transition: all 0.3s ease;
  opacity: 0;
}

.popup-overlay.show {
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  opacity: 1;
}

.popup-content {
  background: var(--bg-color, #1a1a1a);
  border-radius: 12px;
  padding: 0;
  max-width: 90vw;
  max-height: 90vh;
  width: 800px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color, #333);
  overflow: hidden;
  position: relative;
  transform: scale(0.7) translateY(50px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  opacity: 0;
}

.popup-overlay.show .popup-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.popup-header {
  padding: 20px 25px 15px 25px;
  border-bottom: 1px solid var(--border-color, #333);
  background: var(--header-bg, #222);
  position: sticky;
  top: 0;
  z-index: 10;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.popup-header h2 {
  margin: 0;
  color: var(--text-color, #fff);
  font-size: 1.5rem;
  font-weight: 600;
}

.popup-close {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-color, #fff);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.popup-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.popup-close-header {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-color, rgba(255, 255, 255, 0.7));
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.popup-close-header:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-color, #fff);
  transform: scale(1.1);
}

.markdown-body {
  padding: 25px;
  overflow-y: auto;
  max-height: calc(90vh - 100px);
  color: var(--text-color, #fff);
  line-height: 1.6;
  text-align: left;
}

/* Loading animation */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-color, #fff);
  font-size: 1.1rem;
}

.loading::after {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--accent-color, #fff);
  animation: spin 1s ease-in-out infinite;
  margin-left: 10px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Markdown content styling */
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  color: var(--text-color, #fff);
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.markdown-body h1 { font-size: 2rem; }
.markdown-body h2 { font-size: 1.75rem; }
.markdown-body h3 { font-size: 1.5rem; }
.markdown-body h4 { font-size: 1.25rem; }
.markdown-body h5 { font-size: 1.1rem; }
.markdown-body h6 { font-size: 1rem; }

.markdown-body p {
  margin-bottom: 1rem;
  color: var(--text-color, rgba(255, 255, 255, 0.9));
}

.markdown-body ul,
.markdown-body ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

.markdown-body li {
  margin-bottom: 0.5rem;
  color: var(--text-color, rgba(255, 255, 255, 0.9));
}

.markdown-body code {
  background-color: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  color: var(--accent-color, #ff6b6b);
}

.markdown-body pre {
  background-color: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.markdown-body pre code {
  background: none;
  padding: 0;
  color: var(--text-color, rgba(255, 255, 255, 0.9));
}

.markdown-body blockquote {
  border-left: 4px solid var(--accent-color, #666);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-color, rgba(255, 255, 255, 0.8));
  font-style: italic;
}

.markdown-body a {
  color: var(--link-color, #61dafb);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.markdown-body a:hover {
  border-bottom-color: var(--link-color, #61dafb);
}

.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1rem 0;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.75rem;
  text-align: left;
}

.markdown-body th {
  background-color: rgba(255, 255, 255, 0.1);
  font-weight: 600;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  margin: 2rem 0;
}

/* Dark theme variables */
.theme-dark {
  --bg-color: #1a1a1a;
  --header-bg: #222;
  --border-color: #333;
  --text-color: #fff;
  --accent-color: #61dafb;
  --link-color: #61dafb;
}

/* Light theme variables */
.theme-light {
  --bg-color: #fff;
  --header-bg: #f8f9fa;
  --border-color: #e1e4e8;
  --text-color: #24292e;
  --accent-color: #0366d6;
  --link-color: #0366d6;
}

/* Responsive design */
@media (max-width: 768px) {
  .popup-content {
    width: 95vw;
    max-height: 95vh;
  }
  
  .popup-header {
    padding: 15px 20px 10px 20px;
  }
  
  .popup-header h2 {
    font-size: 1.3rem;
  }
  
  .popup-close {
    top: 10px;
    right: 15px;
    width: 35px;
    height: 35px;
    font-size: 1.5rem;
  }
  
  .markdown-body {
    padding: 20px;
    max-height: calc(95vh - 80px);
  }
}

@media (max-width: 480px) {
  .popup-content {
    width: 98vw;
    max-height: 98vh;
  }
  
  .markdown-body {
    padding: 15px;
    max-height: calc(98vh - 70px);
  }
}

/* Click hint styles for description */
#description {
  position: relative;
  transition: all 0.2s ease;
}

#description:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

.click-hint {
  display: inline-block;
  opacity: 0.6;
  font-size: 0.9em;
  margin-left: 0.3em;
  transition: all 0.2s ease;
  vertical-align: super;
  font-weight: normal;
}

#description:hover .click-hint {
  opacity: 1;
  transform: translateX(2px);
}

/* Pulse animation for the hint */
@keyframes pulse-hint {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.click-hint {
  animation: pulse-hint 2s infinite;
}

#description:hover .click-hint {
  animation: none;
}
