/* =========================
   style.css — Unified & Fixed
   ========================= */

/* Reset dan dasar */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html, body {
  height: 100%;
}
body {
  font-family: Arial, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings */
h1, h2, h3, h4 {
  margin: 0 0 0.6rem 0;
  font-weight: 700;
  color: #222;
}

/* =========================
   HEADER & NAV
   ========================= */
.header {
  background: #004080;
  color: white;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo img {
    height: 50px; /* sesuaikan */
    width: auto;
    display: block;
}


.logo {
  font-weight: bold;
  font-size: 1.3em;
  letter-spacing: 0.2px;
}

/* NAV Desktop */
.nav-desktop {
  display: flex;
  align-items: center;
  gap: 10px;
}
.nav-desktop a {
  color: white;
  text-decoration: none;
  margin-left: 8px;
  font-weight: 600;
  font-size: 1em;
  padding: 6px 10px;
  border-radius: 6px;
  transition: background 0.15s;
}
.nav-desktop a:hover { background: rgba(255,255,255,0.06); }

/* NAV Mobile */
.nav-mobile {
  display: none;
  flex-direction: column;
  background: #003060;
}
.mobile-top {
  display: flex;
  justify-content: space-between;
  padding: 10px 15px;
  align-items: center;
  color: white;
  font-weight: bold;
  font-size: 1.1rem;
}
.menu-icon {
  font-size: 1.8em;
  cursor: pointer;
  user-select: none;
}
.mobile-menu-grid {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 15px 15px;
}
.mobile-menu-grid.open {
  display: grid;
}
.mobile-menu-grid a {
  background: #0050a0;
  color: white;
  text-align: center;
  padding: 8px 6px;
  border-radius: 5px;
  font-weight: 600;
  font-size: 0.9em;
  text-decoration: none;
}

/* =========================
   BANNER
   ========================= */
.banner-section {
  margin: 15px 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.banner {
  background: #ddd;
  border: 2px solid #ccc;
  text-align: center;
  font-size: 1.2em;
  line-height: 72px;
  color: #666;
  font-weight: bold;
  user-select: none;
}

/* Desktop banners vertical center */
@media (min-width: 768px) {
  .banner-section {
    flex-direction: column;
    max-width: 728px;
    margin: 15px auto;
  }
  .banner {
    width: 728px;
    height: 90px;
    margin-bottom: 10px;
  }
  .nav-desktop { display: flex; }
  .nav-mobile { display: none; }
}

/* Mobile banners 2-col */
@media (max-width: 767px) {
  .banner-section {
    flex-direction: row;
    max-width: 100%;
    margin: 10px;
  }
  .banner {
    width: calc(50% - 10px);
    height: 90px;
  }
  .nav-desktop { display: none; }
  .nav-mobile { display: flex; }
}

/* =========================
   PREDIKSI SECTION & FILTER
   ========================= */
.prediksi-section {
  margin: 15px 20px;
}
.filter {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter label {
  font-weight: 600;
}
.filter input {
  padding: 6px 10px;
  width: 200px;
  max-width: 100%;
  border-radius: 5px;
  border: 1px solid #ccc;
}

/* PREDIKSI TABLE (desktop & mobile variants) */
#prediksi-container {
  max-width: 1200px;     /* batasi lebar maksimal */
  margin: 0 auto;        /* center horizontal */
  padding: 0 12px;       /* beri padding sisi kiri kanan supaya ada ruang */
  box-sizing: border-box;
}
.prediksi-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 0.9em;
  table-layout: auto;
}
.prediksi-table thead {
  background: #004080;
  color: white;
}
.prediksi-table th, .prediksi-table td {
  border: 1px solid #ccc;
  padding: 6px 8px;
  text-align: center;
  vertical-align: middle;
  word-break: break-word;
}

/* Desktop vs mobile table toggles */
.prediksi-table.mobile { display: none; }
@media (max-width: 767px) {
  .prediksi-table.desktop { display: none; }
  .prediksi-table.mobile { display: table; }
}

/* Ensure large number of pasaran show vertically, not horizontally */
.prediksi-table tbody tr td {
  white-space: normal;
}

/* =========================
   RESULT TABLE & BOLA ANGKA
   ========================= */
.result-section {
  margin: 15px 20px 40px;
}

/* allow table wrapper if needed */
.result-table-wrapper {
 max-width: 900px;
  overflow-x: auto; /* fallback: allow full table scroll if extremely narrow */
  -webkit-overflow-scrolling: touch;
}

/* basic table */
.result-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #004080;
  margin-bottom: 12px;
  text-align: center; /* atau left, sesuai desain */
}

.result-table {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  border-collapse: collapse;
  font-size: 0.95em;
  table-layout: auto;
  min-width: 320px; /* keep some baseline */
}
.result-table thead {
  background: #004080;
  color: white;
}
.result-table th, .result-table td {
  border: 1px solid #ccc;
  padding: 7px 10px;
  text-align: center;
  color: #222;
  background-color: #fff;
  vertical-align: middle;
}

/* Target the column that contains the result balls.
   Use both .result-cell (if HTML has it) and fallback nth-child(3). */
.result-table td.result-cell,
.result-table td:nth-child(3) {
  white-space: nowrap;            /* keep balls on one line */
  overflow-x: auto;              /* allow internal horizontal scroll if needed */
  -webkit-overflow-scrolling: touch;
  padding: 6px 8px;
  text-align: center;
}

/* hide scrollbar in webkit for cleaner look (still scrollable) */
.result-table td.result-cell::-webkit-scrollbar,
.result-table td:nth-child(3)::-webkit-scrollbar {
  height: 6px;
}
.result-table td.result-cell::-webkit-scrollbar-thumb,
.result-table td:nth-child(3)::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
  border-radius: 3px;
}

