:root {
  --bg-color: #fafafa;
  --surface-color: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --border: #e2e8f0;
  --radius: 12px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --font-family: 'Inter', -apple-system, sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.2);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --border: #334155;
    --glass-bg: rgba(15, 23, 42, 0.85);
    --glass-border: rgba(255, 255, 255, 0.05);
  }
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header & Glassmorphism Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}

.logo .highlight {
  color: var(--accent);
}

/* Nav */
.nav-toggle, .nav-toggle-label {
  display: none;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.nav-list a {
  color: var(--text-muted);
  font-weight: 500;
  padding: 0.5rem 0;
  position: relative;
}

.nav-list a.active, .nav-list a:hover {
  color: var(--text-main);
}

.nav-list a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--accent);
  transition: var(--transition);
}

.nav-list a.active::after, .nav-list a:hover::after {
  width: 100%;
}

/* Search Bar */
.search-bar {
  display: flex;
  justify-content: center;
  margin: 2rem auto;
  position: relative;
  max-width: 600px;
}

.search-bar input {
  width: 100%;
  padding: 1rem 1.5rem;
  border-radius: 50px;
  border: 1px solid var(--border);
  background: var(--surface-color);
  color: var(--text-main);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.search-bar button {
  position: absolute;
  right: 6px;
  top: 6px;
  bottom: 6px;
  background: var(--accent);
  border: none;
  color: white;
  width: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.search-bar button:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

/* Ads Placeholder */
.ad-container {
  margin: 2rem auto;
  background: var(--surface-color);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#ad-top, #ad-bottom {
  height: 90px;
  max-width: 728px;
}

/* Main Content */
main {
  min-height: 60vh;
  margin-bottom: 4rem;
}

.section-title {
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}

.section-title h1 {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.5px;
}

/* Article Grid */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.article-card {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  border: 1px solid var(--glass-border);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
}

.article-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.article-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
  transition: transform 0.5s ease;
}

/* =========================================
   Featured Article & Related
   ========================================= */
.featured-article {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

.featured-article:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.2);
    transform: translateY(-2px);
}

@media (min-width: 768px) {
    .featured-article {
        grid-template-columns: 1fr 1fr;
    }
}

.featured-img-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 250px;
}

.featured-article-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.featured-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
}

.featured-content {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.featured-title {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.featured-title a {
    color: var(--text-main);
    text-decoration: none;
    transition: var(--transition);
}

.featured-title a:hover {
    color: var(--accent);
}

.featured-excerpt {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.read-more-btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 500;
    align-self: flex-start;
    transition: var(--transition);
}

.read-more-btn:hover {
    background: var(--accent-hover);
}

.article-card:hover .article-card-image {
  transform: scale(1.03);
}

.img-wrapper {
  overflow: hidden;
  position: relative;
}

.category-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: var(--accent);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.article-card-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.article-card-date {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: block;
}

.article-card-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.article-card-title a {
  color: var(--text-main);
}

.article-card-title a::before {
  content: '';
  position: absolute;
  inset: 0;
}

.article-card-title a:hover {
  color: var(--accent);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 3rem;
}

.page-btn {
  background: var(--surface-color);
  border: 1px solid var(--border);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.page-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Single Article Layout */
.single-article-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 3rem;
  margin-top: 2rem;
}

.article-header {
  margin-bottom: 2rem;
}

.article-title {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1.1;
  margin: 1rem 0;
  letter-spacing: -1px;
}

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

.article-featured-image {
  width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.article-body {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-main);
}

.article-body p {
  margin-bottom: 1.5rem;
}

.article-body h2, .article-body h3 {
  margin: 2rem 0 1rem;
  color: var(--text-main);
}

/* Sidebar & Affiliates */
.article-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.affiliate-widget {
  background: var(--surface-color);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.affiliate-widget h3 {
  font-size: 1.125rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.affiliate-link-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.affiliate-link-item:last-child {
  border-bottom: none;
}

.affiliate-link-item a {
  font-weight: 500;
  font-size: 0.9rem;
}

.affiliate-price {
  background: var(--bg-color);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
}

#ad-sidebar {
  height: 600px;
  width: 100%;
}

/* Share Buttons */
.share-buttons {
  display: flex;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.share-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--surface-color);
  border: 1px solid var(--border);
  border-radius: 50px;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  color: var(--text-main);
}

.share-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.share-btn svg {
  width: 18px;
  height: 18px;
}

/* Footer */
.site-footer {
  background: var(--surface-color);
  border-top: 1px solid var(--border);
  padding: 4rem 0 1rem;
  margin-top: 4rem;
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 3rem;
}

.footer-links h3 {
  margin-bottom: 1rem;
  font-size: 1.125rem;
}

.footer-links ul {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--accent);
}

.footer-bottom {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

/* Loading */
.loading-spinner {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 1.125rem;
  animation: pulse 1.5s infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
  .single-article-container {
    grid-template-columns: 1fr;
  }
  
  .article-title {
    font-size: 2rem;
  }

  .nav-toggle-label {
    display: block;
    cursor: pointer;
    width: 30px;
    height: 20px;
    position: relative;
    z-index: 2000;
  }

  .nav-toggle-label span,
  .nav-toggle-label span::before,
  .nav-toggle-label span::after {
    background: var(--text-main);
    display: block;
    height: 2px;
    position: absolute;
    width: 100%;
    transition: var(--transition);
  }

  .nav-toggle-label span { top: 9px; }
  .nav-toggle-label span::before { content: ''; top: -9px; }
  .nav-toggle-label span::after { content: ''; top: 9px; }

  .nav-list {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
    transform: translateY(-150%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border);
  }

  .nav-toggle:checked ~ .nav-list {
    transform: translateY(0);
  }

  .nav-toggle:checked ~ .nav-toggle-label span {
    background: transparent;
  }

  .nav-toggle:checked ~ .nav-toggle-label span::before {
    transform: rotate(45deg);
    top: 0;
  }

  .nav-toggle:checked ~ .nav-toggle-label span::after {
    transform: rotate(-45deg);
    top: 0;
  }
  
  .footer-content {
    grid-template-columns: 1fr;
  }
  
  #ad-sidebar {
    height: 250px;
  }
}
