:root {
  --primary: #1d4ed8;
  --primary-gradient: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
  --secondary: #0ea5e9;
  --bg-color: #f0f9ff;
  --bg-muted: #e0f2fe;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #475569;
  --border-color: #bae6fd;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --radius-md: 12px;
  --radius-lg: 16px;
}

[data-theme="dark"] {
  --primary: #00a233;
  --primary-gradient: linear-gradient(135deg, #00a233 0%, #007456 100%);
  --secondary: #005d5e;
  --bg-color: #00012e;
  --bg-muted: #001244;
  --card-bg: #011e51;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #003060;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.7);
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  background: var(--bg-color);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
h2,
h3,
.title,
button,
select {
  font-family: "Outfit", sans-serif;
}

.header {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 30px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  background-image: radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.1) 0, transparent 50%), radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.1) 0, transparent 50%);
  z-index: 1000;
  gap: 20px;
}

.header h1 {
  margin: 0;
  padding: 0;
  display: contents;
}

.header-title {
  font-size: 22px;
  line-height: 1.1;
  font-weight: 700;
  flex-shrink: 0;
  text-align: left;
}


[data-theme="dark"] .header {
  background-image:
    radial-gradient(at 0% 0%, rgba(0, 162, 51, 0.15) 0, transparent 50%),
    radial-gradient(at 100% 0%, rgba(0, 93, 94, 0.15) 0, transparent 50%);
}

.theme-toggle {
  background: var(--bg-muted);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.theme-toggle:hover {
  transform: scale(1.1);
  background: var(--border-color);
  box-shadow: 0 0 15px var(--primary);
}

.theme-toggle img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  vertical-align: middle;
}

[data-theme='dark'] .sun-icon { display: block; animation: rotateIn 0.5s ease-out; }
[data-theme='dark'] .moon-icon { display: none; }
.sun-icon { display: none; }
.moon-icon { display: block; animation: slideIn 0.3s ease-out; }

