/* ============================================
   SantriDigitalPro — Global Search Overlay
   Mobile-first, sederhana, ringan.
   ============================================ */

/* ── Overlay wrapper ── */
#gs-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
}

#gs-overlay.is-open {
  display: block;
}

/* ── Backdrop ── */
.gs-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: gs-fade-in 150ms ease;
}

/* ── Sheet (the actual panel) ── */
.gs-sheet {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-card, var(--border));
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: gs-slide-down 160ms ease;
}

@media (min-width: 640px) {
  .gs-sheet {
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    width: min(600px, 92vw);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-card, var(--border));
    max-height: 80vh;
    animation: gs-scale-in 160ms ease;
  }
}

/* ── Header (input bar) ── */
.gs-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4);
  border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}

.gs-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.gs-icon-search {
  position: absolute;
  left: var(--space-3);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}

.gs-input {
  width: 100%;
  height: 48px;
  padding: 0 var(--space-10) 0 var(--space-10);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.gs-input::placeholder { color: var(--text-muted); }

.gs-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
  background: var(--bg-card);
}

/* Hide native search clear button */
.gs-input::-webkit-search-cancel-button { display: none; }

.gs-clear {
  position: absolute;
  right: var(--space-2);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.gs-clear:hover { background: var(--accent-muted); color: var(--accent); }
.gs-clear svg { width: 14px; height: 14px; }

.gs-close {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2) var(--space-1);
  white-space: nowrap;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
}

.gs-close:hover { opacity: 0.7; }

/* ── Body (results) ── */
.gs-body {
  overflow-y: auto;
  flex: 1;
  padding: var(--space-2) 0 var(--space-4);
  -webkit-overflow-scrolling: touch;
}

/* Hint text */
.gs-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: var(--space-8) var(--space-4);
}

/* Count label */
.gs-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: var(--space-2) var(--space-4) var(--space-1);
  font-weight: var(--weight-medium);
  letter-spacing: 0.02em;
}

/* ── Result items ── */
.gs-result {
  display: block;
  padding: var(--space-3) var(--space-4);
  text-decoration: none;
  border-bottom: 1px solid var(--divider);
  transition: background var(--transition-fast);
  cursor: pointer;
}

.gs-result:last-child { border-bottom: none; }

.gs-result:hover,
.gs-result:focus {
  background: var(--accent-muted);
  outline: none;
}

.gs-result:active { background: var(--accent-light); }

.gs-result__top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.gs-result__code {
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  font-weight: var(--weight-bold);
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.gs-result__title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  line-height: 1.35;
}

.gs-result__desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: var(--space-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Type badges ── */
.gs-badge {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: var(--weight-bold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--radius-sm, 4px);
  line-height: 1.5;
}

.gs-badge--page   { background: var(--bg-secondary); color: var(--text-muted); border: 1px solid var(--border); }
.gs-badge--materi { background: rgba(26, 122, 110, 0.12); color: var(--accent); }
.gs-badge--app    { background: rgba(99, 102, 241, 0.12); color: #4f46e5; }
.gs-badge--produk { background: rgba(234, 179, 8, 0.12); color: #a16207; }

[data-theme="dark"] .gs-badge--app    { color: #818cf8; }
[data-theme="dark"] .gs-badge--produk { color: #fbbf24; }

/* ── Empty state ── */
.gs-empty {
  text-align: center;
  padding: var(--space-8) var(--space-6);
}

.gs-empty__icon { font-size: 2rem; margin-bottom: var(--space-3); }

.gs-empty__msg {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.gs-empty__hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

/* ── Suggestion chips ── */
.gs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
}

.gs-chip {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full, 9999px);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-body);
  min-height: 40px;
}

.gs-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-muted); }

/* ── Search button in navbar ── */
.gs-nav-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all var(--transition-fast);
  cursor: pointer;
  flex-shrink: 0;
}

.gs-nav-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-muted); }
.gs-nav-btn svg { width: 18px; height: 18px; }

/* ── Animations ── */
@keyframes gs-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes gs-slide-down {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

@keyframes gs-scale-in {
  from { transform: translate(-50%, calc(-50% - 10px)); opacity: 0; }
  to   { transform: translate(-50%, -50%);              opacity: 1; }
}

/* ── Dark mode tweaks ── */
[data-theme="dark"] .gs-sheet {
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .gs-backdrop, .gs-sheet { animation: none; }
}
