/* CSS Variables for consistent color management */
:root {
  /* Primary theme colors */
  --custom-orange: darkorange;
  --custom-orange-rgb: 255, 165, 0;
  --custom-orange-hover: rgb(255, 179, 0);
  
  /* Yellow/Gold colors for dark mode */
  --custom-yellow: rgb(215, 200, 42);
  --custom-yellow-rgb: 215, 200, 42;
  --custom-yellow-hover: rgb(255, 179, 0);
  --custom-gold: #FFD700;
  --custom-gold-code: #FFA500;
}

/* Dark mode links */
body.dark a,
body.dark a:link,
body.dark a:visited,
body.dark a:hover,
body.dark a:focus,
body.dark a:active {
  color: var(--custom-yellow) !important;
  text-decoration: none !important;
}

/* Dark mode hover */
body.dark a:hover,
body.dark a:focus,
body.dark a:active {
  color: var(--custom-yellow-hover) !important;
}
body:not(.dark) code {
  color: var(--custom-orange);
  background-color: #eee;
}

body:not(.dark) pre code {
  color: var(--custom-orange);
  background-color: #f5f5f5;
}



/* Light mode links */
body:not(.dark) a,
body:not(.dark) a:link,
body:not(.dark) a:visited,
body:not(.dark) a:hover,
body:not(.dark) a:focus,
body:not(.dark) a:active {
  color: var(--custom-orange) !important;
  text-decoration: none !important;
}

/* Light mode hover */
body:not(.dark) a:hover,
body:not(.dark) a:focus,
body:not(.dark) a:active {
  color: var(--custom-orange-hover) !important;
}

body.dark code {
  color: var(--custom-gold-code);
  background-color: #333;
}

body.dark pre code {
  color: var(--custom-gold);
  background-color: #222;
}

/* Tag Search Styles */
.search-container {
  margin: 2rem 0;
  position: relative;
}

.search-input {
  width: 100%;
  max-width: 500px;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background-color: var(--entry);
  color: var(--content);
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.search-input:focus {
  outline: none;
  border-color: var(--theme);
  box-shadow: 0 0 0 3px rgba(255, 165, 0, 0.1);
}

.search-stats {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--secondary);
}

.terms-tags {
  transition: all 0.3s ease;
}

.tag-item {
  transition: all 0.2s ease;
}

.tag-item:not([style*="display: none"]) {
  animation: fadeIn 0.3s ease-in-out;
}

.no-results {
  text-align: center;
  padding: 2rem;
  color: var(--secondary);
  font-style: italic;
}

.no-results p {
  font-size: 1.1rem;
  margin: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Dark mode specific styles */
body.dark .search-input {
  border-color: #444;
  background-color: #2a2a2a;
}

body.dark .search-input:focus {
  border-color: var(--custom-yellow);
  box-shadow: 0 0 0 3px rgba(var(--custom-yellow-rgb), 0.1);
}

/* Light mode specific styles */
body:not(.dark) .search-input {
  border-color: #e0e0e0;
  background-color: #ffffff;
}

body:not(.dark) .search-input:focus {
  border-color: var(--custom-orange);
  box-shadow: 0 0 0 3px rgba(var(--custom-orange-rgb), 0.1);
}

/* Search Tips Styles */
.search-tips {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--secondary);
  animation: slideDown 0.3s ease-out;
}

.search-tips small {
  line-height: 1.4;
}

/* Enhanced search container for home page */
.search-container .search-input::placeholder {
  color: var(--secondary);
  opacity: 0.7;
}

/* Home page specific search styling */
#home-search {
  font-size: 16px;
  padding: 14px 18px;
}

/* Animation for search tips */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 100px;
  }
}

/* Dark mode search tips */
body.dark .search-tips {
  background-color: #2a2a2a;
  border-color: #444;
}

/* Light mode search tips */
body:not(.dark) .search-tips {
  background-color: #f8f9fa;
  border-color: #e9ecef;
}

/* Improved mobile responsiveness for home search */
@media (max-width: 768px) {
  #home-search {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 12px 16px;
  }
  
  .search-tips {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
  }
}

/* Keyboard shortcut styling */
kbd {
  background-color: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
  color: var(--content);
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  padding: 2px 4px;
  white-space: nowrap;
}

