/* Blog theme variable bridge: map blog variables to site's theme tokens */
:root {
  --bg-primary: var(--background);
  --bg-secondary: var(--secondary);
  --text-primary: var(--foreground);
  --text-secondary: var(--muted-foreground);
  /* border already exists in global theme; keep alias for consistency */
  --border: var(--border);
  /* derive a darker primary tone if not defined globally */
  --primary-dark: color-mix(in srgb, var(--primary) 85%, #000 15%);
}

/* Blog Styles */
.blog-section {
  padding: 4rem 0;
  background: var(--bg-primary);
}

.blog-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.blog-header {
  text-align: center;
  margin-bottom: 3rem;
}

.blog-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.blog-description {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Blog Grid */
.blog-grid, .blogs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-bottom: 3rem;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .blog-grid, .blogs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

@media (max-width: 768px) {
  .blog-grid, .blogs-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.blog-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.blog-image {
  position: relative;
  height: 12rem;
  width: 100%;
  overflow: hidden;
  background: var(--secondary);
  border-radius: var(--radius) var(--radius) 0 0;
}

.blog-image img {
  width: 100%;
  height: 100%;
  min-height: 12rem;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
  display: block;
}

@media (max-width: 640px) {
  .blog-image {
    height: 10rem;
  }
  
  .blog-image img {
    min-height: 10rem;
  }
}

@media (max-width: 480px) {
  .blog-image {
    height: 9rem;
  }
  
  .blog-image img {
    min-height: 9rem;
  }
}

.blog-card:hover .blog-image img {
  transform: scale(1.05);
}

.featured-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.blog-content {
  padding: 1.5rem;
}

.blog-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.blog-category {
  background: var(--primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 15px;
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.blog-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.blog-excerpt {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.blog-tag {
  background: var(--bg-primary);
  color: var(--text-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
}

.blog-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.blog-author {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.read-more-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.read-more-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.delete-btn {
  background: #ef4444;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 0.5rem;
}

.delete-btn:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

/* Admin Panel */
.admin-controls {
  margin-bottom: 2rem;
  text-align: center;
}

.admin-toggle {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-toggle:hover {
  background: var(--primary-dark);
}

.login-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-label {
  font-weight: 500;
  color: var(--text-primary);
}

.form-input {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.form-textarea {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 1rem;
  min-height: 200px;
  resize: vertical;
  font-family: inherit;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-checkbox input {
  width: auto;
}

.login-btn, .submit-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.login-btn:hover, .submit-btn:hover {
  background: var(--primary-dark);
}

.logout-btn {
  background: #ef4444;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 1rem;
}

.logout-btn:hover {
  background: #dc2626;
}

.admin-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.admin-panel h3 {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.admin-form {
  display: grid;
  gap: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Messages */
.message {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-weight: 500;
  border-left: 4px solid;
}

.message-success {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border-color: #10b981;
}

.message-error {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border-color: #ef4444;
}

.message-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border-color: #f59e0b;
}

.message-info {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  border-color: #3b82f6;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: var(--bg-primary);
  margin: 2% auto;
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.1);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-primary);
  z-index: 1001;
  transition: all 0.2s ease;
}

.close-modal:hover {
  background: rgba(0, 0, 0, 0.2);
}

.modal-blog-header {
  position: relative;
}

.modal-blog-image {
  width: 100%;
  height: 300px;
  object-fit: cover;
}

.modal-blog-meta {
  padding: 2rem;
  background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.modal-blog-category {
  background: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.modal-blog-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 1rem 0;
  line-height: 1.3;
}

.modal-blog-info {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.modal-blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.modal-blog-content {
  padding: 2rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.modal-blog-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2rem 0 1rem 0;
}

.modal-blog-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1.5rem 0 0.75rem 0;
}

.modal-blog-content p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.modal-blog-content pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.modal-blog-content code {
  background: var(--bg-secondary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: 'Monaco', 'Consolas', monospace;
  font-size: 0.875rem;
}

.modal-blog-content pre code {
  background: none;
  padding: 0;
}

.no-blogs {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 3rem;
  grid-column: 1 / -1;
}

/* GitHub Integration Styles */
.github-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.github-status h4 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.125rem;
}

.github-status p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.status-connected {
  color: #10b981;
  font-weight: 600;
}

.status-disconnected {
  color: #ef4444;
  font-weight: 600;
}

.github-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.github-info {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0;
}

/* Admin Panel Styles */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.admin-header h3 {
  color: var(--text-primary);
  margin: 0;
}

.admin-actions {
  display: flex;
  gap: 1rem;
}

/* Load More Button */
.load-more-container {
  text-align: center;
  margin: 3rem 0;
}

#load-more-btn {
  padding: 1rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#load-more-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

#load-more-btn:active {
  transform: translateY(0);
}

/* Enhanced Blog Modal Styles with Better UX */
.blog-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  display: none;
  justify-content: center;
  align-items: flex-start;
  z-index: 10000;
  padding: 0;
  overflow-y: auto;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.blog-modal-content {
  background: var(--bg-primary);
  border-radius: 0;
  width: 100%;
  max-width: 900px;
  min-height: 100vh;
  overflow: visible;
  box-shadow: 0 0 100px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  margin: 0 auto;
  position: relative;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #a855f7);
  z-index: 10001;
  transition: width 0.1s ease-out;
}

/* Enhanced Modal Header */
.blog-modal-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background: var(--bg-primary);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.05);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-action-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  position: relative;
}

.modal-action-btn:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-action-btn.bookmarked {
  background: linear-gradient(135deg, var(--primary), #667eea);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(118, 75, 162, 0.3);
}

.modal-action-btn .tooltip {
  position: absolute;
  bottom: -35px;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-action-btn:hover .tooltip {
  opacity: 1;
}

.close-modal {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 1.25rem;
}

.close-modal:hover {
  background: #ef4444;
  color: white;
  border-color: #ef4444;
  transform: scale(1.1) rotate(90deg);
}

.close-modal .icon {
  width: 20px;
  height: 20px;
}

/* Enhanced Modal Body */
.blog-modal-body {
  padding: 3rem;
  overflow-y: visible;
  background: var(--bg-primary);
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .blog-modal-body {
    padding: 2rem 1.5rem;
  }
}

/* Beautiful Blog Title */
#modal-blog-title {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 2rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text-primary), var(--primary));
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleFadeIn 0.6s ease-out;
}

@keyframes titleFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  #modal-blog-title {
    font-size: 2rem;
  }
}

/* Enhanced Meta Container */
.modal-blog-meta-container {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 3rem;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  animation: metaFadeIn 0.6s ease-out 0.2s both;
}

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

.modal-meta-primary {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.modal-meta-secondary {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

/* Enhanced Meta Elements */
.modal-blog-category {
  background: linear-gradient(135deg, var(--primary), #667eea);
  color: white;
  padding: 0.625rem 1.25rem;
  border-radius: 24px;
  font-weight: 600;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 12px rgba(118, 75, 162, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-blog-category:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(118, 75, 162, 0.4);
}

.modal-blog-author {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.modal-blog-author::before {
  content: '';
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #667eea);
  display: inline-block;
}

.modal-meta-divider {
  color: var(--text-secondary);
  opacity: 0.4;
  font-weight: 300;
}

.modal-blog-date,
.modal-blog-read-time {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.modal-blog-date:hover,
.modal-blog-read-time:hover {
  color: var(--text-primary);
}

.icon-xs {
  width: 16px;
  height: 16px;
  opacity: 0.8;
}

/* Excerpt Callout */
.modal-blog-excerpt {
  background: linear-gradient(135deg, rgba(118, 75, 162, 0.08), rgba(102, 126, 234, 0.08));
  border-left: 4px solid var(--primary);
  padding: 1.5rem;
  margin-bottom: 3rem;
  border-radius: 0 12px 12px 0;
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--text-secondary);
  font-style: italic;
  animation: excerptSlideIn 0.6s ease-out 0.3s both;
}

@keyframes excerptSlideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Modal Blog Image */
.modal-blog-image {
  margin: 0 -3rem 3rem -3rem;
  border-radius: 0;
  overflow: hidden;
  max-height: 500px;
  background: var(--secondary);
  animation: imageFadeIn 0.6s ease-out 0.4s both;
}

@keyframes imageFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-blog-image img {
  width: 100%;
  height: 100%;
  min-height: 300px;
  max-height: 500px;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: zoom-in;
  display: block;
}

.modal-blog-image img:hover {
  transform: scale(1.05);
}

@media (max-width: 768px) {
  .modal-blog-image {
    margin: 0 -1.5rem 2rem -1.5rem;
    max-height: 400px;
  }
  
  .modal-blog-image img {
    min-height: 250px;
    max-height: 400px;
  }
}

@media (max-width: 480px) {
  .modal-blog-image {
    max-height: 300px;
  }
  
  .modal-blog-image img {
    min-height: 200px;
    max-height: 300px;
  }
}

/* Enhanced Blog Text Content */
.modal-blog-text {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-primary);
  max-width: 720px;
  margin: 0 auto;
  animation: contentFadeIn 0.6s ease-out 0.5s both;
}

@keyframes contentFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-blog-text p {
  margin-bottom: 1.75rem;
  color: var(--text-primary);
  font-size: 1.125rem;
  line-height: 1.8;
}

.modal-blog-text h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 3rem 0 1.5rem 0;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.modal-blog-text h3 {
  font-size: 1.625rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2.5rem 0 1.25rem 0;
  line-height: 1.4;
}

.modal-blog-text h4 {
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2rem 0 1rem 0;
}

.modal-blog-text ul,
.modal-blog-text ol {
  margin: 1.5rem 0;
  padding-left: 2rem;
}

.modal-blog-text li {
  margin-bottom: 0.75rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.modal-blog-text a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: all 0.2s ease;
}

.modal-blog-text a:hover {
  color: #667eea;
  text-decoration-thickness: 3px;
}

.modal-blog-text blockquote {
  margin: 2rem 0;
  padding: 1.5rem 1.5rem 1.5rem 2rem;
  border-left: 4px solid var(--primary);
  background: linear-gradient(90deg, rgba(118, 75, 162, 0.08), transparent);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-secondary);
}

.modal-blog-text img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 2rem auto;
  display: block;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: zoom-in;
}

.modal-blog-text img:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
}

.modal-blog-text strong {
  font-weight: 700;
  color: var(--text-primary);
}

.modal-blog-text em {
  font-style: italic;
  color: var(--text-secondary);
}

.modal-blog-text code {
  background: var(--bg-secondary);
  color: var(--primary);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.9em;
  border: 1px solid var(--border);
}

.modal-blog-text pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 2rem 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modal-blog-text pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.modal-blog-text hr {
  border: none;
  border-top: 2px solid var(--border);
  margin: 3rem 0;
  opacity: 0.3;
}

.modal-blog-text ul li {
  list-style-type: disc;
  padding-left: 0.5rem;
}

.modal-blog-text ul li::marker {
  color: var(--primary);
}

.modal-blog-text ol li {
  list-style-type: decimal;
  padding-left: 0.5rem;
}

.modal-blog-text ol li::marker {
  color: var(--primary);
  font-weight: 600;
}

.modal-blog-text table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modal-blog-text table th,
.modal-blog-text table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.modal-blog-text table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.modal-blog-text table tr:hover {
  background: var(--bg-secondary);
  transition: background 0.2s ease;
}

/* Enhanced Blog Tags Section */
.modal-blog-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 3rem 0 2rem 0;
  margin-top: 3rem;
  border-top: 2px solid var(--border);
  animation: tagsSlideIn 0.6s ease-out 0.6s both;
}

@keyframes tagsSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-tag {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.625rem 1.25rem;
  border-radius: 24px;
  font-size: 0.875rem;
  font-weight: 500;
  border: 2px solid var(--border);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.modal-tag:hover {
  background: linear-gradient(135deg, var(--primary), #667eea);
  color: white;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(118, 75, 162, 0.3);
}

/* Scroll to Top Button */
.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(118, 75, 162, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0;
  visibility: hidden;
  z-index: 9999;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(118, 75, 162, 0.5);
  background: #667eea;
}

.scroll-to-top svg {
  width: 24px;
  height: 24px;
}

/* Dark mode specific overrides */
[data-theme="dark"] .blog-modal-content {
  background: var(--bg-primary);
  border-color: var(--border);
}

[data-theme="dark"] .blog-modal-header {
  background: var(--bg-secondary);
  border-bottom-color: var(--border);
}

[data-theme="dark"] .blog-modal-body {
  background: var(--bg-primary);
  color: var(--text-primary);
}

[data-theme="dark"] .close-modal:hover {
  background: var(--bg-secondary);
}

/* Enhanced Blog Card Interactions */
.blog-card {
  cursor: pointer;
  position: relative;
}

.blog-card .blog-image {
  cursor: pointer;
}

.blog-card .blog-title {
  cursor: pointer;
  transition: color 0.2s ease;
}

.blog-card .blog-title:hover {
  color: var(--primary);
}

.blog-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.blog-actions .btn {
  transition: all 0.2s ease;
  flex: 1;
  min-width: 120px;
}

.blog-actions .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Loading State Enhancement */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  font-size: 1.25rem;
  color: var(--text-secondary);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Responsive Design */
@media (max-width: 768px) {
  .blog-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .blog-container {
    padding: 0 1rem;
  }
  
  .blog-title {
    font-size: 2rem;
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .blog-footer {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .modal-content {
    width: 95%;
    margin: 5% auto;
  }
  
  .modal-blog-title {
    font-size: 1.5rem;
  }
  
  .modal-blog-info {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .modal-blog-content {
    padding: 1rem;
  }
  
  .github-actions {
    flex-direction: column;
  }
  
  .admin-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .admin-actions {
    width: 100%;
    justify-content: flex-end;
  }
  
  .blog-modal {
    padding: 1rem;
  }
  
  .blog-modal-content {
    margin-top: 1rem;
    max-height: 95vh;
  }
  
  .blog-modal-body {
    padding: 1.5rem;
  }
  
  #modal-blog-title {
    font-size: 1.75rem;
  }
  
  .modal-blog-text {
    font-size: 1rem;
  }
  
  .modal-meta-primary,
  .modal-meta-secondary {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
  .message.success {
    background: #064e3b;
    color: #a7f3d0;
    border-color: #047857;
  }
  
  .message.error {
    background: #7f1d1d;
    color: #fca5a5;
    border-color: #dc2626;
  }
}

/* Hide blog section when no blogs */
.blog-section.hidden {
  display: none !important;
}

/* Hashnode Content Styling */
.hashnode-content {
  line-height: 1.8;
  color: var(--text-primary);
}

.hashnode-content h1,
.hashnode-content h2,
.hashnode-content h3,
.hashnode-content h4,
.hashnode-content h5,
.hashnode-content h6 {
  color: var(--text-primary);
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.hashnode-content h1 {
  font-size: 2rem;
}

.hashnode-content h2 {
  font-size: 1.75rem;
}

.hashnode-content h3 {
  font-size: 1.5rem;
}

.hashnode-content h4 {
  font-size: 1.25rem;
}

.hashnode-content p {
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.hashnode-content a {
  color: var(--primary);
  text-decoration: underline;
  transition: color 0.2s ease;
}

.hashnode-content a:hover {
  color: var(--primary-dark);
}

.hashnode-content ul,
.hashnode-content ol {
  margin: 1.5rem 0;
  padding-left: 2rem;
}

.hashnode-content li {
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.hashnode-content blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  background: var(--bg-secondary);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  font-style: italic;
  color: var(--text-secondary);
}

.hashnode-content pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.hashnode-content code {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.9em;
}

.hashnode-content pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
}

.hashnode-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5rem 0;
}

.hashnode-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

.hashnode-content th,
.hashnode-content td {
  border: 1px solid var(--border);
  padding: 0.75rem;
  text-align: left;
}

.hashnode-content th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.hashnode-content td {
  color: var(--text-primary);
}

.hashnode-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* External link styling in modal meta */
.modal-blog-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.modal-blog-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* "View on Hashnode" button styling */
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--bg-secondary);
  border-color: var(--primary);
  color: var(--primary);
}

/* Loading state for Hashnode */
.loading-state {
  text-align: center;
  padding: 3rem;
  font-size: 1.125rem;
  color: var(--text-secondary);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Additional Mobile Optimizations */
@media (max-width: 480px) {
  .blog-modal-header {
    padding: 1rem;
  }
  
  .modal-action-buttons {
    gap: 0.5rem;
  }
  
  .modal-action-btn {
    width: 36px;
    height: 36px;
    padding: 0.375rem;
  }
  
  .close-modal {
    width: 36px;
    height: 36px;
    padding: 0.375rem;
  }
  
  #modal-blog-title {
    font-size: 1.5rem;
    line-height: 1.2;
  }
  
  .modal-blog-meta-container {
    padding: 1rem;
  }
  
  .modal-blog-category {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
  }
  
  .modal-blog-author::before {
    width: 24px;
    height: 24px;
  }
  
  .modal-blog-excerpt {
    font-size: 1rem;
    padding: 1rem;
    margin-bottom: 2rem;
  }
  
  .modal-blog-text {
    font-size: 1rem;
  }
  
  .modal-blog-text h2 {
    font-size: 1.5rem;
  }
  
  .modal-blog-text h3 {
    font-size: 1.25rem;
  }
  
  .modal-blog-text h4 {
    font-size: 1.125rem;
  }
  
  .modal-tag {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
  }
  
  .scroll-to-top {
    bottom: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }
  
  .scroll-to-top svg {
    width: 20px;
    height: 20px;
  }
  
  .reading-progress {
    height: 3px;
  }
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Image Loading and Error Handling */
.blog-image img,
.modal-blog-image img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Fallback for broken images */
.blog-image img[alt]:after,
.modal-blog-image img[alt]:after {
  content: attr(alt);
  display: block;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  padding: 1rem;
}

/* Print styles for blog modal */
@media print {
  .blog-modal-header,
  .modal-action-buttons,
  .close-modal,
  .scroll-to-top {
    display: none !important;
  }
  
  .blog-modal {
    background: white !important;
  }
  
  .blog-modal-content {
    box-shadow: none !important;
    max-height: none !important;
  }
  
  .blog-modal-body {
    overflow: visible !important;
    max-height: none !important;
  }
  
  .modal-blog-text {
    max-width: 100% !important;
  }
}
