/*
 * Blog Post Enhanced Styles
 * Modern styling for technical blog posts with code syntax highlighting
 * Author: Kripanshu Singh
 * Version: 1.0
 */

/* ========================================
   Enhanced Prism.js Code Block Styling
   ======================================== */

pre[class*="language-"] {
  margin: 20px 0;
  border-radius: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

code[class*="language-"] {
  font-family: "Fira Code", "Monaco", "Consolas", "Courier New", monospace;
}

/* Enhanced Code Toolbar Styling */
.code-toolbar {
  position: relative;
  overflow: visible;
}

.code-toolbar .toolbar {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  opacity: 1 !important;
  transition: all 0.3s ease;
}

.code-toolbar .toolbar .toolbar-item {
  display: inline-block;
}

/* Enhanced Copy Button */
.code-toolbar .toolbar .toolbar-item button,
.code-toolbar .toolbar .toolbar-item a {
  background: rgba(0, 0, 0, 0.8) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 6px !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.code-toolbar .toolbar .toolbar-item button:hover,
.code-toolbar .toolbar .toolbar-item a:hover {
  background: rgba(102, 126, 234, 0.9) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4) !important;
}

/* Copy Button Success State */
.code-toolbar .toolbar .toolbar-item button.copy-success {
  background: rgba(76, 175, 80, 0.9) !important;
  border-color: rgba(255, 255, 255, 0.4) !important;
}

.code-toolbar .toolbar .toolbar-item button.copy-success:hover {
  background: rgba(76, 175, 80, 1) !important;
}

/* Copy Button Icon Enhancement */
.code-toolbar .toolbar .toolbar-item button::before,
.code-toolbar .toolbar .toolbar-item a::before {
  /* content: "📋"; */
  margin-right: 4px;
  font-size: 12px;
}

.code-toolbar .toolbar .toolbar-item button.copy-success::before {
  /* content: "✅"; */
  animation: copySuccess 0.3s ease;
}

@keyframes copySuccess {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* Toolbar visibility on hover */
.code-toolbar:not(:hover) .toolbar {
  opacity: 0.7;
}

.code-toolbar:hover .toolbar {
  opacity: 1;
}

/* Line numbers styling */
.line-numbers .line-numbers-rows {
  border-right: 1px solid #444 !important;
  padding-right: 10px !important;
}

/* ========================================
   Comparison Tables
   ======================================== */

.comparison-table {
  margin: 30px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.comparison-table table {
  min-width: 700px;
  width: 100%;
}

.comparison-table th {
  background-color: #6a6a6a;
  color: white;
  text-align: center;
  font-size: 14px;
  padding: 12px 15px;
  white-space: nowrap;
}

.comparison-table td {
  vertical-align: middle;
  padding: 15px;
  font-size: 14px;
  min-width: 200px;
}

.pros {
  color: #28a745;
  font-weight: 500;
}

.cons {
  color: #dc3545;
  font-weight: 500;
}

/* ========================================
   Highlight Boxes
   ======================================== */

.highlight-box {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  /* color: white; */
  padding: 25px;
  border-radius: 12px;
  margin: 30px 0;
}

.highlight-box h3 {
  color: white;
  margin-bottom: 15px;
}

.highlight-box .trend-list {
  list-style: none;
  padding: 0;
}

.highlight-box .trend-list li {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.highlight-box .trend-list i {
  color: #4caf50;
  font-size: 16px;
}

/* ========================================
   Responsive Table Wrapper
   ======================================== */

.table-responsive-wrapper {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 20px 0;
  border: 1px solid #dee2e6;
  border-radius: 8px;
}

.table-responsive-wrapper::after {
  content: "← Scroll horizontally to see all columns →";
  display: none;
  text-align: center;
  font-size: 12px;
  color: #666;
  margin-top: 10px;
  padding: 8px;
  background: #f8f9fa;
  font-style: italic;
  border-top: 1px solid #dee2e6;
}

/* ========================================
   Info Cards
   ======================================== */

.info-card {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  transition: box-shadow 0.3s ease;
}

.info-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.info-card i {
  font-size: 24px;
  color: #667eea;
  margin-bottom: 15px;
}

.info-card h4 {
  color: #2c3e50;
  margin-bottom: 15px;
  font-weight: 600;
}

.info-card ul {
  margin: 0;
  padding-left: 20px;
}

.info-card li {
  margin-bottom: 8px;
  color: #000000;
}

/* ========================================
   Content Images
   ======================================== */

.content-image {
  margin: 30px 0;
  text-align: center;
}

.content-image img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.content-image figcaption {
  margin-top: 10px;
  font-style: italic;
  color: #666;
  font-size: 14px;
}

/* ========================================
   Tags and Meta
   ======================================== */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tag {
  background: #e9ecef;
  color: #495057;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  text-decoration: none;
  transition: all 0.3s ease;
}

.tag:hover {
  background: #667eea;
  color: white;
  text-decoration: none;
}

/* ========================================
   Enhanced Scrollbars
   ======================================== */

pre[class*="language-"]::-webkit-scrollbar,
.table-responsive-wrapper::-webkit-scrollbar,
.comparison-table::-webkit-scrollbar {
  height: 8px;
}

pre[class*="language-"]::-webkit-scrollbar-track,
.table-responsive-wrapper::-webkit-scrollbar-track,
.comparison-table::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

pre[class*="language-"]::-webkit-scrollbar-thumb,
.table-responsive-wrapper::-webkit-scrollbar-thumb,
.comparison-table::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

pre[class*="language-"]::-webkit-scrollbar-thumb:hover,
.table-responsive-wrapper::-webkit-scrollbar-thumb:hover,
.comparison-table::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* ========================================
   Responsive Design - Mobile First
   ======================================== */

@media (max-width: 768px) {
  /* Code blocks */
  pre[class*="language-"] {
    font-size: 13px;
    margin: 15px 0;
    overflow-x: auto;
  }

  /* Tables */
  .table-responsive-wrapper::after {
    display: block;
  }

  .comparison-table table {
    min-width: 600px;
  }

  .comparison-table th {
    font-size: 13px;
    padding: 10px 12px;
    min-width: 120px;
  }

  .comparison-table td {
    padding: 12px;
    font-size: 13px;
    min-width: 180px;
  }

  /* Highlight boxes */
  .highlight-box {
    padding: 20px;
    margin: 20px 0;
  }

  /* Content images */
  .content-image img {
    max-width: 100%;
    height: auto;
  }

  /* Author info */
  .author-info {
    flex-direction: column;
    gap: 15px;
  }

  .author-details {
    text-align: center;
  }

  .post-meta {
    justify-content: center;
    flex-wrap: wrap;
  }

  /* Content padding */
  .article-content .content {
    padding: 0 10px;
  }

  .page-title {
    padding: 20px 0;
  }

  /* Info cards */
  .info-card {
    padding: 15px;
  }

  /* Tags */
  .tags {
    justify-content: center;
  }

  .tag {
    font-size: 11px;
    padding: 4px 8px;
  }
}

@media (max-width: 576px) {
  /* Code blocks */
  pre[class*="language-"] {
    font-size: 12px;
    margin: 10px 0;
    overflow-x: auto;
  }

  /* Tables */
  .comparison-table table {
    min-width: 500px;
  }

  .comparison-table th {
    font-size: 12px;
    padding: 8px 10px;
    min-width: 100px;
  }

  .comparison-table td {
    font-size: 12px;
    padding: 10px;
    min-width: 150px;
  }

  /* Highlight boxes */
  .highlight-box {
    padding: 15px;
    margin: 15px 0;
  }

  /* Content */
  .article-content .content {
    padding: 0;
  }

  .page-title h1 {
    font-size: 28px;
  }

  .table-responsive-wrapper::after {
    font-size: 11px;
    padding: 6px;
  }

  /* Info cards */
  .info-card {
    padding: 12px;
  }

  .info-card h4 {
    font-size: 1.1rem;
  }
}

/* ========================================
   Typography Enhancements
   ======================================== */

.article-content {
  overflow-x: hidden;
}

.lead {
  font-size: 1.25rem;
  font-weight: 300;
  line-height: 1.6;
  color: #6c757d;
}

blockquote {
  border-left: 4px solid #667eea;
  padding: 20px;
  margin: 30px 0;
  background: #f8f9fa;
  border-radius: 0 8px 8px 0;
}

blockquote p {
  margin-bottom: 10px;
  font-style: italic;
  color: #495057;
}

blockquote cite {
  font-size: 14px;
  color: #6c757d;
  font-weight: 500;
}

/* ========================================
   Dark Mode Support (Optional)
   ======================================== */

@media (prefers-color-scheme: dark) {
  .info-card {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .info-card h4 {
    color: #f7fafc;
  }

  .info-card li {
    color: #515151;
  }

  .tag {
    background: #4a5568;
    color: #e2e8f0;
  }

  .tag:hover {
    background: #667eea;
    color: white;
  }

  blockquote {
    background: #2d3748;
    color: #e2e8f0;
  }

  blockquote p {
    color: #cbd5e0;
  }

  blockquote cite {
    color: #a0aec0;
  }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
  .highlight-box,
  .comparison-table {
    break-inside: avoid;
  }

  pre[class*="language-"] {
    break-inside: avoid;
    font-size: 10px;
  }

  .table-responsive-wrapper::after {
    display: none;
  }
}
