/* ── VARIABEL GRAND DESIGN ── */
:root {
  --ink: #1a1814; --paper: #f7f3ec; --paper2: #ede9e0;
  --green: #1d7a55; --green-b: #22c97a; --green-p: #d4efe3;
  --blue: #1a0dab; --blue-v: #681da8; 
  --muted: #4b5563; --border: #dadce0;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --mono: 'DM Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--sans); background: #fff; color: var(--ink);
  min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden;
}
a { text-decoration: none; }

/* Header Atas (Logo + Search Bar Mini) */
.rv-header {
  display: flex; align-items: center; padding: 24px 32px 0; gap: 40px; background: #fff;
}
.rv-logo {
  font-family: var(--serif); font-size: 28px; color: var(--ink); flex-shrink: 0; line-height: 1; cursor: pointer;
}
.rv-logo em { color: var(--green); font-style: italic; }

.search-box-mini {
  flex: 1; max-width: 690px; min-width: 0; display: flex; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: 24px; padding: 10px 24px; box-shadow: 0 2px 5px rgba(26,24,20,.05); transition: box-shadow 0.2s;
}
.search-box-mini:focus-within { box-shadow: 0 4px 12px rgba(26,24,20,.1); }
.search-box-mini input {
  flex: 1; min-width: 0; border: none; outline: none; font-size: 16px; font-family: var(--sans); color: var(--ink); margin-left: 12px; margin-right: 12px;
}
.search-box-mini button {
  background: none; border: none; cursor: pointer; display: flex; align-items: center; color: var(--green); border-left: 1px solid var(--border); padding-left: 16px;
}

/* Tabs Navigasi */
.rv-tabs {
  display: flex; gap: 24px; padding: 24px 32px 0 190px; border-bottom: 1px solid #ebebeb; overflow-x: auto; background: #fff;
  -ms-overflow-style: none; scrollbar-width: none;
}
.rv-tabs::-webkit-scrollbar {
  display: none;
}
.rv-tab {
  font-size: 14px; color: var(--muted); padding-bottom: 14px; cursor: pointer; display: flex; align-items: center; gap: 8px; border-bottom: 3px solid transparent; white-space: nowrap; transition: color 0.2s;
}
.rv-tab:hover { color: var(--ink); }
.rv-tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 500; }

/* Layout Utama Hasil */
.rv-main {
  display: grid; grid-template-columns: 158px minmax(0, 650px) 1fr; gap: 32px; padding: 20px 32px 60px;
}

