/* ══════════════════════════════════════════════════════════════
   iOS-style drum-roller picker for Creative Search (mobile)
   ══════════════════════════════════════════════════════════════ */

/* ── Backdrop ── */
.picker-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.picker-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Sheet ── */
.picker-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  z-index: 9999;
  background: #f2f2f7;
  border-radius: 14px 14px 0 0;
  max-height: 55vh;
  min-height: 340px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  transition: transform .32s cubic-bezier(.32,.72,0,1);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.picker-sheet.open {
  transform: translateX(-50%) translateY(0);
}

/* ── Header ── */
.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 50px;
  min-height: 50px;
  border-bottom: 0.5px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.85);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.picker-title {
  font-size: 16px;
  font-weight: 600;
  color: #1c1c1e;
  letter-spacing: -0.01em;
}
.picker-nav {
  background: none;
  border: none;
  font-size: 17px;
  font-weight: 400;
  color: #007aff;
  cursor: pointer;
  padding: 6px 2px;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.picker-back {
  font-size: 15px;
  line-height: 1;
  font-weight: 400;
  padding: 6px 2px;
}
.picker-done {
  font-weight: 600;
}

/* ── Search input (above wheel) ── */
.picker-search-box {
  display: flex;
  align-items: center;
  margin: 10px 16px 6px;
  background: rgba(120,120,128,0.12);
  border-radius: 10px;
  padding: 0 12px;
  height: 38px;
  flex-shrink: 0;
}
.picker-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 15px;
  font-family: inherit;
  color: #1c1c1e;
  padding: 0;
  height: 100%;
  -webkit-appearance: none;
}
.picker-search-input::placeholder {
  color: #8e8e93;
}
.picker-search-clear {
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(120,120,128,0.3);
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 13px;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  padding: 0;
  margin-left: 6px;
  flex-shrink: 0;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
[data-theme="dark"] .picker-search-box {
  background: rgba(120,120,128,0.24);
}
[data-theme="dark"] .picker-search-input {
  color: #f2f2f7;
}
[data-theme="dark"] .picker-search-input::placeholder {
  color: #636366;
}
[data-theme="dark"] .picker-search-clear {
  background: rgba(120,120,128,0.5);
}

/* ── Body ── */
.picker-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* ── Category list ── */
.picker-categories {
  padding: 8px 0;
}
.picker-cat-row {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0 20px;
  height: 52px;
  background: #fff;
  border: none;
  border-bottom: 0.5px solid rgba(0,0,0,0.08);
  cursor: pointer;
  font-family: inherit;
  font-size: 17px;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s;
}
.picker-cat-row:first-child {
  border-radius: 10px 10px 0 0;
}
.picker-cat-row:nth-last-child(2) {
  border-radius: 0 0 10px 10px;
  border-bottom: none;
}
.picker-categories > .picker-cat-row {
  margin-left: 16px;
  margin-right: 16px;
  width: calc(100% - 32px);
}
.picker-cat-row:active {
  background: rgba(0,0,0,0.04);
}
.picker-cat-label {
  flex: 1;
  color: #1c1c1e;
  font-weight: 400;
}
.picker-cat-value {
  color: #8e8e93;
  font-size: 15px;
  margin-right: 8px;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.picker-cat-row.has-value .picker-cat-value {
  color: #007aff;
  font-weight: 500;
}
.picker-cat-chevron {
  color: #c7c7cc;
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
}
.picker-cat-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(120,120,128,0.2);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  flex-shrink: 0;
}
[data-theme="dark"] .picker-cat-clear {
  background: rgba(120,120,128,0.4);
}

/* ── Clear row ── */
.picker-clear-row {
  margin-top: 12px !important;
  border-radius: 10px !important;
  border-bottom: none !important;
  justify-content: center;
  color: #ff3b30;
  font-weight: 400;
  font-size: 17px;
}

/* ── Search button inside picker ── */
.picker-search-btn {
  display: block;
  width: calc(100% - 32px);
  margin: 12px auto 20px;
  padding: 14px 24px;
  background: #007aff;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, transform .1s;
  letter-spacing: -0.01em;
}
.picker-search-btn:active {
  background: #0066d6;
  transform: scale(0.98);
}
[data-theme="dark"] .picker-search-btn {
  background: #0a84ff;
}
[data-theme="dark"] .picker-search-btn:active {
  background: #0070e0;
}

/* ── Wheel view ── */
.picker-wheel-view {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}
.picker-wheel-row {
  display: flex;
  align-items: stretch;
  flex: 1;
  min-height: 280px;
}
.picker-wheel {
  flex: 1;
  position: relative;
  height: 280px;
  overflow: hidden;
}

/* Selection highlight band */
.picker-wheel-highlight {
  position: absolute;
  top: 50%;
  left: 16px;
  right: 16px;
  height: 40px;
  transform: translateY(-50%);
  background: rgba(120,120,128,0.12);
  border-radius: 8px;
  pointer-events: none;
  z-index: 1;
}

/* Scrollable area */
.picker-wheel-scroll {
  height: 280px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 2;
  /* Hide scrollbar */
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.picker-wheel-scroll::-webkit-scrollbar {
  display: none;
}

.picker-wheel-pad {
  flex-shrink: 0;
}

.picker-wheel-item {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  font-weight: 400;
  color: #1c1c1e;
  cursor: pointer;
  transition: opacity .08s, transform .08s;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 20px;
}
.picker-wheel-item.selected {
  font-weight: 500;
  opacity: 1;
  transform: scale(1);
}
.picker-wheel-item.near {
  opacity: 0.55;
  transform: scale(0.95);
}
.picker-wheel-item.far {
  opacity: 0.3;
  transform: scale(0.9);
  font-size: 19px;
}
.picker-wheel-item.farthest {
  opacity: 0.15;
  transform: scale(0.85);
  font-size: 17px;
}

/* Invalid items — greyed out, not selectable */
.picker-wheel-item.picker-wheel-invalid {
  color: #c7c7cc !important;
  opacity: 0.4 !important;
  pointer-events: none;
  font-size: 15px;
  font-style: italic;
}
.picker-wheel-item.picker-wheel-invalid.selected,
.picker-wheel-item.picker-wheel-invalid.near {
  opacity: 0.3 !important;
}
[data-theme="dark"] .picker-wheel-item.picker-wheel-invalid {
  color: #48484a !important;
}

/* Gradient masks top + bottom */
.picker-wheel::before,
.picker-wheel::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 60px;
  pointer-events: none;
  z-index: 3;
}
.picker-wheel::before {
  top: 0;
  background: linear-gradient(to bottom, #f2f2f7 0%, transparent 100%);
}
.picker-wheel::after {
  bottom: 0;
  background: linear-gradient(to top, #f2f2f7 0%, transparent 100%);
}

/* ── Loading state ── */
.picker-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  font-size: 15px;
  color: #8e8e93;
}

/* ── Alphabet sidebar ── */
.picker-alpha {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 28px;
  min-width: 28px;
  height: 280px;
  padding: 6px 0;
  overflow: hidden;
  z-index: 4;
}
.picker-alpha-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  font-size: 10px;
  font-weight: 600;
  color: #007aff;
  width: 28px;
  height: auto;
  flex: 1;
  max-height: 18px;
  cursor: pointer;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
}
.picker-alpha-letter:active {
  background: rgba(0,122,255,0.1);
  border-radius: 4px;
}

/* ══════════════════════════════════════════════════════════════
   Dark mode overrides for picker
   ══════════════════════════════════════════════════════════════ */
[data-theme="dark"] .picker-sheet {
  background: #1c1c1e;
}
[data-theme="dark"] .picker-header {
  background: rgba(44,44,46,0.85);
  border-bottom-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .picker-title {
  color: #f2f2f7;
}
[data-theme="dark"] .picker-nav {
  color: #0a84ff;
}
[data-theme="dark"] .picker-cat-row {
  background: #2c2c2e;
  border-bottom-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .picker-cat-row:active {
  background: rgba(255,255,255,0.06);
}
[data-theme="dark"] .picker-cat-label {
  color: #f2f2f7;
}
[data-theme="dark"] .picker-cat-value {
  color: #636366;
}
[data-theme="dark"] .picker-cat-row.has-value .picker-cat-value {
  color: #0a84ff;
}
[data-theme="dark"] .picker-cat-chevron {
  color: #48484a;
}
[data-theme="dark"] .picker-clear-row {
  color: #ff453a;
}
[data-theme="dark"] .picker-wheel-highlight {
  background: rgba(120,120,128,0.24);
}
[data-theme="dark"] .picker-wheel-item {
  color: #f2f2f7;
}
[data-theme="dark"] .picker-wheel::before {
  background: linear-gradient(to bottom, #1c1c1e 0%, transparent 100%);
}
[data-theme="dark"] .picker-wheel::after {
  background: linear-gradient(to top, #1c1c1e 0%, transparent 100%);
}
[data-theme="dark"] .picker-alpha-letter {
  color: #0a84ff;
}
[data-theme="dark"] .picker-backdrop {
  background: rgba(0,0,0,0.55);
}

/* ── Mobile sticky search button ── */
.mobileSearchBtn {
  display: none;
}
@media (max-width: 768px) {
  .mobileSearchBtn {
    display: none; /* hidden by default, shown via JS */
    width: calc(100% - 40px);
    max-width: 340px;
    margin: 16px auto 0;
    padding: 14px 24px;
    background: #007aff;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s, transform .1s;
    letter-spacing: -0.01em;
  }
  .mobileSearchBtn.visible {
    display: block;
  }
  .mobileSearchBtn:active {
    background: #0066d6;
    transform: scale(0.98);
  }
  [data-theme="dark"] .mobileSearchBtn {
    background: #0a84ff;
  }
  [data-theme="dark"] .mobileSearchBtn:active {
    background: #0070e0;
  }
}