/* Dark mode kbd */
body.dark kbd {
  background-color: #333;
  border-color: #555;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
}

/* Light mode kbd */
body:not(.dark) kbd {
  background-color: #f1f3f4;
  border-color: #dadce0;
}

/* Search suggestions */
.search-input-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 500px;
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--entry);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
}

.suggestion-item {
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.2s ease;
}

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

.suggestion-item:hover,
.suggestion-item.suggestion-active {
  background-color: var(--theme);
  color: var(--entry);
}

/* Dark mode suggestions */
body.dark .search-suggestions {
  background: #2a2a2a;
  border-color: #444;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark .suggestion-item {
  border-color: #444;
}

body.dark .suggestion-item:hover,
body.dark .suggestion-item.suggestion-active {
  background-color: var(--custom-yellow);
  color: #1a1a1a;
}

/* Light mode suggestions */
body:not(.dark) .search-suggestions {
  background: #ffffff;
  border-color: #e0e0e0;
}

body:not(.dark) .suggestion-item:hover,
body:not(.dark) .suggestion-item.suggestion-active {
  background-color: var(--custom-orange);
  color: white;
}

/* Home Page Improvements */
.home-welcome {
  text-align: center;
  margin: 1.5rem 0 2.5rem 0;
  padding: 2rem 1rem;
  background: var(--entry);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.home-welcome h1 {
  margin: 0 0 1rem 0;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--content);
}

.home-welcome p {
  margin: 0;
  font-size: 1.1rem;
  color: var(--secondary);
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto;
}

/* Section Headers */
.home-section-header {
  text-align: center;
  margin: 3rem 0 2rem 0;
}

.home-section-header h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.8rem;
  color: var(--content);
}

.home-section-header p {
  margin: 0;
  color: var(--secondary);
  font-size: 1rem;
}

/* Featured Post Styling */
.home-featured-post {
  position: relative;
  border: 2px solid var(--theme);
  background: var(--entry);
  margin-bottom: 2rem;
  border-radius: 8px;
  overflow: visible;
}

/* Ensure proper padding for featured post content */
.home-featured-post .entry-header,
.home-featured-post .entry-content,
.home-featured-post .entry-footer {
  padding-left: 1rem;
  padding-right: 1rem;
}

.home-featured-post .entry-header {
  padding-top: 1rem;
  padding-bottom: 0.5rem;
}

.home-featured-post .entry-content {
  padding-bottom: 0.5rem;
}

.home-featured-post .entry-footer {
  padding-bottom: 1rem;
}

.featured-post-badge {
  position: absolute;
  top: -1px;
  right: -1px;
  background: var(--theme);
  color: var(--entry);
  padding: 0.5rem 1rem;
  border-radius: 0 6px 0 8px;
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 10;
}

.home-regular-post {
  margin-bottom: 1.5rem;
}

/* Compact spacing for home posts */
.home-post-item .entry-header h2 {
  margin-bottom: 0.5rem;
}

.home-post-item .entry-content {
  margin-bottom: 0.75rem;
}

.home-post-item .entry-footer {
  margin-top: 0.75rem;
}

/* Dark mode specific styles */
body.dark .home-welcome {
  background: #2a2a2a;
  border-color: #444;
}

body.dark .home-featured-post {
  border-color: var(--custom-yellow);
}

body.dark .featured-post-badge {
  background: var(--custom-yellow);
  color: #1a1a1a;
}

/* Light mode specific styles */
body:not(.dark) .home-featured-post {
  border-color: var(--custom-orange);
}

body:not(.dark) .featured-post-badge {
  background: var(--custom-orange);
  color: white;
}

/* View All Posts Section */
.home-view-all {
  text-align: center;
  margin: 3rem 0 2rem 0;
  padding: 2rem 1rem;
  background: var(--entry);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.home-view-all h3 {
  margin: 0 0 1rem 0;
  font-size: 1.4rem;
  color: var(--content);
}

.home-view-all p {
  margin: 0 0 1.5rem 0;
  color: var(--secondary);
  font-size: 1rem;
}

.view-all-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  align-items: center;
}

