/* ─── MARKET UPDATES — EXACT HOMEPAGE INSIGHTS AESTHETIC ─────────────── */

/* Page Section (Matches homepage .section-wrap.alt exactly) */
.news-page-section,
.section-page {
  padding: calc(var(--nav-height, 68px) + 36px) 8% 96px 8%;
  background: var(--bg-alt);
  min-height: calc(100vh - 200px);
}

@media (max-width: 768px) {
  .news-page-section,
  .section-page {
    padding: calc(var(--nav-height, 68px) + 20px) 5% 64px 5%;
  }
}

.news-container,
.section-page-container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Header layout: title on left, date selector on right (Matches .section-page-header) */
.news-section-head,
.section-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 36px;
  position: relative;
  flex-wrap: wrap;
}

.news-title-group,
.section-title-group {
  display: flex;
  flex-direction: column;
}

.news-section-label,
.section-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent-blue);
  display: block;
  margin-bottom: 8px;
}

.news-section-title,
.section-page-title {
  font-family: 'Newsreader', Georgia, serif;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  color: var(--accent-navy);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* ─── FLOATING DATE SELECTOR (Flat corners, subtle, compact) ─── */
.date-selector-wrapper {
  position: relative;
  flex-shrink: 0;
}

.date-selector-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 250px;
  max-width: 100%;
  padding: 8px 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px; /* Flat corners requested, not rounded pill */
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-navy);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.date-selector-btn:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.date-selector-btn[aria-expanded="true"] {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.date-selector-icon {
  color: #0284c7; /* Clean blue calendar icon */
  flex-shrink: 0;
  font-size: 14px;
}

.date-selector-text {
  flex: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--accent-navy);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.date-selector-chevron {
  color: #94a3b8;
  flex-shrink: 0;
  transition: transform 0.2s ease;
  font-size: 12px;
}

.date-selector-btn[aria-expanded="true"] .date-selector-chevron {
  transform: rotate(180deg);
  color: var(--accent-blue);
}

/* Compact Date Popover Dropdown */
.date-selector-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 256px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 5px; /* Flat crisp corners */
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.06);
  padding: 14px 14px 10px;
  z-index: 100;
  display: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.date-selector-popover.open {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.date-popover-header {
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.date-popover-month {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-navy);
  letter-spacing: -0.01em;
}

.date-popover-count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.date-popover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 6px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 2px;
}

.date-popover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: 4px; /* Crisp flat corners */
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.date-popover-item:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.date-popover-item.active {
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.22);
}

.popover-item-label {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.popover-day-num {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--accent-navy);
  min-width: 18px;
}

.popover-day-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.date-popover-item.active .popover-day-num {
  color: var(--accent-blue);
}

.date-popover-item.active .popover-day-name {
  color: var(--accent-blue);
  font-weight: 600;
}

.popover-active-dot {
  font-size: 14px;
  line-height: 1;
  color: var(--accent-blue);
  font-weight: 800;
  margin-left: 2px;
}

.date-popover-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.date-popover-reset-btn {
  background: none;
  border: none;
  font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-blue);
  cursor: pointer;
  padding: 2px 4px;
  transition: color 0.15s;
}

.date-popover-reset-btn:hover {
  text-decoration: underline;
}

/* Ensure no gap between .insights-tabs and .insights-tab-pane */
.insights-tabs {
  margin-bottom: -1px !important;
  gap: 0 !important;
}

.insights-tab-pane {
  background: var(--card-bg) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 0 12px 12px 12px !important;
  padding: 32px !important;
  box-shadow: var(--shadow-card) !important;
  min-height: 400px;
}

@media (max-width: 768px) {
  .news-section-head {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 18px;
  }

  .date-selector-wrapper {
    width: 100%;
  }

  .date-selector-btn {
    width: 100%;
  }

  .date-selector-popover {
    width: 100%;
    left: 0;
    right: 0;
  }

  /* Horizontally scrollable category tabs on mobile */
  .insights-tabs {
    display: flex;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 2px;
  }

  .insights-tabs::-webkit-scrollbar {
    display: none;
  }

  .insight-tab {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .insights-tab-pane {
    padding: 20px !important;
    border-radius: 0 8px 8px 8px !important;
  }
}

/* ─── DATE SECTION DIVIDERS (Exact Equal Symmetrical Spacing) ─── */
.date-section-block {
  margin-top: 32px;
  scroll-margin-top: 84px;
}

.date-section-block:first-child {
  margin-top: 0;
}

.date-section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 0;
  margin-bottom: 32px;
}

.date-section-block:first-child .date-section-header {
  margin-top: 0;
  margin-bottom: 28px;
}

.date-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-main);
  white-space: nowrap;
  line-height: 1;
}

.date-section-rule {
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.date-section-count {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  line-height: 1;
}

/* ─── CARDS GRID (Matches homepage .posts-grid style & gaps) ─── */
.news-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 36px;
}