/* Sidebar Filters */
.mobile-filter-btn { display: none; }
.rv-sidebar { display: flex; flex-direction: column; gap: 24px; padding-top: 10px; }
.filter-group { display: flex; flex-direction: column; gap: 10px; }
.filter-title { font-family: var(--mono); font-size: 11px; color: var(--ink); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.filter-item { font-size: 13px; color: var(--muted); cursor: pointer; transition: color 0.2s; display: flex; align-items: center; gap: 8px;}
.filter-item:hover { color: var(--ink); }
.filter-item.active { color: var(--green); font-weight: 500; }
.filter-item input[type="radio"], .filter-item input[type="checkbox"] { accent-color: var(--green); margin: 0; cursor: pointer;}

/* Konten Hasil Pencarian */
.rv-content { display: flex; flex-direction: column; transition: opacity 0.2s ease; }
.search-stats {
  font-size: 14px; color: var(--muted); margin-bottom: 24px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.intent-badge {
  background: var(--paper); border: 1px solid var(--border); padding: 4px 10px; border-radius: 6px; font-family: var(--mono); font-size: 10px; color: var(--ink); display: inline-flex; align-items: center; gap: 6px;
}

/* Item Hasil Pencarian */
.result-item { margin-bottom: 32px; }
.result-breadcrumb {
  font-family: var(--sans); font-size: 12px; color: var(--ink); display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
  min-width: 0;
  max-width: 100%;
}
.result-breadcrumb:hover .url {
  text-decoration: underline;
}
.result-breadcrumb .url { 
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  min-width: 0;
}
.result-breadcrumb .icon-box {
  width: 24px; height: 24px; background: var(--paper); border: 1px solid var(--border); border-radius: 50%; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.result-title {
  font-family: var(--serif); font-size: 22px; color: var(--blue); font-weight: 400; line-height: 1.3; cursor: pointer; display: inline-block; margin-bottom: 6px;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.result-title:hover { text-decoration: underline; }
.result-snippet {
  font-size: 14px; color: var(--muted); line-height: 1.58; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.result-snippet strong { font-weight: 700; color: var(--ink); }
.result-meta { 
  font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 8px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.result-meta span {
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.result-meta .sim-score { color: #124e35; background: var(--green-p); padding: 2px 8px; border-radius: 4px; font-weight: 500;}
.result-meta .konten-badge { background: var(--paper2); padding: 2px 8px; border-radius: 4px; }

/* Loading skeleton (Composited GPU-accelerated shimmer animation) */
.skeleton {
  position: relative;
  overflow: hidden;
  background-color: #f3f4f6;
  border-radius: 4px;
}
.skeleton::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 100%);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}
.skeleton-item { margin-bottom: 32px; }
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 26px; width: 70%; margin-bottom: 8px; }
.skeleton-text { height: 14px; margin-bottom: 4px; }
.skeleton-text:last-child { width: 60%; }

/* Pesan error */
.api-error {
  background: #fff3f3; border: 1px solid #fca5a5; border-radius: 8px; padding: 16px 20px; color: #991b1b; font-size: 14px; line-height: 1.6;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.api-error strong { display: block; margin-bottom: 4px; font-size: 15px; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 8px; margin-top: 24px; flex-wrap: wrap; }
.page-btn {
  min-width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 50%; background: #fff; cursor: pointer; font-size: 13px; font-family: var(--sans); color: var(--blue); display: flex; align-items: center; justify-content: center; transition: background 0.15s;
}
.page-btn:hover { background: var(--paper); }
.page-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Advanced options toggle */
.adv-toggle { font-size: 12px; color: var(--green); cursor: pointer; margin-top: 16px; display: inline-flex; align-items: center; gap: 4px; user-select: none; }
.adv-toggle svg { transition: transform 0.2s; }
.adv-toggle.open svg { transform: rotate(180deg); }
.adv-panel { display: none; flex-direction: column; gap: 10px; margin-top: 8px; }
.adv-panel.open { display: flex; }
.adv-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); margin-bottom: 2px; display: block; }
.adv-input { width: 100%; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; font-size: 13px; font-family: var(--sans); color: var(--ink); outline: none; }
.adv-input:focus { border-color: var(--green); }
.adv-row { display: flex; gap: 8px; }
.adv-row .adv-group { flex: 1; }

/* Responsif Mobile */
@media(max-width: 1024px) {
  .rv-tabs { padding-left: 32px; }
  .rv-main { grid-template-columns: minmax(0, 1fr); padding-left: 32px; }
  
  .mobile-filter-btn {
    display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border); padding: 10px 16px; border-radius: 100px; font-size: 13px; font-weight: 500; cursor: pointer; margin-bottom: 20px; width: fit-content;
  }
  .rv-sidebar { display: none; background: #fff; border: 1px solid var(--border); padding: 20px; border-radius: 16px; margin-bottom: 24px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
  .rv-sidebar.show { display: flex; }
}
@media(max-width: 768px) {
  .rv-header { flex-direction: column; align-items: flex-start; gap: 16px; padding: 16px 20px 0; }
  .search-box-mini { width: 100%; max-width: 100%; border-radius: 20px;}
  .rv-tabs { padding: 12px 20px 0; gap: 16px; }
  .rv-main { padding: 20px; }
  .result-title { font-size: 18px; }
}

/* ── ACTIVE FILTER PILL BADGES ── */
.active-filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.filter-badge {
  background: var(--green-p);
  color: #124e35;
  border: 1px solid rgba(29, 122, 85, 0.18);
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 12px;
  font-family: var(--sans);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  max-width: 100%;
}

.filter-badge:hover {
  background: #c2ecd7;
  border-color: var(--green);
}

.filter-badge .badge-text {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.filter-badge .close-btn {
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transition: background 0.15s;
}

/* ── CLEAR ALL FILTERS BUTTON ── */
.clear-all-btn {
  font-size: 11px;
  font-family: var(--mono);
  color: #c53030;
  background: #fff5f5;
  border: 1px solid rgba(197, 48, 48, 0.2);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
  display: none; /* Disembunyikan secara default, ditampilkan lewat JS */
  width: 100%;
  text-align: center;
  margin-bottom: 12px;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.clear-all-btn:hover {
  background: #fed7d7;
  border-color: #c53030;
}

/* ── SIDEBAR ACTIVE HIGHLIGHT ── */
.filter-item.item-active {
  color: var(--green) !important;
  font-weight: bold !important;
}

/* ── INFOGRAPHIC RESULT CARD ── */
.result-item.infographic-card {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 6px rgba(26,24,20,.03);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  margin-bottom: 24px;
}

.result-item.infographic-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(26,24,20,.08);
  border-color: var(--green);
}

.infographic-preview-container {
  width: 140px;
  height: 140px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  position: relative;
}

.infographic-preview-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.result-item.infographic-card:hover .infographic-preview-container img {
  transform: scale(1.06);
}

.infographic-details {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

@media(max-width: 576px) {
  .result-item.infographic-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  
  .infographic-preview-container {
    width: 100%;
    height: 180px;
  }
}

/* ── MODAL OVERLAY INFOGRAFIS ── */
.info-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(26, 24, 20, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 24px;
}
.info-modal-overlay.active {
  opacity: 1;
}

.info-modal-card {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 960px;
  max-height: 85vh;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
}
.info-modal-overlay.active .info-modal-card {
  transform: scale(1);
}

.info-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(26, 24, 20, 0.05);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  color: var(--ink);
  transition: background 0.2s, transform 0.2s;
}
.info-modal-close:hover {
  background: rgba(26, 24, 20, 0.1);
  transform: rotate(90deg);
}

.info-modal-content {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  max-height: 85vh;
  height: 100%;
}

.info-modal-media {
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  max-height: 85vh;
  min-height: 300px;
}
.info-modal-media img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
}

.info-modal-info {
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  min-width: 0;
}

.info-modal-badge {
  background: var(--green-p);
  color: var(--green);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  display: inline-block;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.info-modal-title {
  font-family: var(--serif);
  font-size: 24px;
  color: var(--ink);
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 16px;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.info-modal-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.info-modal-footer {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.info-modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  align-items: center;
}

.info-modal-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.info-btn-download {
  background: var(--green);
  color: #fff;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  transition: background 0.2s;
  cursor: pointer;
  border: none;
  text-decoration: none;
}
.info-btn-download:hover {
  background: #155e40;
}

.info-link-tab {
  font-size: 13px;
  color: var(--blue);
  cursor: pointer;
  text-decoration: none;
}
.info-link-tab:hover {
  text-decoration: underline;
}

/* Responsif Modal */
@media(max-width: 768px) {
  .info-modal-overlay {
    padding: 16px;
  }
  
  .info-modal-card {
    max-height: 90vh;
  }
  
  .info-modal-content {
    grid-template-columns: 1fr;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  .info-modal-media {
    max-height: 350px;
  }
  
  .info-modal-media img {
    max-height: 350px;
    width: 100%;
    object-fit: contain;
  }
  
  .info-modal-info {
    padding: 24px;
    border-left: none;
    border-top: 1px solid var(--border);
    overflow-y: visible;
  }
}

/* ── LOCAL FONTS (AUTO-DOWNLOADED) ── */
@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url('/fonts/dm-mono-normal-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'DM Mono';
  font-style: normal;
  font-weight: 500;
  font-display: optional;
  src: url('/fonts/dm-mono-normal-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url('/fonts/dm-sans-normal-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 500;
  font-display: optional;
  src: url('/fonts/dm-sans-normal-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'DM Sans';
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url('/fonts/dm-sans-normal-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 400;
  font-display: optional;
  src: url('/fonts/playfair-display-italic-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Playfair Display';
  font-style: italic;
  font-weight: 700;
  font-display: optional;
  src: url('/fonts/playfair-display-italic-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url('/fonts/playfair-display-normal-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Playfair Display';
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url('/fonts/playfair-display-normal-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