.view-all-btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--theme);
  color: var(--entry) !important;
  text-decoration: none !important;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 2px solid var(--theme);
}

.view-all-btn:hover {
  background: transparent;
  color: var(--theme) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Dark mode view all section */
body.dark .home-view-all {
  background: #2a2a2a;
  border-color: #444;
}

body.dark .view-all-btn {
  background: var(--custom-yellow);
  color: #1a1a1a !important;
  border-color: var(--custom-yellow);
}

body.dark .view-all-btn:hover {
  background: transparent;
  color: var(--custom-yellow) !important;
  box-shadow: 0 4px 12px rgba(var(--custom-yellow-rgb), 0.2);
}

/* Light mode view all section */
body:not(.dark) .view-all-btn {
  background: var(--custom-orange);
  color: white !important;
  border-color: var(--custom-orange);
}

body:not(.dark) .view-all-btn:hover {
  background: transparent;
  color: var(--custom-orange) !important;
  box-shadow: 0 4px 12px rgba(var(--custom-orange-rgb), 0.2);
}

/* Responsive view all buttons */
@media (max-width: 768px) {
  .view-all-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .view-all-btn {
    padding: 0.75rem 2rem;
    width: 100%;
    max-width: 250px;
  }
  
  .home-view-all {
    margin: 2rem 0 1.5rem 0;
    padding: 1.5rem 1rem;
  }
}

/* CTF Platform Styling */
.ctf-platform-title {
  color: var(--theme);
  font-weight: 600;
}

.ctf-platform-separator {
  color: var(--secondary);
  margin: 0 0.5rem;
}

/* Dark mode CTF platform */
body.dark .ctf-platform-title {
  color: var(--custom-yellow);
}

/* Light mode CTF platform */
body:not(.dark) .ctf-platform-title {
  color: var(--custom-orange);
}

/* Lightbox Styles */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  cursor: pointer;
}

.lightbox-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 20px 20px 120px 20px; /* Added more bottom padding for controls */
  box-sizing: border-box;
}

.lightbox-image {
  max-width: 90%;
  max-height: 70%; /* Reduced from 80% to ensure space for caption */
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease;
  user-select: none;
  cursor: default;
}

