/* Page-specific styles that extend Lunker system */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 80px 16px;
}

/* Page Header Specific Styles */
.page-header {
  text-align: center;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 16px 0;
  line-height: 1.2;
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  margin-top: 20px;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.page-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-meta-item i {
  color: var(--lunker-primary);
  font-size: 1.1rem;
}

/* User Welcome Card Specific */
.user-welcome {
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--border-radius-card);
  padding: 20px 28px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  border: 1px solid var(--lunker-secondary);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.premium-badge {
  background: #FFD700;
  color: #2d2d2d;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Table of Contents Specific */
.toc-header {
  background: var(--gradient-primary);
  color: white;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all var(--transition-medium);
}

.toc-header:hover {
  background: linear-gradient(135deg, var(--lunker-dark), var(--lunker-primary));
}

.toc-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

.toc-content {
  padding: 20px 24px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-item {
  margin-bottom: 12px;
}

.toc-link {
  color: var(--lunker-primary);
  text-decoration: none;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--border-radius-lg);
  display: block;
  transition: all var(--transition-medium);
}

.toc-link:hover {
  background: var(--lunker-light);
  color: var(--lunker-primary);
  transform: translateX(4px);
  text-decoration: none;
}

/* Markdown Content Specific */
.markdown-content {
  line-height: 1.7;
}

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

.markdown-content h1, .markdown-content h2 {
  border-bottom: 2px solid var(--lunker-primary);
  padding-bottom: 8px;
}

.markdown-content a {
  color: var(--lunker-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-medium);
}

.markdown-content a:hover {
  color: var(--lunker-secondary);
  text-decoration: underline;
}

.markdown-content p {
  margin-bottom: 1.2rem;
}

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

.markdown-content li {
  margin-bottom: 0.5rem;
}

.markdown-content li::marker {
  color: var(--lunker-primary);
}

/* Enhanced Table Wrapper and Responsive Design */
.markdown-table-wrapper {
  position: relative;
  width: 100%;
  margin: 1.5rem 0;
  border-radius: var(--border-radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-light);
  border: 1px solid var(--border-light);
  background: var(--card-background);
  scrollbar-width: thin;
  scrollbar-color: var(--lunker-primary) var(--lunker-light);
}

.markdown-table-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
  z-index: 1;
}

.markdown-table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.markdown-table-wrapper::-webkit-scrollbar-track {
  background: var(--lunker-light);
  border-radius: 4px;
}

.markdown-table-wrapper::-webkit-scrollbar-thumb {
  background: var(--lunker-primary);
  border-radius: 4px;
}

.markdown-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: var(--lunker-secondary);
}

/* Override markdown table styles with enhanced Lunker system */
.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  background: var(--card-background);
  border: none;
  border-radius: 0;
  box-shadow: none;
  min-width: 600px; /* Minimum width before scrolling */
}

.markdown-content table th {
  background: var(--gradient-primary);
  color: white;
  padding: 14px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.markdown-content table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  background: var(--card-background);
  font-size: 0.85rem;
  white-space: nowrap;
  border-left: none;
  border-right: none;
}

.markdown-content table tr:nth-child(even) td {
  background: var(--lunker-light);
}

.markdown-content table tr:hover td {
  background: var(--lunker-hover);
  color: var(--text-primary);
}

.markdown-content table tr:last-child td {
  border-bottom: none;
}

/* Hashtags Specific */
.hashtags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0;
}

/* Action Buttons Area */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 32px 0;
}

/* Success Alert for Copy */
#copyAlert {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  animation: lunker-fade-in-up 0.3s;
}

/* Enhanced Responsive Design */
@media (max-width: 968px) {
  .markdown-content table {
    min-width: 500px;
  }
  
  .markdown-content table th,
  .markdown-content table td {
    padding: 10px 8px;
    font-size: 0.8rem;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 16px 12px 60px 12px;
  }

  .page-header {
    padding: 24px 20px;
  }

  .page-title {
    font-size: 2rem;
  }

  .page-meta {
    flex-direction: column;
    gap: 12px;
  }

  .user-welcome {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn-lunker {
    width: 100%;
    justify-content: center;
  }

  .lunker-hero {
    padding: 24px 20px;
  }

  .lunker-hero-title {
    font-size: 1.5rem;
  }

  /* Mobile table optimizations */
  .markdown-content table {
    min-width: 400px;
  }
  
  .markdown-content table th,
  .markdown-content table td {
    padding: 8px 6px;
    font-size: 0.75rem;
  }
}

@media (max-width: 576px) {
  .markdown-content table {
    min-width: 350px;
  }
  
  .markdown-content table th,
  .markdown-content table td {
    padding: 6px 4px;
    font-size: 0.7rem;
  }
}

/* ========================================
   RECOMMENDED READING SECTION - REDESIGNED
   ======================================== */

.recommended-reading-section {
    margin: 60px 0;
    padding: 0;
}

.section-header {
    text-align: center;
    margin-bottom: 48px;
    position: relative;
}

.section-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.section-title-wrapper i {
    font-size: 2rem;
    color: var(--lunker-primary);
    animation: rotate 20s linear infinite;
}

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

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin: 0;
}

/* Articles Grid Layout */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 32px;
    padding: 0;
}

/* Article Card - New Design */
.article-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Image Container */
.article-image-wrapper {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.article-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.article-card:hover .article-image-wrapper img {
    transform: scale(1.1);
}

.article-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.article-image-placeholder i {
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Content Area */
.article-content {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-header {
    margin-bottom: 16px;
}

.article-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
    margin: 0 0 12px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Tags Section */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.article-tag {
    display: inline-block;
    padding: 6px 14px;
    background: linear-gradient(135deg, #667eea15, #764ba215);
    color: var(--lunker-primary);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.article-tag:hover {
    background: var(--lunker-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Excerpt */
.article-excerpt {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Read More Link */
.article-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--lunker-primary);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.read-more-btn i {
    transition: transform 0.3s ease;
}

.article-card:hover .read-more-btn {
    color: var(--lunker-secondary);
}

.article-card:hover .read-more-btn i {
    transform: translateX(4px);
}

/* Loading State */
.loading-container {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: var(--lunker-primary);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
}

.no-results i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: block;
}

.no-results h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.no-results p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .articles-grid {
        grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
        gap: 24px;
    }
}

@media (max-width: 768px) {
    .recommended-reading-section {
        margin: 40px 0;
    }
    
    .section-header {
        margin-bottom: 32px;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .article-image-wrapper {
        height: 180px;
    }
    
    .article-content {
        padding: 20px;
    }
    
    .article-title {
        font-size: 1.1rem;
    }
    
    /* Disable hover effects on touch devices */
    @media (hover: none) {
        .article-card:hover {
            transform: none;
        }
        
        .article-card:hover .article-image-wrapper img {
            transform: none;
        }
    }
}

@media (max-width: 480px) {
    .articles-grid {
        padding: 0 10px;
    }
    
    .article-card {
        border-radius: 16px;
    }
    
    .article-image-wrapper {
        height: 160px;
    }
    
    .article-content {
        padding: 16px;
    }
    
    .article-tags {
        gap: 6px;
    }
    
    .article-tag {
        padding: 4px 10px;
        font-size: 0.75rem;
    }
}