:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --secondary: #10b981;
  --danger: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Open Sans', 'Helvetica Neue', sans-serif;
  color: var(--gray-800);
  background: #fff;
  line-height: 1.6;
}

/* Header & Navigation */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 40px;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

header h2 {
  color: var(--primary);
  font-size: 24px;
  font-weight: 700;
}

nav {
  display: flex;
  gap: 30px;
  align-items: center;
}

nav a {
  text-decoration: none;
  color: var(--gray-700);
  font-weight: 500;
  font-size: 14px;
  transition: color 0.3s ease;
}

nav a:hover {
  color: var(--primary);
}

.theme-toggle {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.3s ease;
}

.theme-toggle:hover {
  transform: scale(1.1);
}

/* Hero Section */
.hero {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 100px 40px;
  color: white;
  text-align: center;
}

.hero h1 {
  font-size: 52px;
  margin-bottom: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.hero p {
  font-size: 18px;
  margin-bottom: 30px;
  opacity: 0.95;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-cta {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn, .btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid white;
}

.btn-secondary:hover {
  background: transparent;
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* Featured Posts Section */
.featured-section {
  padding: 80px 40px;
  background: var(--gray-50);
}

.section-title {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 50px;
  text-align: center;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Post Card */
.post-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  box-shadow: 0 12px 24px rgba(0,0,0,0.15);
  transform: translateY(-8px);
}

.post-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.post-content {
  padding: 24px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.post-category {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
  width: fit-content;
}

.post-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--gray-900);
  line-height: 1.4;
}

.post-excerpt {
  color: var(--gray-600);
  margin-bottom: 16px;
  flex-grow: 1;
}

.post-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--gray-500);
  border-top: 1px solid var(--gray-200);
  padding-top: 12px;
}

.read-time {
  background: var(--gray-100);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Newsletter Section */
.newsletter-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 60px 40px;
  text-align: center;
}

.newsletter-section h3 {
  font-size: 32px;
  margin-bottom: 20px;
  font-weight: 700;
}

.newsletter-section p {
  margin-bottom: 30px;
  font-size: 16px;
  opacity: 0.9;
}

.newsletter-form {
  display: flex;
  gap: 10px;
  max-width: 500px;
  margin: 0 auto;
  flex-wrap: wrap;
  justify-content: center;
}

.newsletter-form input {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
}

.newsletter-form button {
  padding: 12px 24px;
  background: var(--secondary);
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
}

.newsletter-form button:hover {
  background: #059669;
}

/* Footer */
footer {
  background: var(--gray-900);
  color: white;
  padding: 40px;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.footer-section h4 {
  margin-bottom: 15px;
  font-size: 16px;
  font-weight: 700;
}

.footer-section a {
  display: block;
  color: var(--gray-400);
  text-decoration: none;
  margin-bottom: 8px;
  transition: color 0.3s ease;
}

.footer-section a:hover {
  color: white;
}

.footer-bottom {
  border-top: 1px solid var(--gray-700);
  padding-top: 20px;
  text-align: center;
  color: var(--gray-400);
}

/* Blog Page */
.blog-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px;
}

.blog-header {
  margin-bottom: 40px;
  text-align: center;
}

.blog-controls {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
  justify-content: center;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
}

.category-filter {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.category-btn {
  padding: 10px 16px;
  border: 2px solid var(--gray-300);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.category-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.category-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.pagination button,
.pagination a {
  padding: 10px 14px;
  border: 2px solid var(--gray-300);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.pagination .active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Post Detail Page */
.post-detail {
  max-width: 800px;
  margin: 0 auto;
  padding: 60px 40px;
}

.post-header {
  margin-bottom: 40px;
}

.post-detail h1 {
  font-size: 48px;
  line-height: 1.2;
  margin-bottom: 20px;
  font-weight: 800;
}

.post-meta-detail {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--gray-600);
  font-size: 14px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--gray-200);
}

.author-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.author-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
}

