/* DwSearch — header arama popup'ı + /search sayfası. Apple HIG: buzlu cam, hairline, systemBlue. */

.dws-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-full, 9999px);
  border: 0; background: transparent; color: var(--text);
  font-size: 1.2rem; cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}
.dws-trigger:hover { background: var(--bg-surface); }
.dws-trigger:active { transform: scale(.92); }
.dws-trigger:focus-visible { outline: 2px solid var(--drawest-accent); outline-offset: 2px; }
.dws-trigger kbd {
  display: none; margin-left: 6px; font: 600 11px/1 var(--font-family, system-ui);
  padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border);
  color: var(--muted); background: var(--bg-elevated);
}
@media (min-width: 992px) {
  .dws-trigger--wide {
    width: auto; padding: 0 12px 0 14px; gap: 8px; height: 36px;
    background: var(--bg-surface); font-size: 1rem; color: var(--muted);
  }
  .dws-trigger--wide span { font-size: 14px; }
  .dws-trigger--wide kbd { display: inline-block; }
}

/* ---------- Overlay ---------- */
.dws-overlay {
  position: fixed; inset: 0; z-index: 2147481000;
  display: flex; justify-content: center; align-items: flex-start;
  padding: max(10vh, env(safe-area-inset-top, 0px) + 12px) 16px 16px;
  background: rgba(0, 0, 0, .28);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden;
  transition: opacity .25s ease, visibility 0s linear .25s;
}
.dws-overlay.is-open { opacity: 1; visibility: visible; transition: opacity .25s ease; }
body.dws-lock { overflow: hidden; }

.dws-panel {
  width: 100%; max-width: 640px; max-height: min(78vh, 720px);
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: 22px; border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-elevated) 86%, transparent);
  -webkit-backdrop-filter: blur(28px) saturate(180%); backdrop-filter: blur(28px) saturate(180%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .25), 0 2px 8px rgba(0, 0, 0, .08);
  transform: translateY(-18px) scale(.96); opacity: 0;
  transition: transform .42s cubic-bezier(.2, .9, .25, 1.15), opacity .25s ease;
}
.dws-overlay.is-open .dws-panel { transform: none; opacity: 1; }

.dws-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 14px 18px; border-bottom: 1px solid var(--border);
}
.dws-bar > .bi-search { font-size: 1.15rem; color: var(--muted); }
.dws-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 17px; font-weight: 500; padding: 6px 0;
}
.dws-input::placeholder { color: var(--muted); }
.dws-input::-webkit-search-cancel-button { display: none; }
.dws-clear, .dws-close {
  border: 0; background: var(--bg-surface); color: var(--muted);
  border-radius: 999px; height: 32px; min-width: 32px; padding: 0 12px;
  font-size: 14px; font-weight: 600; cursor: pointer;
}
.dws-clear { padding: 0; width: 32px; display: none; }
.dws-clear.is-visible { display: inline-flex; align-items: center; justify-content: center; }
.dws-close { color: var(--drawest-accent); background: transparent; }

.dws-body { overflow-y: auto; overscroll-behavior: contain; padding: 6px 8px 10px; -webkit-overflow-scrolling: touch; }

.dws-status {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 28px 16px; color: var(--muted); font-size: 15px; text-align: center;
}
.dws-dots { display: inline-flex; gap: 4px; }
.dws-dots i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--drawest-accent);
  animation: dws-bounce 1s infinite ease-in-out;
}
.dws-dots i:nth-child(2) { animation-delay: .15s; }
.dws-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dws-bounce { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

.dws-skel { display: flex; align-items: center; gap: 12px; padding: 10px; }
.dws-skel span { display: block; border-radius: 10px; background: var(--bg-surface); position: relative; overflow: hidden; }
.dws-skel span::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--bg-elevated) 70%, transparent), transparent);
  animation: dws-shimmer 1.2s infinite;
}
@keyframes dws-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.dws-group { padding: 6px 0; animation: dws-in .32s ease both; }
.dws-group-head {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px 4px; font-size: 12px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.dws-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px;
  border-radius: 14px; color: var(--text); text-decoration: none;
  min-height: 52px; transition: background .15s ease;
}
.dws-item:hover, .dws-item.is-active { background: var(--bg-surface); color: var(--text); }
.dws-item img, .dws-item .dws-ph {
  flex: none; width: 42px; height: 42px; border-radius: 10px; object-fit: cover; background: var(--bg-surface);
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
}
.dws-item[data-cat="series"] img, .dws-item[data-cat="animations"] img { width: 36px; height: 50px; }
.dws-item[data-cat="users"] img, .dws-item[data-cat="posts"] img { border-radius: 50%; }
.dws-item-text { min-width: 0; display: flex; flex-direction: column; }
.dws-item-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dws-item-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dws-item mark { background: transparent; color: var(--drawest-accent); padding: 0; }

