/**
 * TopDuoo Custom Styles & Brand Enhancements
 * Optimized for Cloudflare Pages (Free Plan) Static Hosting
 * Entertainment & News for Enthusiasts of All Ages
 */

:root {
  --topduoo-primary: #e50914;
  --topduoo-primary-hover: #b80710;
  --topduoo-dark: #0f141c;
  --topduoo-surface: #ffffff;
  --topduoo-muted: #64748b;
  --topduoo-border: #e2e8f0;
  --topduoo-radius: 8px;
  --topduoo-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --topduoo-font-heading: 'Plus Jakarta Sans', var(--topduoo-font-sans);
}

body {
  font-family: var(--topduoo-font-sans);
  color: #222934;
  background-color: #f7f9fc;
  margin: 0;
  padding: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.newsmatic_dark_mode {
  background-color: #0b0f17;
  color: #cbd5e1;
}

/* ==========================================================================
   GLITCH FIX: HEADER & BREAKING NEWS TICKER LAYOUT
   Prevents header height collapse, text wrapping overlap, and sticky jumping
   ========================================================================== */

.site-header {
  position: relative !important;
  margin: 0 0 20px 0 !important;
  background: #ffffff !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
  z-index: 100 !important;
  clear: both !important;
}

body.newsmatic_dark_mode .site-header {
  background: #0f172a !important;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
}

/* Header Top Bar */
.topduoo-topbar {
  background: #0f172a !important;
  color: #e2e8f0 !important;
  font-size: 12px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  padding: 8px 0 !important;
}

body.newsmatic_dark_mode .topduoo-topbar {
  background: #070a0f !important;
  border-bottom-color: #1e293b !important;
}

/* Row Two: Branding */
.site-header .row-wrap.row-two {
  padding: 15px 0 !important;
  background: #ffffff !important;
}

body.newsmatic_dark_mode .site-header .row-wrap.row-two {
  background: #0f172a !important;
}

/* Row Three: Sticky Navigation */
.site-header .row-wrap.row-three {
  background: #ffffff !important;
  border-top: 2px solid var(--topduoo-primary) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 999 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}

body.newsmatic_dark_mode .site-header .row-wrap.row-three {
  background: #131b26 !important;
  border-bottom-color: #263345 !important;
}

/* Force flex display so header columns never collapse or wrap onto breaking news */
.site-header .bb-bldr-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  width: 100% !important;
  grid-template-columns: none !important;
  gap: 15px !important;
}

.main-navigation {
  display: block !important;
  flex: 1 1 auto !important;
  width: auto !important;
}

.main-navigation ul.nav-menu {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 4px !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

.main-navigation ul.nav-menu > li > a {
  display: inline-block !important;
  padding: 12px 14px !important;
  font-weight: 700 !important;
  font-size: 13.5px !important;
  letter-spacing: -0.2px !important;
  color: #1e293b !important;
  text-decoration: none !important;
  white-space: nowrap !important;
  transition: all 0.2s ease !important;
}

body.newsmatic_dark_mode .main-navigation ul.nav-menu > li > a {
  color: #e2e8f0 !important;
}

.main-navigation ul.nav-menu > li:hover > a,
.main-navigation ul.nav-menu > li.current-menu-item > a {
  color: var(--topduoo-primary) !important;
}

/* Prevent broken WordPress fixed classes from overlapping content */
.site-header.header-sticky--enabled .bb-bldr--normal,
.site-header.fixed--on .bb-bldr--normal,
.site-header.fixed--off .bb-bldr--normal {
  position: static !important;
  transform: none !important;
  animation: none !important;
}

/* ==========================================================================
   BREAKING NEWS TICKER ISOLATION & FIX
   ========================================================================== */

.ticker-news-wrap {
  position: relative !important;
  clear: both !important;
  margin: 20px 0 25px 0 !important;
  z-index: 10 !important;
  display: flex !important;
  align-items: center !important;
  background: #ffffff !important;
  border: 1px solid var(--topduoo-border) !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03) !important;
}

body.newsmatic_dark_mode .ticker-news-wrap {
  background: #131b26 !important;
  border-color: #263345 !important;
}

.ticker-news-wrap .ticker-caption {
  background: var(--topduoo-primary) !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: 12px !important;
  text-transform: uppercase !important;
  padding: 12px 18px !important;
  white-space: nowrap !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  letter-spacing: 0.5px !important;
  flex-shrink: 0 !important;
}

.ticker-news-wrap .ticker-item-wrap {
  flex: 1 1 0 !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  padding: 8px 15px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  line-height: 1.5 !important;
}

.ticker-news-wrap .ticker-item-wrap a {
  color: inherit !important;
  text-decoration: none !important;
  margin-right: 48px !important;
  display: inline-block !important;
  vertical-align: middle !important;
  transition: color 0.2s !important;
}

.ticker-news-wrap .newsmatic-ticker-pause {
  flex: 0 0 auto !important;
}

.ticker-news-wrap .ticker-item-wrap a:hover {
  color: var(--topduoo-primary) !important;
}