@keyframes rotateIn {
  from { transform: rotate(-90deg) scale(0); opacity: 0; }
  to { transform: rotate(0) scale(1); opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Detail page specific header */
.header-details {
  padding: 20px;
  font-size: 24px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.controls {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  max-width: 900px;
}

@media (max-width: 900px) {
  .header {
    flex-direction: column;
    padding: 15px;
    gap: 15px;
  }
  .header-title {
    align-self: flex-start;
    font-size: 20px;
  }
  .theme-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
  }
  .controls {
    width: 100%;
    max-width: 100%;
    gap: 8px;
  }
}

select,
button {
  padding: 8px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 13px;
  outline: none;
  transition: all 0.2s;
  background: var(--card-bg);
  color: var(--text-main);
  cursor: pointer;
}

select:hover {
  border-color: var(--primary);
}

button {
  background: var(--primary-gradient);
  color: #fff;
  border: none;
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(79, 70, 229, 0.4);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 15px;
  padding: 0 15px 60px 15px;
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px solid var(--primary);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: #e2e8f0;
}

.card-top {
  display: flex;
  gap: 15px;
}

.thumb {
  width: 140px;
  height: 84px;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.content {
  flex: 1;
}

.title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.main-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-muted);
  padding: 10px;
  border-radius: 8px;
  margin-top: 10px;
}

.main-metrics div {
  display: flex;
  justify-content: space-between;
}
.main-metrics span {
  font-weight: 600;
  color: var(--text-main);
}

.badge {
  display: inline-flex;
  margin-top: auto;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  align-self: flex-start;
}

.good {
  background: #dcfce7;
  color: #15803d;
}
.mid {
  background: #fef9c3;
  color: #a16207;
}
.bad {
  background: #fee2e2;
  color: #b91c1c;
}

[data-theme='dark'] .good { background: rgba(0, 200, 83, 0.2); color: #00e676; }
[data-theme='dark'] .mid { background: rgba(255, 152, 0, 0.2); color: #ffb74d; }
[data-theme='dark'] .bad { background: rgba(244, 67, 54, 0.2); color: #ff8a80; }

.description {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: -4px;
}

.see-more {
  margin-top: 15px;
  width: 100%;
  padding: 10px;
  font-size: 13px;
  background: var(--card-bg);
  border: 1px solid var(--primary);
  color: var(--primary);
  box-shadow: none;
}

.see-more:hover {
  background: var(--primary);
  color: #fff;
}

.error {
  text-align: center;
  padding: 30px;
  color: #ce2c2c;
}

/* AD STYLES */
.ad-container {
  width: 100%;
  display: flex;
  justify-content: center;
  background: transparent;
  box-sizing: border-box;
  position: relative;
  margin: 10px 0;
}

.ad-label {
  position: absolute;
  top: -10px;
  left: 10px;
  background: var(--bg-muted);
  padding: 2px 8px;
  font-size: 10px;
  color: var(--text-muted);
  border-radius: 4px;
}

.ad-leaderboard {
  width: 728px;
  height: 90px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  position: relative;
  max-width: 100%;
}

@media (max-width: 768px) {
  .ad-leaderboard {
    width: 320px;
    height: 50px;
  }
}

/* SIDEBAR LAYOUT STYLES */
.page-layout {
  display: flex;
  justify-content: center;
  gap: 30px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.sidebar-ad {
  width: 160px;
  min-width: 160px;
  padding-top: 20px;
}

.vertical-ad-placeholder {
  width: 160px;
  height: 600px;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  position: sticky;
  top: 20px;
  text-align: center;
}

.main-content-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding-bottom: 130px;
}

/* FOOTER STYLES */
.site-footer {
  background: var(--card-bg);
  border-top: 1px solid var(--border-color);
  padding: 40px 20px;
  margin-top: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}
.footer-links a {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
}
.footer-links a:hover {
  color: var(--primary);
}

@media (max-width: 1500px) {
  .sidebar-ad {
    display: none;
  }
}

/* AD POSITIONING */
.sticky-top-ad {
  position: relative;
  z-index: 5;
  background: transparent;
  padding: 10px 0;
  margin-bottom: 10px;
  width: 100%;
  display: flex;
  justify-content: center;
}

.sticky-bottom-ad {
  position: sticky;
  bottom: 0;
  z-index: 995;
  background: transparent;
  padding: 5px 0;
  margin-top: 10px;
  width: 100%;
  display: flex;
  justify-content: center;
}

/* DETAILS PAGE SPECIFIC */
.content-grid {
  display: flex;
  gap: 30px;
  margin-top: 20px;
}

.main-content {
  flex: 2;
}

.sidebar-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

iframe.video-frame {
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  margin-bottom: 20px;
  background: #000;
}

.prediction-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  border-left: 5px solid var(--primary);
  box-shadow: var(--shadow-sm);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.stat-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 15px;
  border-radius: 10px;
  text-align: center;
}

.stat-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 700;
  margin-bottom: 5px;
}
.stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.btn-yt {
  width: 100%;
  padding: 15px;
  background: #ff0000;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  font-size: 16px;
  margin-top: 10px;
  transition: transform 0.2s;
}
.btn-yt:hover {
  transform: translateY(-2px);
}

.creator-info {
  margin-bottom: 20px;
  font-size: 18px;
  color: #475569;
}
.creator-info a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
}

.historic-dashboard {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 25px;
  box-shadow: var(--shadow-md);
  margin-bottom: 30px;
  border: 1px solid var(--border-color);
}

.timeline-controls {
  margin: 20px 0;
  padding: 20px;
  background: var(--bg-muted);
  border-radius: 12px;
}

.time-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 8px;
  background: #cbd5e1;
  border-radius: 5px;
  outline: none;
  margin-top: 10px;
}

.time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.5);
  transition: transform 0.1s;
}

.time-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.time-display {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 5px;
}

.historic-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-top: 20px;
}

.h-stat {
  background: var(--bg-muted);
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid transparent;
  transition: all 0.3s;
}

.h-stat.highlight {
  background: #fff;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.h-val {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-main);
}
.h-lbl {
  font-size: 11px;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 700;
  margin-top: 5px;
}

.ad-sidebar {
  width: 300px;
  height: 250px;
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: 1px dashed var(--border-color);
  margin-top: 20px;
  border-radius: 12px;
}

@media (max-width: 900px) {
  .content-grid {
    flex-direction: column;
  }
  .sidebar-content {
    width: 100%;
    order: 2;
  }
  .historic-stats {
    grid-template-columns: 1fr 1fr;
  }
}