.dws-all {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 6px 4px 2px; padding: 12px; border-radius: 14px;
  background: var(--drawest-accent); color: #fff; font-weight: 600; text-decoration: none;
}
.dws-all:hover { color: #fff; filter: brightness(1.06); }

@keyframes dws-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 575.98px) {
  .dws-overlay { padding: 0; align-items: stretch; }
  .dws-panel {
    max-width: none; max-height: none; height: 100%; border-radius: 0; border: 0;
    padding-top: env(safe-area-inset-top, 0px);
    transform: translateY(24px); background: var(--bg-elevated);
  }
  .dws-input { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .dws-overlay, .dws-panel, .dws-group { transition: none; animation: none; }
  .dws-dots i, .dws-skel span::after { animation: none; }
}

/* ---------- /search sayfası ---------- */
.dws-page { max-width: 1100px; padding-top: 20px; padding-bottom: 40px; }
.dws-page-form {
  display: flex; align-items: center; gap: 10px; padding: 0 16px;
  height: 52px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-elevated);
}
.dws-page-form i { color: var(--muted); font-size: 1.1rem; }
.dws-page-form input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 17px; }
.dws-tabs {
  display: flex; gap: 8px; margin: 16px 0 8px; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
}
.dws-tabs::-webkit-scrollbar { display: none; }
.dws-tabs a {
  flex: none; scroll-snap-align: start; padding: 8px 14px; min-height: 40px;
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; background: var(--bg-surface); color: var(--text);
  text-decoration: none; font-size: 14px; font-weight: 500;
}
.dws-tabs a.is-active { background: var(--drawest-accent); color: #fff; }
.dws-section { margin-top: 24px; }
.dws-section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.dws-section-head h2 { font-size: 20px; font-weight: 700; margin: 0; display: flex; gap: 8px; align-items: center; }
.dws-section-head a { color: var(--drawest-accent); text-decoration: none; font-size: 14px; font-weight: 600; }
.dws-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.dws-card {
  display: flex; flex-direction: column; border-radius: 14px; overflow: hidden;
  background: var(--bg-elevated); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; transition: transform .2s ease, box-shadow .2s ease;
}
.dws-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--text); }
.dws-card img, .dws-card-ph { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--bg-surface); }
.dws-grid--series .dws-card img, .dws-grid--animations .dws-card img, .dws-grid--chapters .dws-card img { aspect-ratio: 2 / 3; }
.dws-grid--episodes .dws-card img { aspect-ratio: 16 / 9; }
.dws-card-ph { display: flex; align-items: center; justify-content: center; font-size: 1.6rem; color: var(--muted); }
.dws-card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dws-card-title { font-weight: 600; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dws-card-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dws-grid--users, .dws-grid--posts { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.dws-grid--users .dws-card, .dws-grid--posts .dws-card { flex-direction: row; align-items: center; padding: 10px; gap: 4px; }
.dws-grid--users .dws-card img, .dws-grid--posts .dws-card img { width: 48px; height: 48px; flex: none; border-radius: 50%; }
.dws-empty { text-align: center; padding: 60px 16px; color: var(--text); }
.dws-empty > i { font-size: 2.4rem; color: var(--muted); }
@media (max-width: 575.98px) {
  .dws-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dws-grid--users, .dws-grid--posts { grid-template-columns: 1fr; }
}
