/* ==========================================================================
   BASE.CSS
   Reset, design tokens, dan layout shell (header, search box, tab nav, footer).
   File ini SELALU dimuat di semua mode/tab — jangan taruh style spesifik
   satu tab di sini. Lihat results.css / media.css / home.css.
   ========================================================================== */

@font-face {
  font-family: 'Verio Sans';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/font/BRVQLLXNOS.woff2') format('woff2'),
       url('/font/JBDCITAYMP.woff2') format('woff2');
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  text-size-adjust: 100%;
  font-family: 'Verio Sans', Roboto, sans-serif;
}

:root {
  /* Warna */
  --color-title: #1558D6;
  --color-text: #494949;
  --color-text-muted: #70757a;
  --color-text-dark: #101518;
  --color-border: #EDEDED;
  --color-border-alt: #E0E4E9;
  --color-bg: #ffffff;
  --color-bg-alt: #f4f6f7;
  --color-white: #ffffff;

  /* Dark mode (di-override oleh body.dark di bawah) */
  --card-shadow: 0 0 0 1px rgba(235, 237, 239, 1);

  /* Layout */
  --page-max-width: 630px;
  --page-gutter: 130px;
}

/* dark mode */
body.dark {
  --color-title: #8ab4f8;
  --color-text: #BDC1C4;
  --color-text-muted: #9BA0A6;
  --color-text-dark: #E9EAEE;
  --color-border: #3C4043;
  --color-border-alt: #3C4043;
  --color-bg: #171717;
  --color-bg-alt: #202125;
  --color-white: #202125;
  --card-shadow: none;
}

body.dark .result-card .favicon img {
  mix-blend-mode: normal;
}

body.dark .related:after { 
  background: #303134; /* Warna abu-abu gelap khas mode gelap */
  color: #e8eaed;      /* Warna ikon di dalamnya agar tetap terlihat */
}

/* dark mode end */

@media (min-width: 780px) {
  :root { --color-title: #1A0DAB; }
}
@media (min-width: 992px) {
  :root { --page-max-width: 650px; }
}

html, body {
  overflow-x: hidden;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
}

::-webkit-scrollbar { width: 0; height: 0; }
::-webkit-scrollbar-track { border-radius: 0; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 10px; }

/* --------------------------------------------------------------------
   Shell layout
   -------------------------------------------------------------------- */

.app { width: 100%; }

.logo-slot {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--color-white);
  padding: 8px 12px 0px 12px;
  width: 100%;
}

.logo-slot img {
  width: 95px;
  height: 45px;
  object-fit: contain;
}

.page-header { background: var(--color-white); }
.header { background: var(--color-white); }

.results-section {
  /* pembungkus seluruh area hasil (result-wrapper + footer) */
}

@media (min-width: 780px) {
  .logo-slot { justify-content: flex-start !important; padding-left: 16px; }
}

/* --------------------------------------------------------------------
   Search box
   -------------------------------------------------------------------- */

.search-box { padding: 5px 15px; }
.search-field { position: relative; }

.inpbtun {
  width: 35px;
  height: 35px;
  position: absolute;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
}

.search-box .search-toggle {
  top: 4px;
  left: 4px;
  background-image: url("images/search.png");
  background-size: 18px;
}

.search-box .cleartext {
  top: 4px;
  right: 4px;
  background-image: url("images/close.png");
  background-size: 20px;
}

.search-input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 45px;
  background: var(--color-white);
  box-shadow: 0 2px 6px 0px rgba(74,72,77,.24);
  border-radius: 22px;
  font-size: 16px;
  outline: none;
  border: none;
  min-width: 0;
}

/* ==========================================
   DESKTOP SUGGESTION DROPDOWN
   ========================================== */
.search-field {
  position: relative;
}

.sug-desktop-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 16px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 1000;
  overflow: hidden;
  margin-top: 2px;
}

.sug-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 15px;
  color: var(--color-text-dark);
}