/* ==========================================================================
   BRAND LOGO STYLING
   ========================================================================== */

.topduoo-logo-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--topduoo-font-heading);
  line-height: 1;
}

.topduoo-logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #e50914 0%, #ff3b30 100%);
  color: #ffffff;
  border-radius: 10px;
  font-weight: 900;
  font-size: 20px;
  box-shadow: 0 4px 14px rgba(229, 9, 20, 0.35);
  letter-spacing: -0.5px;
}

.topduoo-logo-text {
  display: flex;
  flex-direction: column;
}

.topduoo-brand-name {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.8px;
  color: #0f172a;
}

body.newsmatic_dark_mode .topduoo-brand-name {
  color: #ffffff;
}

.topduoo-brand-name span {
  color: var(--topduoo-primary);
}

.topduoo-brand-tagline {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #64748b;
  margin-top: 3px;
}

.topduoo-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #22c55e;
  border-radius: 50%;
  margin-right: 6px;
  animation: pulse-green 1.8s infinite;
}

@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Header Promotion Banner */
.topduoo-header-banner {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #ffffff;
}

.topduoo-header-banner .banner-tag {
  background: var(--topduoo-primary);
  color: white;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  margin-right: 8px;
}

.topduoo-header-banner a {
  color: #ffffff;
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
}

/* ==========================================================================
   ADVERTISING CONTAINER SLOTS (Google AdSense / Ezoic / Mediavine Ready)
   ========================================================================== */

.topduoo-ad-container {
  margin: 20px auto;
  text-align: center;
  position: relative;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  padding: 10px;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

body.newsmatic_dark_mode .topduoo-ad-container {
  background: #111827;
  border-color: #374151;
}

.topduoo-ad-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 6px;
}

.topduoo-ad-leaderboard {
  max-width: 970px;
  min-height: 90px;
}

.topduoo-ad-sidebar {
  max-width: 320px;
  min-height: 250px;
  margin-bottom: 25px;
}

.topduoo-ad-infeed {
  max-width: 728px;
  min-height: 90px;
  margin: 30px auto;
}

.topduoo-ad-bottom {
  max-width: 970px;
  min-height: 90px;
  margin: 35px auto 15px;
}

/* ==========================================================================
   LIVE SEARCH & CATEGORY BADGES
   ========================================================================== */

.topduoo-search-results-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2e8f0;
  max-height: 420px;
  overflow-y: auto;
  z-index: 9999;
  display: none;
  padding: 8px 0;
  margin-top: 8px;
}

body.newsmatic_dark_mode .topduoo-search-results-dropdown {
  background: #17202d;
  border-color: #2b3b52;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.topduoo-search-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.15s ease;
}

body.newsmatic_dark_mode .topduoo-search-item {
  border-bottom-color: #232f42;
}

.topduoo-search-item:last-child {
  border-bottom: none;
}

.topduoo-search-item:hover {
  background: #f8fafc;
}

body.newsmatic_dark_mode .topduoo-search-item:hover {
  background: #1e293b;
}

.topduoo-search-thumb {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.topduoo-search-meta {
  flex-grow: 1;
}

.topduoo-search-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  color: #1e293b;
  margin-bottom: 3px;
}

body.newsmatic_dark_mode .topduoo-search-title {
  color: #f1f5f9;
}

.topduoo-search-date {
  font-size: 11px;
  color: #64748b;
}

.topduoo-cat-badge {
  display: inline-block;
  background: var(--topduoo-primary);
  color: #ffffff !important;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 8px;
  border-radius: 4px;
  line-height: 1.2;
}

