:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --text: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #dc2626;
  --primary-dark: #b91c1c;
  --accent: #1d4ed8;
  --shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
  --radius: 14px;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #111827;
  --surface-alt: #1f2937;
  --text: #f3f4f6;
  --text-muted: #9ca3af;
  --border: #263143;
  --primary: #ef4444;
  --primary-dark: #dc2626;
  --accent: #60a5fa;
  --shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: "Noto Sans Malayalam", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  transition: background 0.2s ease, color 0.2s ease;
}

.container {
  width: 100%;
  max-width: 1260px;
  margin: 0 auto;
  padding: 0 18px;
}

/* Ticker */
.ticker-bar {
  background: #111827;
  color: #fff;
  font-size: 0.875rem;
  border-bottom: 2px solid var(--primary);
}

.ticker-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 7px;
  padding-bottom: 7px;
}

.ticker-badge {
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.ticker-track-wrap {
  overflow: hidden;
  white-space: nowrap;
  flex: 1;
}

.ticker-content {
  display: inline-block;
  animation: tickerScroll 38s linear infinite;
}

.ticker-content:hover {
  animation-play-state: paused;
}

@keyframes tickerScroll {
  0% { transform: translateX(40%); }
  100% { transform: translateX(-100%); }
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #f97316);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.28);
}

.brand h1 {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.25;
}

.brand-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box input {
  width: 240px;
  max-width: 100%;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.search-box input:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-ghost {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  padding: 10px 22px;
}

.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}

/* Main */
.main-content {
  padding-top: 22px;
  padding-bottom: 48px;
}

/* Dashboard Stats */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.65rem;
  font-weight: 800;
  color: var(--primary);
}

/* Filters */
.filters-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
}

.filter-group select {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}

.filter-status {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill:hover {
  border-color: var(--primary);
}

.pill.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Analytics Strip */
.analytics-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.analytics-header h2 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.category-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.cat-bar-item {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}

.cat-bar-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.cat-bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.cat-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #f97316);
  border-radius: 999px;
}

/* Error Banner */
.error-banner {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-weight: 600;
}

/* Hero Section */
.hero-section {
  margin-bottom: 24px;
}

.hero-card {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.16s ease;
}

.hero-card:hover {
  transform: translateY(-2px);
}

.hero-image-wrap {
  min-height: 300px;
  max-height: 380px;
  background: var(--surface-alt);
  overflow: hidden;
}

.hero-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(220, 38, 38, 0.12);
  color: var(--primary);
}

.badge-premium {
  background: rgba(245, 158, 11, 0.18);
  color: #b45309;
}

.hero-title {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.45;
}

.hero-excerpt {
  color: var(--text-muted);
  font-size: 0.94rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* News Grid */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}

.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.news-card:hover {
  transform: translateY(-3px);
}

.news-thumb {
  height: 185px;
  background: var(--surface-alt);
  overflow: hidden;
}

.news-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.news-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 10px;
}

.news-title {
  font-size: 1.03rem;
  font-weight: 700;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-snippet {
  font-size: 0.87rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.news-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.read-more-link {
  color: var(--primary);
  font-weight: 700;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 28px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 60;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-card {
  background: var(--surface);
  color: var(--text);
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 16px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.modal-close {
  position: sticky;
  top: 12px;
  float: right;
  margin: 12px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 2;
}

.modal-body {
  padding: 24px;
}

.modal-hero-img {
  width: 100%;
  max-height: 380px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 16px;
}

.modal-title {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.4;
  margin: 10px 0 8px;
}

.modal-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.modal-content p {
  margin-bottom: 14px;
  font-size: 1rem;
  line-height: 1.8;
}

/* Empty & Skeleton */
.empty-state {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px;
  text-align: center;
  color: var(--text-muted);
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 18px 0;
  text-align: center;
  font-size: 0.84rem;
  color: var(--text-muted);
}

@media (max-width: 820px) {
  .hero-card {
    grid-template-columns: 1fr;
  }
  .hero-image-wrap {
    min-height: 220px;
  }
  .search-box input {
    width: 180px;
  }
}

/* Details Page */
.brand-link {
  text-decoration: none;
  color: inherit;
}

.detail-main {
  max-width: 920px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.detail-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 36px 0;
}

.detail-title {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.4;
  margin: 12px 0;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.detail-image-wrap {
  margin-bottom: 22px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-alt);
}

.detail-image-wrap img {
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  display: block;
}

.detail-content p {
  font-size: 1.05rem;
  line-height: 1.85;
  margin-bottom: 16px;
}

.detail-video-box {
  margin-top: 20px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.detail-actions a {
  text-decoration: none;
}

.related-section {
  margin-top: 34px;
}

.related-heading {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .detail-card {
    padding: 18px;
  }
  .detail-title {
    font-size: 1.35rem;
  }
}