/* Post Content */
.post-body {
  margin: 40px 0;
  font-size: 16px;
  line-height: 1.8;
}

.post-body h2 {
  font-size: 28px;
  margin: 40px 0 20px 0;
  font-weight: 700;
}

.post-body h3 {
  font-size: 22px;
  margin: 30px 0 15px 0;
  font-weight: 700;
}

.post-body p {
  margin-bottom: 20px;
}

.post-body ul,
.post-body ol {
  margin-left: 20px;
  margin-bottom: 20px;
}

.post-body li {
  margin-bottom: 8px;
}

.post-body blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 20px;
  margin: 20px 0;
  color: var(--gray-600);
  font-style: italic;
}

.post-body code {
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 14px;
}

.post-body pre {
  background: var(--gray-900);
  color: #e0e0e0;
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 20px 0;
}

.post-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Social Sharing */
.social-share {
  display: flex;
  gap: 15px;
  margin: 40px 0;
  padding: 20px;
  background: var(--gray-100);
  border-radius: 8px;
  align-items: center;
}

.social-share span {
  font-weight: 600;
  color: var(--gray-700);
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  text-decoration: none;
  color: white;
  font-size: 18px;
  transition: all 0.3s ease;
}

.share-btn.twitter {
  background: #1DA1F2;
}

.share-btn.linkedin {
  background: #0A66C2;
}

.share-btn.facebook {
  background: #1877F2;
}

.share-btn:hover {
  transform: scale(1.1);
}

/* Related Posts */
.related-posts {
  margin: 60px 0;
  padding: 40px;
  background: var(--gray-50);
  border-radius: 8px;
}

.related-posts h3 {
  font-size: 24px;
  margin-bottom: 30px;
  font-weight: 700;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

/* Comments Section */
.comments-section {
  margin: 60px 0;
  padding: 40px;
  background: var(--gray-50);
  border-radius: 8px;
}

.comments-section h3 {
  font-size: 24px;
  margin-bottom: 30px;
  font-weight: 700;
}

.comment-form textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--gray-200);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 120px;
  margin-bottom: 15px;
}

.comment-form input {
  width: 100%;
  padding: 10px;
  border: 2px solid var(--gray-200);
  border-radius: 6px;
  margin-bottom: 15px;
  font-size: 14px;
}

.comment {
  background: white;
  padding: 20px;
  border-radius: 6px;
  margin-bottom: 15px;
}

.comment-author {
  font-weight: 700;
  margin-bottom: 8px;
}

.comment-date {
  font-size: 12px;
  color: var(--gray-500);
}

.comment-text {
  margin-top: 10px;
  color: var(--gray-700);
}

/* Admin Page */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.admin-card {
  background: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  text-align: center;
}

.admin-card h3 {
  font-size: 36px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

.admin-card p {
  color: var(--gray-600);
  font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 15px;
    padding: 16px 20px;
  }

  nav {
    width: 100%;
    justify-content: space-around;
    gap: 10px;
  }

  .hero {
    padding: 60px 20px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero p {
    font-size: 16px;
  }

  .section-title {
    font-size: 24px;
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .featured-section,
  .newsletter-section {
    padding: 40px 20px;
  }

  .post-detail {
    padding: 40px 20px;
  }

  .post-detail h1 {
    font-size: 32px;
  }

  .newsletter-form {
    flex-direction: column;
  }

  .newsletter-form input {
    min-width: unset;
  }

  .blog-controls {
    flex-direction: column;
  }

  .search-input {
    min-width: unset;
  }

  .social-share {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Dark Mode */
body.dark-mode {
  background: var(--gray-900);
  color: var(--gray-100);
}

body.dark-mode header {
  background: var(--gray-800);
}

body.dark-mode .hero,
body.dark-mode .featured-section {
  background: var(--gray-800);
}

body.dark-mode .post-card {
  background: var(--gray-800);
}

body.dark-mode .post-title {
  color: white;
}

body.dark-mode .post-excerpt {
  color: var(--gray-300);
}
