:root {
  --bg-primary: #070c18;
  --bg-card: #0e172a;
  --border-color: #1e293b;
  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  align-items: center;
  padding: 12px;
}

/* Premium Header Styling */
.app-header {
  width: 100%;
  max-width: 600px;
  margin-bottom: 16px;
}

.header-card-glow {
  background: linear-gradient(135deg, rgba(14, 23, 42, 0.95), rgba(15, 28, 54, 0.95));
  border: 1px solid rgba(56, 189, 248, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 18px;
  text-align: center;
}

.top-nav-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.top-nav-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.top-nav-btn:hover {
  border-color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.05);
}

.brand-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 6px;
}

.version-tag {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.app-subtitle {
  color: var(--text-secondary);
  font-size: 0.84rem;
  margin-bottom: 12px;
  line-height: 1.4;
}

.credits-box {
  font-size: 0.75rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  margin-top: 4px;
}

.credits-link {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
}

/* Layout Wrapper */
.app-layout-wrapper {
  width: 100%;
  max-width: 600px;
}

.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.last-updated-banner {
  font-size: 0.82rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.text-cyan {
  color: var(--accent-cyan);
}

/* SEO Intro Section Styling (Above Table) */
.seo-intro-section {
  margin-bottom: 14px;
}

.seo-section-title {
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: var(--text-primary);
  font-weight: 700;
}

.seo-subsection-title {
  font-size: 0.92rem;
  margin-top: 12px;
  margin-bottom: 6px;
  color: var(--text-primary);
  font-weight: 700;
}

.seo-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.seo-faq-box {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.faq-item {
  margin-bottom: 8px;
}

.section-divider {
  width: 100%;
  height: 1px;
  background: var(--border-color);
  margin: 16px 0;
}

/* Controls */
.table-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.search-group input {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: #fff;
  font-size: 0.82rem;
  outline: none;
}

.filter-controls-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.filter-group, .limit-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-group select, .limit-group select {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 0.78rem;
  outline: none;
}

/* Compact Table Layout */
.table-container {
  width: 100%;
  overflow-x: auto;
}

.codes-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.codes-table th, .codes-table td {
  padding: 8px 4px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.75rem;
}

.codes-table th {
  color: var(--text-secondary);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* Proportional Column Sizes */
.th-code { width: 34%; }
.th-version { width: 20%; }
.th-date { width: 28%; white-space: nowrap; }
.th-action { width: 18%; }

.code-cell code {
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 5px;
  border-radius: 4px;
  color: var(--accent-cyan);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.2px;
  word-break: break-all;
}

/* Version Badge Styles */
.v-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
}

.v-badge.unknown { 
  background: rgba(148, 163, 184, 0.15); 
  color: #94a3b8; 
}

.v-badge.global { 
  background: rgba(245, 158, 11, 0.18); 
  color: #fbbf24;
}

.v-badge.garena { 
  background: rgba(239, 68, 68, 0.18); 
  color: #f87171;
}

.v-badge.both { 
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(245, 158, 11, 0.22)); 
  color: #fef08a;
}

.date-cell {
  color: var(--text-secondary);
  white-space: nowrap;
  font-size: 0.72rem;
}

.text-right { text-align: right; }
.action-cell { text-align: right; }

.copy-btn {
  background: var(--accent-blue);
  color: #fff;
  border: none;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.72rem;
}

.copy-btn:active { transform: scale(0.96); }

/* Pagination */
.pagination-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.pagination-btns { display: flex; gap: 6px; }
.page-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
}

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

/* Note Box */
.important-note-box {
  background: rgba(56, 189, 248, 0.05);
  border: 1px dashed var(--accent-cyan);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.78rem;
}

.mt-16 { margin-top: 16px; }
.note-badge {
  display: inline-block;
  font-weight: 700;
  color: var(--accent-cyan);
  font-size: 0.7rem;
  margin-bottom: 4px;
}

.portal-info { line-height: 1.5; color: var(--text-secondary); }
.link-cyan { color: var(--accent-cyan); text-decoration: underline; }

/* YouTube Watch Hours Video Card */
.video-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 16px;
}

.video-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #fff;
}

.video-thumbnail-link {
  display: block;
  text-decoration: none;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  margin-bottom: 10px;
}

.thumbnail-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.yt-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.video-thumbnail-link:hover .yt-thumb {
  transform: scale(1.03);
}

.play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-button-icon {
  width: 48px;
  height: 48px;
  background: #FF0000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.yt-video-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 12px;
}

.yt-watch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #FF0000;
  color: #FFFFFF;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 9px 14px;
  border-radius: 8px;
  text-align: center;
  transition: background 0.2s ease;
}

.yt-watch-btn:hover {
  background: #cc0000;
}

/* Promo Card */
.promo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.promo-badge {
  color: var(--accent-cyan);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-cyan);
  border-radius: 50%;
}

.promo-title { font-size: 0.95rem; margin-bottom: 4px; }
.promo-desc { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 10px; }

.promo-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.8rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--accent-cyan);
  color: #070c18;
  padding: 8px 18px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.78rem;
  transition: transform 0.3s ease;
  z-index: 100;
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* Footer */
.app-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: auto;
  padding: 16px 0;
}

.footer-powered { margin: 4px 0; }
.credit-link { color: var(--accent-cyan); text-decoration: none; }
.footer-links a { color: var(--text-secondary); text-decoration: none; }
.dot { margin: 0 6px; }