.topduoo-cat-technology { background: #2563eb; }
.topduoo-cat-world { background: #059669; }
.topduoo-cat-business { background: #7c3aed; }
.topduoo-cat-science { background: #0891b2; }
.topduoo-cat-sports { background: #ea580c; }
.topduoo-cat-entertainment { background: #db2777; }

/* Filter Tabs */
.filter-tab-wrapper .tab-title {
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 12px;
  background: transparent;
  color: #64748b;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.filter-tab-wrapper .tab-title:hover {
  color: var(--topduoo-primary);
}

.filter-tab-wrapper .tab-title.isActive {
  background: var(--topduoo-primary);
  color: #ffffff;
  border-color: var(--topduoo-primary);
}

/* ==========================================================================
   SINGLE ARTICLE & COMMENTS
   ========================================================================== */

.topduoo-article-header {
  margin-bottom: 25px;
}

.topduoo-article-title {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.8px;
  margin: 15px 0;
  color: #0f172a;
}

body.newsmatic_dark_mode .topduoo-article-title {
  color: #f8fafc;
}

.topduoo-author-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
  border-top: 1px solid var(--topduoo-border);
  border-bottom: 1px solid var(--topduoo-border);
  margin-bottom: 25px;
}

body.newsmatic_dark_mode .topduoo-author-card {
  border-color: #2b3b52;
}

.topduoo-author-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topduoo-author-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
}

.topduoo-author-name {
  font-weight: 700;
  font-size: 14px;
  color: #1e293b;
}

body.newsmatic_dark_mode .topduoo-author-name {
  color: #f1f5f9;
}

.topduoo-author-role {
  font-size: 12px;
  color: #64748b;
}

.topduoo-share-buttons {
  display: flex;
  gap: 8px;
}

.topduoo-share-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 13px;
  text-decoration: none;
  transition: transform 0.2s;
  cursor: pointer;
  border: none;
}

.topduoo-share-btn:hover {
  transform: translateY(-2px);
}

.topduoo-share-x { background: #000000; }
.topduoo-share-fb { background: #1877f2; }
.topduoo-share-linkedin { background: #0a66c2; }
.topduoo-share-copy { background: #475569; }

.topduoo-article-body {
  font-size: 17px;
  line-height: 1.75;
  color: #334155;
}

body.newsmatic_dark_mode .topduoo-article-body {
  color: #cbd5e1;
}

.topduoo-article-body p {
  margin-bottom: 20px;
}

.topduoo-article-body h2,
.topduoo-article-body h3 {
  font-family: var(--topduoo-font-heading);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 30px 0 15px;
  color: #0f172a;
}

body.newsmatic_dark_mode .topduoo-article-body h2,
body.newsmatic_dark_mode .topduoo-article-body h3 {
  color: #f8fafc;
}

.topduoo-article-body blockquote {
  border-left: 4px solid var(--topduoo-primary);
  padding: 15px 20px;
  margin: 25px 0;
  background: #f8fafc;
  font-style: italic;
  font-size: 18px;
  color: #1e293b;
  border-radius: 0 8px 8px 0;
}

body.newsmatic_dark_mode .topduoo-article-card {
  color: #e2e8f0 !important;
  background: #111827 !important;
  border-color: #2b3b52 !important;
  box-shadow: none !important;
}

body.newsmatic_dark_mode .topduoo-article-card h1,
body.newsmatic_dark_mode .topduoo-article-card h2,
body.newsmatic_dark_mode .topduoo-article-card h3,
body.newsmatic_dark_mode .topduoo-article-card h4,
body.newsmatic_dark_mode .topduoo-article-card [style*="color:#0f172a"] {
  color: #f1f5f9 !important;
}

body.newsmatic_dark_mode .topduoo-article-card p,
body.newsmatic_dark_mode .topduoo-article-card li,
body.newsmatic_dark_mode .topduoo-article-card [style*="color:#334155"],
body.newsmatic_dark_mode .topduoo-article-card [style*="color:#475569"],
body.newsmatic_dark_mode .topduoo-article-card [style*="color:#64748b"] {
  color: #cbd5e1 !important;
}

body.newsmatic_dark_mode .topduoo-article-card [style*="background:#f8fafc"],
body.newsmatic_dark_mode .topduoo-article-card [style*="background:#f1f5f9"] {
  background: #17202d !important;
  border-color: #2b3b52 !important;
}

body.newsmatic_dark_mode .topduoo-article-card input,
body.newsmatic_dark_mode .topduoo-article-card textarea {
  color: #f1f5f9 !important;
  background: #0b1220 !important;
  border-color: #475569 !important;
}

body.newsmatic_dark_mode .topduoo-article-body blockquote {
  background: #17202d;
  color: #f1f5f9;
}

.topduoo-comments-wrap {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid var(--topduoo-border);
}

body.newsmatic_dark_mode .topduoo-comments-wrap {
  border-color: #2b3b52;
}

.topduoo-comment-item {
  background: #ffffff;
  border: 1px solid var(--topduoo-border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

body.newsmatic_dark_mode .topduoo-comment-item {
  background: #17202d;
  border-color: #2b3b52;
}

.topduoo-comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.topduoo-comment-author {
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
}

body.newsmatic_dark_mode .topduoo-comment-author {
  color: #f1f5f9;
}

.topduoo-comment-date {
  font-size: 11px;
  color: #64748b;
}

.topduoo-newsletter-widget {
  background: linear-gradient(145deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
  margin-bottom: 30px;
}

.topduoo-newsletter-widget h3 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
  color: #ffffff;
}

.topduoo-newsletter-widget p {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 18px;
}

.topduoo-newsletter-widget input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #ffffff;
  margin-bottom: 12px;
  font-size: 14px;
  box-sizing: border-box;
}

.topduoo-newsletter-widget button {
  width: 100%;
  background: var(--topduoo-primary);
  color: #ffffff;
  padding: 12px 20px;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.topduoo-newsletter-widget button:hover {
  background: var(--topduoo-primary-hover);
}

.topduoo-toast {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: #0f172a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid var(--topduoo-primary);
  animation: slideInToast 0.3s ease;
}

@keyframes slideInToast {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 1024px) {
  .site-header .bb-bldr--normal {
    display: none !important;
  }
  .site-header .bb-bldr--responsive {
    display: block !important;
  }
}
@media (min-width: 1025px) {
  .site-header .bb-bldr--responsive {
    display: none !important;
  }
}