/* Bola angka - keep consistent names used by JS */
.bola {
  display: inline-block;
  min-width: 28px;
  width: 28px;
  height: 28px;
  line-height: 28px;
  border-radius: 50%;
  color: white;
  font-weight: bold;
  margin: 0 4px;
  text-align: center;
  font-size: 0.95em;
  box-sizing: border-box;
}

/* specific color classes */
.bola-biru  { background-color: #3b82f6; }
.bola-hijau { background-color: #22c55e; }
.bola-abu   { background-color: #9ca3af; }
.bola-merah { background-color: #ef4444; }

/* blink animation for latest data */
.bola-hijau.blink {
  animation: blink 1s infinite alternate;
}
@keyframes blink {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0.35; transform: translateY(-1px); }
}

/* =========================
   MINI BUTTON (pasaran)
   ========================= */
.mini-btn, .btn-pasaran {
  display: inline-block;
  background: #0066cc;
  color: white;
  border: none;
  border-radius: 3px;
  padding: 5px 10px;
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, transform 0.08s;
  /* tambahan agar rata kiri */
    text-align: left;          /* untuk teks di tombol */
    float: left;               /* tombol sendiri rata kiri dalam container */
    margin-right: 8px;         /* beri jarak kanan antar tombol jika ada */
}
.mini-btn:hover, .btn-pasaran:hover {
  background: #0050a0;
}
.mini-btn:active, .btn-pasaran:active {
  transform: translateY(1px);
}
.mini-btn:focus, .btn-pasaran:focus {
  outline: 3px solid rgba(0,102,204,0.18);
  outline-offset: 2px;
}

/* =========================
   POPUP HISTORY
   ========================= */
.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  box-shadow: 0 3px 15px rgba(0,0,0,0.4);
  border-radius: 8px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 10000;
  padding: 20px;
}
.popup.hidden { display: none; }
.popup .popup-content { position: relative; }
.close-popup {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 1.4em;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  background: transparent;
  border: none;
}
.history-nav {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 15px;
}
.history-nav button {
  padding: 6px 14px;
  background: #004080;
  border: none;
  color: white;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 600;
}
.history-nav button:disabled {
  background: #ccc;
  cursor: default;
}

/* make tables inside popup responsive */
.popup table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}
.popup th, .popup td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: center;
}

/* =========================
   FOOTER
   ========================= */