.lightbox-image:hover {
  cursor: grab;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  background: none;
  border: none;
  color: white;
  font-size: 40px;
  font-weight: 300;
  cursor: pointer;
  z-index: 10001;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

.lightbox-caption {
  margin-top: 15px;
  color: white;
  text-align: center;
  font-size: 16px;
  max-width: 80%;
  line-height: 1.4;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 20px;
  border-radius: 20px;
  margin-bottom: 20px; /* Ensure space above controls */
  z-index: 10001; /* Ensure caption is above other elements */
}

.lightbox-controls {
  position: fixed; /* Changed from absolute to fixed for better positioning */
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 20px;
  border-radius: 25px;
  backdrop-filter: blur(10px);
  z-index: 10002; /* Higher z-index to ensure it's always on top */
}

.lightbox-controls button {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  min-width: 40px;
}

.lightbox-controls .lightbox-reset {
  width: auto;
  min-width: 60px;
  padding: 0 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.lightbox-controls button:hover {
  background: var(--custom-orange);
  border-color: var(--custom-orange);
  transform: scale(1.1);
}

/* Dark mode specific lightbox styles */
body.dark .lightbox-controls button:hover {
  background: var(--custom-yellow);
  border-color: var(--custom-yellow);
  color: #1a1a1a;
}

/* Responsive lightbox */
@media (max-width: 768px) {
  .lightbox-content {
    padding: 10px 10px 100px 10px; /* Adjusted bottom padding for mobile */
  }
  
  .lightbox-image {
    max-width: 95%;
    max-height: 65%; /* Further reduced for mobile to ensure caption visibility */
  }
  
  .lightbox-close {
    top: 10px;
    right: 15px;
    font-size: 30px;
    width: 40px;
    height: 40px;
  }
  
  .lightbox-caption {
    font-size: 14px;
    margin-top: 10px;
    margin-bottom: 15px;
    padding: 8px 16px;
    max-width: 90%;
  }
  
  .lightbox-controls {
    bottom: 15px; /* Closer to bottom on mobile */
    gap: 10px;
    padding: 8px 16px;
  }
  
  .lightbox-controls button {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}

/* Image hover effect for clickable images */
.post-content img:not([data-no-lightbox]),
.entry-content img:not([data-no-lightbox]),
article img:not([data-no-lightbox]) {
  transition: all 0.3s ease;
  border-radius: 4px;
}

.post-content img:not([data-no-lightbox]):hover,
.entry-content img:not([data-no-lightbox]):hover,
article img:not([data-no-lightbox]):hover {
  transform: scale(1.02);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

/* Dark mode image hover effects */
body.dark .post-content img:not([data-no-lightbox]):hover,
body.dark .entry-content img:not([data-no-lightbox]):hover,
body.dark article img:not([data-no-lightbox]):hover {
  box-shadow: 0 4px 20px rgba(215, 200, 42, 0.2);
}

/* Light mode image hover effects */
body:not(.dark) .post-content img:not([data-no-lightbox]):hover,
body:not(.dark) .entry-content img:not([data-no-lightbox]):hover,
body:not(.dark) article img:not([data-no-lightbox]):hover {
  box-shadow: 0 4px 20px rgba(255, 165, 0, 0.2);
}

/* Keyboard shortcut hint */
.lightbox-controls::after {
  content: "ESC to close • +/- to zoom • 0 to reset";
  position: absolute;
  top: -45px; /* Moved further up */
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.5);
  padding: 5px 10px;
  border-radius: 10px;
  pointer-events: none;
  z-index: 10003;
}

@media (max-width: 768px) {
  .lightbox-controls::after {
    content: "Tap to close • Pinch to zoom";
    font-size: 11px;
    top: -35px; /* Adjusted for mobile */
  }
}

/* Figure and Caption Styling */
figure {
  margin: 2rem 0;
  text-align: center;
}

figure img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

figcaption {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--secondary);
  line-height: 1.5;
  font-style: italic;
  max-width: 90%;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1rem;
}

figcaption strong {
  color: var(--content);
  font-style: normal;
  font-weight: 600;
}

/* Dark mode figure styling */
body.dark figure img {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

body.dark figure img:hover {
  box-shadow: 0 6px 20px rgba(215, 200, 42, 0.2);
}

/* Light mode figure styling */
body:not(.dark) figure img:hover {
  box-shadow: 0 6px 20px rgba(255, 165, 0, 0.2);
}

/* Responsive figure styling */
@media (max-width: 768px) {
  figure {
    margin: 1.5rem 0;
  }
  
  figcaption {
    font-size: 0.85rem;
    padding: 0 0.5rem;
  }
}

/* Image Caption Styling */
.post-content img + em,
.entry-content img + em,
article img + em {
  display: block;
  text-align: center;
  font-style: normal;
  margin: 0.5rem auto 1.5rem auto;
  padding: 0.5rem 1rem;
  color: var(--secondary);
  font-size: 0.9rem;
  line-height: 1.4;
  max-width: 80%;
  background: var(--code-bg);
  border-radius: 6px;
  border-left: 3px solid var(--theme);
}

/* Dark mode captions */
body.dark .post-content img + em,
body.dark .entry-content img + em,
body.dark article img + em {
  background: #2a2a2a;
  border-left-color: var(--custom-yellow);
}

/* Light mode captions */
body:not(.dark) .post-content img + em,
body:not(.dark) .entry-content img + em,
body:not(.dark) article img + em {
  background: #f8f9fa;
  border-left-color: var(--custom-orange);
}

/* Responsive caption styling */
@media (max-width: 768px) {
  .post-content img + em,
  .entry-content img + em,
  article img + em {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
    max-width: 95%;
  }
}

/* Enhanced Code Block Styling */
.highlight {
  position: relative;
  margin: 1.5rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

/* Language label for code blocks */
.code-lang-label {
  position: absolute;
  top: 8px;
  left: 12px;
  background: var(--theme);
  color: var(--entry);
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 4px;
  z-index: 15;
  opacity: 1;
  pointer-events: none;
  font-family: var(--font-mono, 'Courier New', monospace);
}

/* Dark mode language label */
body.dark .code-lang-label {
  background: var(--custom-yellow);
  color: #1a1a1a;
}

/* Light mode language label */
body:not(.dark) .code-lang-label {
  background: var(--custom-orange);
  color: white;
}

/* Code block content adjustments */
.highlight pre {
  padding-top: 2.5rem !important; /* Make room for language label */
  margin: 0;
  overflow-x: auto;
}

/* Language label for code blocks */
.code-lang-label {
  position: absolute;
  top: 8px;
  left: 12px;
  background: var(--theme);
  color: var(--entry);
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 4px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* Show language label on hover */
.highlight:hover .code-lang-label {
  opacity: 0.9;
}

/* Enhanced Code Copy Button Styling */
.copy-code {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  background: rgba(255, 255, 255, 0.9) !important;
  border: 1px solid var(--border) !important;
  color: var(--content) !important;
  padding: 6px 10px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  backdrop-filter: blur(10px) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  z-index: 10 !important;
  min-width: 60px !important;
  justify-content: center !important;
  opacity: 0 !important;
  transform: translateY(-4px) !important;
}

/* Ensure copy button works for all code blocks */
.highlight .copy-code {
  pointer-events: auto !important;
}

/* Show copy button on hover */
.highlight:hover .copy-code {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

.copy-code::before {
  content: "📋";
  font-size: 14px;
  margin-right: 2px;
}

.copy-code:hover {
  background: var(--theme) !important;
  color: var(--entry) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

.copy-code:active {
  transform: translateY(0) !important;
}

/* Dark mode copy button */
body.dark .copy-code {
  background: rgba(42, 42, 42, 0.95) !important;
  border-color: #444 !important;
  color: #e0e0e0 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

body.dark .copy-code:hover {
  background: var(--custom-yellow) !important;
  color: #1a1a1a !important;
}

/* Light mode copy button */
body:not(.dark) .copy-code {
  background: rgba(255, 255, 255, 0.95) !important;
  border-color: #ddd !important;
  color: #333 !important;
}

body:not(.dark) .copy-code:hover {
  background: var(--custom-orange) !important;
  color: white !important;
}

/* Dark mode code styling */
body.dark .highlight {
  background: #1e1e1e;
  border-color: #333;
}

/* Light mode code styling */
body:not(.dark) .highlight {
  background: #f8f9fa;
  border-color: #e9ecef;
}

/* Responsive code blocks */
@media (max-width: 768px) {
  .copy-code {
    top: 6px !important;
    right: 6px !important;
    padding: 4px 8px !important;
    font-size: 11px !important;
    min-width: 50px !important;
  }
  
  .copy-code::before {
    font-size: 12px;
  }
  
  .code-lang-label {
    top: 6px;
    left: 8px;
    padding: 3px 6px;
    font-size: 9px;
  }
  
  /* Always show on mobile for better UX */
  .copy-code {
    opacity: 0.7 !important;
    transform: translateY(0) !important;
  }
  
  .code-lang-label {
    opacity: 0.7;
  }
}

/* Transparent PNG Image Handling */
/* Add subtle background for transparent images on dark theme */
body.dark img[src$=".png"] {
  background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0),
              linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
  background-color: #ffffff;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Alternative simpler approach - uncomment this and comment above if you prefer solid background */
/*
body.dark img[src$=".png"] {
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
*/

/* Light theme - no special handling needed, but add subtle shadow for consistency */
body:not(.dark) img[src$=".png"] {
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* For images that are specifically marked as having transparent backgrounds */
img[data-transparent="true"],
img.transparent-bg {
  background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0),
              linear-gradient(45deg, #f0f0f0 25%, transparent 25%, transparent 75%, #f0f0f0 75%, #f0f0f0);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
  background-color: #ffffff;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Override for images that should NOT have the transparent background treatment */
body.dark img[data-transparent="false"],
body.dark img.no-transparent-bg {
  background: none !important;
  padding: 0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  body.dark img[src$=".png"] {
    padding: 6px;
    background-size: 15px 15px;
    background-position: 0 0, 7.5px 7.5px;
  }
  
  img[data-transparent="true"],
  img.transparent-bg {
    padding: 6px;
    background-size: 15px 15px;
    background-position: 0 0, 7.5px 7.5px;
  }
}