.sug-item:hover {
  background-color: var(--color-bg-alt);
}

.sug-icon {
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
}

.sug-icon.search-ic {
  margin-right: 14px;
}

.sug-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sug-text strong {
  color: var(--color-text-dark);
}

/* ==========================================
   MOBILE FULLSCREEN SUGGESTION OVERLAY
   ========================================== */
.sug-mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--color-bg);
  color: var(--color-text-dark);
  z-index: 99999;
  flex-direction: column;
}

.sug-mobile-overlay.active {
  display: flex;
}

.sug-mobile-header {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-white);
}

.sug-back-btn {
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sug-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  height: 40px;
  background: var(--color-bg-alt);
  border-radius: 24px;
  padding: 6px 14px;
  margin-left: 8px;
  min-width: 0;
}

.sug-mobile-input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 16px;
  outline: none;
  color: var(--color-text-dark);
}

.sug-clear-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0 4px;
}

.sug-mobile-list {
  flex: 1;
  overflow-y: auto;
  padding-top: 8px;
  background: var(--color-bg);
}

.sug-mobile-list .sug-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  width: 100%;
  box-sizing: border-box;
}

.sug-mobile-list .insert-ic {
  padding: 4px;
  margin-left: 8px;
  color: var(--color-text-muted);
}


/* --------------------------------------------------------------------
   Tab nav (search-menu)
   -------------------------------------------------------------------- */

.tab-wrapper {
  padding: 12px 12px 16px 12px;
  display: flex;
  justify-content: center;
}
.tab-wrapper svg { margin-right: 5px; }

.search-menu {
  padding: 0 13px;
  margin: 0;
  border-bottom: 1px solid var(--color-border-alt);
  user-select: none;
  white-space: nowrap;
  display: -webkit-box;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
}
.search-menu::-webkit-scrollbar { display: none; }