.footer {
  background: #003060;
  color: white;
  padding: 30px 20px;
  font-size: 0.9em;
  text-align: center;
}
.artikel-seo h3 {
  font-size: 17px;
  font-weight: 700;
  text-align: left;
  background: linear-gradient(270deg, 
    #ff0000, #ff7f00, #ffff00, #00ff00, #0000ff, #4b0082, #8f00ff, #ff0000);
  background-size: 1600% 1600%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
          background-clip: text;
          text-fill-color: transparent;
  animation: rainbow 10s ease infinite;
  margin-bottom: 15px;
}

@keyframes rainbow {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}


.artikel-seo {
  max-width: 700px;
  margin: 20px auto 30px auto;
  padding: 25px 30px;
  background-color: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  line-height: 1.5;
  font-size: 1rem;
  text-align: left;
  color: #222;
  transition: box-shadow 0.3s ease;
}

/* Hover efek subtle untuk card */
.artikel-seo:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.footer-menu {
  display: flex;
  justify-content: center;
  gap: 25px;
  flex-wrap: wrap; /* agar responsive di layar kecil */
}

/* Link menu footer */
.footer-menu a {
  color: white;
  text-decoration: none;
  font-weight: 600;
  transition: color 0.3s ease;
  padding: 6px 10px;
  border-radius: 4px;
}

.footer-menu a:hover {
  color: #ffcc00;
  background-color: rgba(255, 204, 0, 0.1);
}

/* Jika kamu mau teks copyright di footer bisa ditambahkan di bawah footer-menu */
.footer p.footer-copyright {
  margin-top: 20px;
  font-size: 0.85em;
  color: #ccc;
  font-style: italic;
  letter-spacing: 0.03em;
}

/* =========================
   Accessibility & Helpers
   ========================= */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* =========================
   RESPONSIVE TWEAKS
   ========================= */

/* Tablet & small-desktop */
@media (max-width: 1024px) {
  .banner { font-size: 1.05em; line-height: 64px; }
  .prediksi-section { margin: 12px; }
}

/* Mobile layout (<= 767px) */
@media (max-width: 767px) {
  .header { padding: 12px 14px; }
  .logo { font-size: 1.1rem; }
  .filter { gap: 8px; }
  .filter input { width: 160px; }

  .result-table th, .result-table td {
    padding: 6px 8px;
    font-size: 0.9em;
  }

  .mini-btn { padding: 4px 8px; font-size: 0.82em; }
  .mobile-top { font-size: 1.05rem; }
}

/* Small phones (<= 400px) — special care for balls & spacing */
@media (max-width: 400px) {
  /* Reduce padding and font-sizes to keep layout neat */
  .banner { line-height: 54px; font-size: 1em; }
  .filter { gap: 6px; }
  .filter input { width: 130px; padding: 5px 8px; }

  .prediksi-section { margin: 8px 10px; }
  .result-section { margin: 8px 10px 30px; }

  /* Table cells smaller */
  .result-table th, .result-table td {
    padding: 5px 6px;
    font-size: 0.82em;
  }
  .prediksi-table th, .prediksi-table td {
    padding: 5px 6px;
    font-size: 0.82em;
  }

  /* Slightly smaller balls */
  .bola {
    min-width: 22px;
    width: 22px;
    height: 22px;
    line-height: 22px;
    margin: 0 3px;
    font-size: 0.78em;
  }

  /* reduce gap between balls inside result column */
  .result-table td.result-cell,
  .result-table td:nth-child(3) {
    gap: 3px;
  }

  /* Hide default scrollbar on webkit (still scrollable) */
  .result-table td.result-cell::-webkit-scrollbar,
  .result-table td:nth-child(3)::-webkit-scrollbar {
    height: 4px;
  }
  .result-table td.result-cell::-webkit-scrollbar-thumb,
  .result-table td:nth-child(3)::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.08);
    border-radius: 2px;
  }

  /* Banner width adapt on tiny screens */
  .banner {
    height: 72px;
    line-height: 72px;
    width: calc(50% - 8px);
  }

  /* Mobile menu grid adapt */
  .mobile-menu-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px 10px 12px;
  }
}

/* Ensure long table content doesn't break the page: wrap container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 12px;
}

/* final safety: remove unexpected overflow on body */
body {
  overflow-x: hidden;
}