@media (max-width: 768px) {
  .news-cards-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* ─── HOMEPAGE MARKET UPDATES PREVIEW (#market-insights) ─── */
/* Default Desktop (3 columns): 1 full row = 3 cards */
#market-insights .news-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 32px;
}

#market-insights .news-card-item:nth-child(n+4) {
  display: none;
}

/* Large monitors (min-width: 1400px): 4 columns, 1 full row = 4 cards */
@media (min-width: 1400px) {
  #market-insights .news-cards-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  #market-insights .news-card-item:nth-child(4) {
    display: flex;
  }
  #market-insights .news-card-item:nth-child(n+5) {
    display: none;
  }
}

/* Medium screens & tablets (769px to 1100px): 2 columns, 2 full rows = 4 cards */
@media (max-width: 1100px) and (min-width: 769px) {
  #market-insights .news-cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  #market-insights .news-card-item:nth-child(4) {
    display: flex;
  }
  #market-insights .news-card-item:nth-child(n+5) {
    display: none;
  }
}

/* Mobile (max-width: 768px): 1 column, top 3 cards */
@media (max-width: 768px) {
  #market-insights .news-cards-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  #market-insights .news-card-item:nth-child(n+4) {
    display: none;
  }
}

.news-card-item {
  background: var(--card-bg, #ffffff);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  box-shadow: var(--shadow-card);
  position: relative;
  cursor: pointer;
}

@media (hover: hover) {
  .news-card-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: #cbd5e1;
  }
  .news-card-item:hover .news-card-img {
    transform: scale(1.04);
  }
  .news-card-item:hover .news-card-headline a {
    color: var(--accent-blue);
  }
}

/* Card Thumbnail (16:9 ratio matching homepage post cards) */
.news-card-thumb {
  aspect-ratio: 16/9;
  width: 100%;
  height: auto;
  overflow: hidden;
  background: var(--border-subtle);
  position: relative;
  flex-shrink: 0;
  display: block;
}

/* Origin Badge on Top-Left of Image Box (Subtle, Muted Translucent Glass) */
.origin-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6.5px;
  border-radius: 4px;
  line-height: 1.2;
  z-index: 3;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(15, 23, 42, 0.42);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.origin-badge.global,
.origin-badge.india {
  background: rgba(15, 23, 42, 0.42);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.news-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
  image-rendering: -webkit-optimize-contrast;
}

.news-card-item:hover .news-card-img {
  transform: scale(1.03);
}

.news-card-fallback-logo {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #f1f5f9;
}

.news-card-fallback-logo img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: #ffffff;
  padding: 2px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.news-card-fallback-logo span {
  font-size: 11.5px;
  font-weight: 700;
  color: #475569;
}

/* Card Content (Matches homepage .post-body styling) */
.news-card-body {
  padding: 20px 20px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

@media (max-width: 768px) {
  .news-card-body {
    padding: 16px 16px 14px;
  }
}

.news-card-meta {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 8px;
}

/* Item 2 Kept: Subtle Origin Tag + Source only (NO date inside card) */
.origin-tag {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1.5px 6px;
  border-radius: 3px;
  line-height: 1.2;
}

.origin-tag.global {
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent-blue);
  border: 1px solid rgba(37, 99, 235, 0.16);
}

.origin-tag.india {
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.18);
}

/* Source name only (date removed as requested) */
.source-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

/* Headline */
.news-card-headline {
  font-family: 'Newsreader', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-navy);
  line-height: 1.3;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 3; /* Allows full headline across 3 lines */
  -webkit-box-orient: vertical;
  line-clamp: 3;
  overflow: clip;
}

.news-card-headline a {
  color: inherit;
  transition: color 0.15s;
}

/* Card-wide clickable link overlay: clicking anywhere on card opens story */
.news-card-headline a::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.news-card-headline a:hover {
  color: var(--accent-blue);
}

/* Summary - closed neatly with zero trailing margin */
.news-card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  overflow: clip;
}

.news-card-thumb {
  position: relative;
  z-index: 2;
}

/* Related coverage links positioned above overlay */
.news-related-coverage {
  position: relative;
  z-index: 2;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.news-related-coverage a {
  color: var(--accent-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Redundant footer & read-more link removed to close card box */
.news-card-footer,
.news-read-more {
  display: none !important;
}

/* Floating Return-To-Top Button */
.floating-top-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--accent-navy);
  color: #ffffff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
  border: none;
  cursor: pointer;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.floating-top-btn.visible {
  opacity: 1;
  visibility: visible;
}

.floating-top-btn:hover {
  background: var(--accent-blue);
  transform: translateY(-2px);
}

/* Empty State */
.news-no-results {
  text-align: center;
  padding: 50px 20px;
  background: var(--card-bg);
  border-radius: 8px;
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
}
