:root {
  --primary-color: #830c0c;
  --primary-light: #c74a4a;
  --primary-gradient: linear-gradient(135deg, #700303, #863434);
  --secondary-color: #f8f9fa;
  --background-color: #0a0a0a;
  --surface-color: #1a1a1a;
  --code-background: #1e1e1e;
  --border-color: #333;
  --text-muted: #888;
  --success-color: #28a745;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.4);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.7;
  background: var(--background-color);
  color: var(--secondary-color);
  font-size: 16px;
}

ul, li, ol {
  margin-left: 10px;
}

/* Header Navigation */
.header-nav {
  position: sticky;
  top: 0;
  background: rgba(10, 10, 10, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  margin-bottom: 2rem;
  z-index: 100;
}

.nav-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.back-to-blog {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

.back-to-blog:hover {
  color: var(--primary-color);
  transform: translateX(-3px);
}

.post-meta-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.reading-time {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Main Content */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}

.blog-post {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Article Header */
.article-header {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
}

.challenge-badge {
  display: inline-block;
  background: var(--primary-gradient);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
  letter-spacing: 0.5px;
}

.article-header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  margin-bottom: 1rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.article-meta {
  display: flex;
  justify-content: center;
  gap: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.article-intro {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--primary-color);
  padding: 1.5rem;
  border-radius: 8px;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-muted);
}

/* Content Sections */
section {
  margin-bottom: 2rem;
}

h2 {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--secondary-color);
  margin-bottom: 1rem;
  position: relative;
  padding-left: 1rem;
}

h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.3rem;
  width: 4px;
  height: 1.2rem;
  background: var(--primary-gradient);
  border-radius: 2px;
}

h3 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--primary-light);
  margin: 2rem 0 1rem;
}

p {
  margin-bottom: 1.5rem;
  color: #e0e0e0;
}

/* Code Blocks */
.code-block {
  position: relative;
  margin: 2rem 0;
  background: var(--code-background);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.code-header {
  background: var(--surface-color);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.code-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.copy-button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.copy-button:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
}

.copy-button.copied {
  background: var(--success-color);
}

pre {
  margin: 0;
  padding: 1.5rem;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Output Examples */
.output-example {
  background: linear-gradient(135deg, #4a1a1a, #4a2d2d);
  border: 1px solid #6e4a4a;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  color: #ee9090;
  position: relative;
  margin: 1.5rem 0;
}

.output-example::before {
  content: 'Output';
  position: absolute;
  top: -8px;
  left: 1rem;
  background: #4a2d2d;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  color: #ee9090;
  font-weight: 600;
}

/* Inline Code */
code:not(pre code) {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  color: var(--primary-light);
  font-weight: 500;
}

/* Highlight Box */
.highlight-box {
  background: linear-gradient(135deg, rgba(151, 19, 19, 0.1), rgba(199, 74, 74, 0.1));
  border: 1px solid rgba(151, 19, 19, 0.3);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2rem 0;
  position: relative;
}

.highlight-box::before {
  content: '💡';
  position: absolute;
  top: -10px;
  left: 1rem;
  background: var(--background-color);
  padding: 0 0.5rem;
  font-size: 1.2rem;
}

/* Table Styles */
.tb-blog {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-family: 'Inter', sans-serif;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.tb-blog th {
  background-color: var(--primary-color);
  color: white;
  padding: 12px 15px;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

.tb-blog td {
  padding: 12px 15px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.tb-blog tr:last-child td {
  border-bottom: none;
}

.modal-img {
  display: flex;
  align-items: center;
}

.modal-img img{
  max-width: 100%;
  margin-bottom: 20px;
}

.logo-sticky img {
  width: 130%;
  height: auto;
}

.logo-sticky {
  position: fixed;
  bottom: 10px;
  right: 30px;
  z-index: 999;
  width: 50px;
  height: auto;
  max-width: 30vw;
  max-height: 30vh;
  opacity: 0.8;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-sticky:hover {
  opacity: 1;
  transform: scale(1.2) rotate(5deg);
  cursor: pointer;
}

/* Article Footer */
.article-footer {
  padding-top: 2rem;
  border-top: 2px solid var(--border-color);
}

.conclusion {
  background: var(--surface-color);
  border-radius: 12px;
  padding: 2rem;
  margin-bottom: 2rem;
  border-left: 4px solid var(--primary-light);
}

.conclusion h3 {
  color: var(--primary-light);
  margin-bottom: 1rem;
  font-weight: 800;
  font-size: 1.2rem;
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-color);
  color: var(--secondary-color);
  text-decoration: none;
  padding: 1rem 1.5rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  font-weight: 500;
}

.github-link:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* Navigation */
.post-navigation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 2rem 0;
}

.nav-button {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--secondary-color);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-button:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.nav-button.next {
  text-align: right;
}

.nav-button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--surface-color);
}

.nav-button.disabled:hover {
  transform: none;
  box-shadow: none;
}

.nav-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nav-title {
  font-weight: 600;
  font-size: 1rem;
}

/* Related Posts */
.related-posts {
  margin-top: 3rem;
}

.related-posts h3 {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 1.5rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.related-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--secondary-color);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.related-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary-gradient);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.related-card:hover::before {
  transform: scaleX(1);
}

.related-card:hover {
  background: rgba(151, 19, 19, 0.1);
  border-color: var(--primary-color);
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.related-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.related-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--secondary-color);
}

.related-excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.related-tags {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  background: rgba(151, 19, 19, 0.2);
  color: var(--primary-light);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 1rem;
    flex-direction: column;
    gap: 1rem;
  }

  .container {
    padding: 0 1rem 4rem;
  }

  .article-meta {
    flex-direction: column;
    gap: 0.5rem;
  }

  .post-navigation {
    grid-template-columns: 1fr;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .code-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .logo-sticky {
    width: 40px;
    right: 15px;
  }

  .logo-sticky img {
    width: 100%;
    height: auto;
  }

  .logo-sticky:hover {
    transform: scale(1.1) rotate(5deg);
  }
}

/* Scroll Progress */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(151, 19, 19, 0.2);
  z-index: 1000;
}

.scroll-progress-bar {
  height: 100%;
  background: var(--primary-gradient);
  width: 0%;
  transition: width 0.1s ease;
}

/* Animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeInUp 0.6s ease forwards;
}