.search-item {
  display: inline-block;
  text-align: center;
  font-size: 14px;
  font-family: 'Verio Sans', Roboto-Medium, sans-serif;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.search-item a {
  color: var(--color-text-muted);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.search-item a:active { opacity: .5; }

.search-item .label {
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-item.selected .label { position: relative; color: var(--color-text-dark); }
.search-item.selected a { pointer-events: none; }
.search-item.selected .label:before {
  position: absolute;
  content: "";
  background: var(--color-text-dark);
  width: 100%;
  height: 2px;
  bottom: -7px;
  left: 0; right: 0;
}

@media (max-width: 780px) {
  .tab-wrapper svg { display: none; }
  .search-box .search-toggle { pointer-events: none; }
}

@media (min-width: 780px) {
  .search-item.selected span { color: #1558d6; }
  .search-item.selected .label svg { fill: #1558d6; }
  .search-item.selected .label:before { background: #1558d6; bottom: -12px; }
}

/* --------------------------------------------------------------------
   Result wrapper (dipakai semua mode: web/news/gambar/video)
   -------------------------------------------------------------------- */

.result-wrapper { width: 100%; padding: 0 0 20px; }

.main-result {
  position: relative;
  min-width: 100%;
  background: var(--color-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

@media (min-width: 780px) {
  .header,
  .search-menu,
  .result-wrapper {
    padding-left: 130px;
    box-shadow: none;
  }
  .result-wrapper { display: flex; background: var(--color-white); padding-top: 5px; }
  .main-result { min-width: var(--page-max-width); max-width: var(--page-max-width); }
  .header { padding-top: 13px; }
  .search-input { border: 1px solid #F8F8F8; padding-left: 20px; }
  .search-box .search-toggle { left: auto; right: 8px; }
  .search-box .cleartext { right: 40px; }
  .search-menu { margin: 8px 0; }
  .tab-wrapper { padding: 8px 16px 12px 16px; }
  .result-stats { display: block; color: var(--color-text-muted); font-size: 16px; margin: 10px 0 0 15px; }
}

@media (min-width: 992px) {
  .header, .search-menu, .result-wrapper { padding-left: var(--page-gutter); }
}

.result-stats { display: none; }

/* --------------------------------------------------------------------
   Pagination ("Tampilkan lebih banyak") & loader
   -------------------------------------------------------------------- */

.show-wrapper {
  width: 100%;
  padding: 8px 18px;
  height: 58px;
  display: flex;
  font-size: 14px;
  position: relative;
  align-items: center;
  justify-content: center;
}

.show-wrapper .more {
  width: 100%;
  height: 44px;
  border-radius: 22px;
  box-shadow: var(--card-shadow);
  cursor: pointer;
  user-select: none;
  position: relative;
  border: none;
  background: var(--color-white);
  -webkit-tap-highlight-color: transparent;
}

.show-wrapper .more:before {
  content: "";
  width: 20px;
  height: 15px;
  position: absolute;
  left: 12px;
  background-image: url('data:image/svg+xml,<svg focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"></path></svg>');
  background-size: 20px;
  background-position: center;
  background-repeat: no-repeat;
}

.show-wrapper .more:active { animation: hoverAnim .5s; }

.pagination-divider {
  background-color: #dadce0;
  height: 1px;
  position: absolute;
  width: 100%;
}

@keyframes hoverAnim { from { background: #ededed; } to { background: white; } }

@media (min-width: 780px) { .show-wrapper .more { width: 50%; } }

.loader { width: 46px; }
.circular {
  width: 80%; height: 80%; margin: auto;
  transform-origin: center center;
  animation: rotate 2s linear infinite;
}
.path {
  stroke-dasharray: 1, 200; stroke-dashoffset: 0;
  stroke: #4c8bf5; stroke-linecap: round;
  animation: dash 1.5s ease-in-out infinite;
}
@keyframes rotate { 100% { transform: rotate(360deg); } }
@keyframes dash {
  0% { stroke-dasharray: 1, 200; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 89, 200; stroke-dashoffset: -35px; }
  100% { stroke-dasharray: 89, 200; stroke-dashoffset: -124px; }
}

/* --------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------- */

.footer {
  padding: 14px 0;
  background: #FBFBFB;
  border: 1px solid var(--color-border);
  border-style: solid none;
  margin-top: 6px;
}
.footer ul { list-style: none; text-align: center; }
.footer ul a {
  color: #444444;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.footer ul a svg { margin: 0 4px; }
.footer ul li { display: inline-block; margin: 4px 8px; }
.footer .copyright {
  margin: 10px 0 0;
  text-align: center;
  font-family: Arial;
  color: #444444;
}

@media (min-width: 780px) { .footer { margin-top: 28px; } }

/* --------------------------------------------------------------------
   Dark mode
   -------------------------------------------------------------------- */

body.dark, body.dark .result-wrapper { background: #171717; }
body.dark .search-input { border: none; color: #E9EAEE; background: #3C4043; }
body.dark .search-item a { color: #9BA0A6; }
body.dark .search-item.selected .label,
body.dark .search-item.selected span { color: #E9EAEE; }
body.dark .search-item.selected .label:before { background: #E9EAEE; }
body.dark .search-item.selected .label svg { fill: #E9EAEE; }
body.dark .search-menu { border-color: #24282B; }
body.dark .header { background: #202125; }
body.dark .footer { border-color: #24282B; background: #202125; }
body.dark .footer ul a, body.dark .footer .copyright { color: #BDC1C4; }

body.dark .show-wrapper .more {
  color: #E9EAEE;
  border-color: transparent;
  background: #303135;
}
body.dark .show-wrapper .more:before { filter: invert(100%); }
body.dark .show-wrapper .more:active { animation-name: hoverAnimDark; }
@keyframes hoverAnimDark { from { background: #3C4043; } to { background: #202125; } }

@media (min-width: 780px) {
  body.dark .header { background: #171717; }
}
