/* Extra UI — story viewer, group detail, market, search */

.story-viewer {
  position: fixed; inset: 0; z-index: 4000;
  background: #000; display: none;
}
.story-viewer.open { display: block; }
.story-viewer-inner {
  width: 100%; max-width: 420px; height: 100%;
  margin: 0 auto; position: relative;
  display: flex; flex-direction: column;
}
.story-viewer-top {
  padding: max(12px, env(safe-area-inset-top, 0px)) 12px 12px;
  position: relative;
  z-index: 5;
}
.story-viewer-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.story-viewer-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  margin-left: auto;
  padding-right: env(safe-area-inset-right, 0px);
}
.story-viewer-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.story-viewer-time {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  font-weight: 400;
}
.story-options-wrap {
  position: relative;
}
.story-options-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.15rem;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.story-options-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #242526;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  min-width: 180px;
  z-index: 100;
  overflow: hidden;
}
.story-options-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  color: #ff4d4f;
  cursor: pointer;
  font-size: 0.9rem;
  text-align: left;
}
.story-progress { display: flex; gap: 4px; margin-bottom: 12px; }
.story-progress-bar {
  flex: 1; height: 3px; background: rgba(255,255,255,0.3); border-radius: 2px; overflow: hidden;
}
.story-progress-bar span {
  display: block; height: 100%; width: 0; background: #fff;
}
.story-progress-bar.done span { width: 100%; }
.story-progress-bar.active span { animation: storyProgress 5s linear forwards; }
.story-progress-bar.active.paused span,
.story-viewer--replying .story-progress-bar.active span {
  animation-play-state: paused;
}
.story-viewer--replying .story-tap-left,
.story-viewer--replying .story-tap-right {
  pointer-events: none;
}
@keyframes storyProgress { to { width: 100%; } }
.story-viewer-user {
  display: flex; align-items: center; gap: 10px; color: #fff;
  flex: 1;
  min-width: 0;
}
.story-viewer-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.75rem;
  flex-shrink: 0;
}
.story-close {
  border: none; background: transparent; color: #fff; font-size: 1.2rem; cursor: pointer;
  padding: 8px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.story-viewer-content {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 32px; text-align: center; color: #fff;
  font-size: 1.5rem; font-weight: 700; line-height: 1.4;
  position: relative; z-index: 2;
}
.story-slide-media {
  max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: 8px;
}
.story-text-content { max-width: 90%; word-break: break-word; }
.story-tap-left, .story-tap-right {
  position: absolute; top: 80px; bottom: 80px; width: 35%; z-index: 3;
}
.story-tap-left { left: 0; }
.story-tap-right { right: 0; }
.story-reply-btn {
  position: absolute; bottom: 16px; left: 16px; right: 16px; z-index: 5;
  border: 1px solid rgba(255,255,255,0.4); background: transparent; border-radius: 24px; padding: 4px;
}
.story-reply-btn input {
  width: 100%; border: none; background: transparent; color: #fff; padding: 10px 16px;
}
.story-reply-bar input::placeholder { color: rgba(255,255,255,0.6); }
.story-reply-bar {
  position: absolute; bottom: 16px; left: 16px; right: 16px; z-index: 5;
  display: flex; gap: 8px; align-items: center;
  border: 1px solid rgba(255,255,255,0.4); background: rgba(0,0,0,0.35);
  border-radius: 24px; padding: 6px 8px 6px 16px;
}
.story-reply-bar input {
  flex: 1; border: none; background: transparent; color: #fff; outline: none;
}
.story-reply-bar button {
  border: none; background: var(--jtb-yellow); color: #000; width: 36px; height: 36px;
  border-radius: 50%; cursor: pointer;
}

.color-swatch {
  width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; cursor: pointer;
}
.color-swatch.selected { border-color: var(--jtb-black); box-shadow: 0 0 0 2px #fff; }

.group-detail-cover {
  border-radius: var(--radius-lg); padding: clamp(32px, 5vw, 48px) clamp(16px, 4vw, 24px) 24px;
  color: #fff; position: relative; min-height: clamp(160px, 25vw, 220px);
}
.group-detail-cover h1 { margin: 0 0 8px; }
.group-detail-avatar {
  width: 72px; height: 72px; border-radius: 16px; object-fit: cover;
  border: 3px solid #fff; display: block; margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.group-admin-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.75rem; font-weight: 700; color: var(--jtb-yellow-hover, #e6b800);
  background: rgba(255, 204, 0, 0.15); padding: 2px 8px; border-radius: 999px;
}
.group-detail-cover .group-admin-badge { color: #fff; background: rgba(0,0,0,0.25); }
.group-back {
  position: absolute; top: 16px; left: 16px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,0.3); color: #fff;
  display: flex; align-items: center; justify-content: center;
}

.group-danger-zone {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.group-danger-zone h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: #e41e3f;
}
.group-delete-btn,
.group-delete-confirm-btn {
  color: #e41e3f !important;
  border-color: rgba(228, 30, 63, 0.35) !important;
}
.group-delete-confirm-btn {
  background: #e41e3f !important;
  color: #fff !important;
  border-color: #e41e3f !important;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-card, #fff);
  border-radius: var(--radius-lg, 12px);
  border: 1px solid var(--border);
  padding: 6px;
}
.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius, 8px);
  position: relative;
}
.member-row:hover { background: var(--bg-page, #f0f2f5); }
.member-row-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.member-row-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.member-row-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.member-row-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.member-row-meta strong {
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-menu-wrap { position: relative; flex-shrink: 0; }
.member-menu-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-muted);
}
.member-menu-btn:hover { background: var(--bg-page, #e4e6eb); }
.member-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 80;
  min-width: 220px;
  padding: 8px;
  background: var(--bg-card, #fff);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}
.member-menu.open { display: block; }
.member-menu button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: var(--radius, 8px);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text, #050505);
}
.member-menu button:hover { background: var(--bg-page, #f0f2f5); }
.member-menu-danger { color: #e41e3f !important; }

.market-detail-img {
  height: clamp(240px, 40vw, 420px); display: flex; align-items: center; justify-content: center;
}
.market-card-link {
  display: block; text-decoration: none; color: inherit;
  transition: transform 0.15s; width: 100%;
}
.market-card-link:hover { transform: translateY(-2px); }
.market-card-thumb {
  height: clamp(200px, 28vw, 280px); display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  color: rgba(255,255,255,0.5); font-size: clamp(2rem, 5vw, 3rem);
  overflow: hidden;
}

.market-live-strip {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1c1e21 0%, #3a3b3c 100%);
  color: #fff;
}
.market-live-strip.hidden { display: none; }
.market-live-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 0.9rem; }
.market-live-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.market-live-chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.08);
  color: #fff; border-radius: 999px; padding: 8px 14px; cursor: pointer; text-align: left;
}
.market-live-chip:hover { background: rgba(255,255,255,0.16); }
.live-dot-sm {
  width: 8px; height: 8px; border-radius: 50%; background: #e41e3f;
  box-shadow: 0 0 0 3px rgba(228,30,63,0.35);
}

.search-page-input-wrap {
  display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.search-page-input-wrap input { flex: 1; min-width: 200px; }
.search-result-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--radius);
  text-decoration: none; color: inherit; margin-bottom: 4px;
}
.search-result-row:hover { background: var(--bg-page); }

.settings-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.settings-tabs::-webkit-scrollbar {
  display: none;
  height: 0;
}
.settings-tab {
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  cursor: pointer;
  flex: 0 0 auto;
  white-space: nowrap;
  text-decoration: none;
}
.settings-tab.active { color: var(--jtb-yellow-hover); border-bottom-color: var(--jtb-yellow); }
.settings-panel { display: none; }
.settings-panel.active { display: block; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.setting-row label { font-weight: 600; flex: 1; }
.setting-row small { display: block; color: var(--text-muted); font-weight: 400; font-size: 0.8rem; }

.chat-search-input {
  width: 100%; border: none; background: var(--bg-page);
  border-radius: 20px; padding: 8px 14px; margin-bottom: 12px; font-size: 0.9rem;
}

.group-card-link { text-decoration: none; color: inherit; display: block; }
.group-card-link:hover .card { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }

.notif-item { cursor: pointer; }

.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr));
  gap: 6px;
}
.photo-cell {
  aspect-ratio: 1; min-height: 120px; background: var(--jtb-yellow-soft);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #b8860b; font-size: clamp(1rem, 3vw, 1.5rem);
}

@media (max-width: 600px) {
  .settings-row, .setting-row { flex-direction: column; align-items: flex-start; gap: 8px; }
}

.settings-photos-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (min-width: 540px) {
  .settings-photos-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.settings-photo-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.settings-photo-card label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 8px;
}

.settings-avatar-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  display: block;
  margin-bottom: 10px;
}

.settings-photo-card:has(.settings-cover-preview) {
  text-align: center;
}

.settings-photo-card:has(.settings-cover-preview) .settings-photo-preview-wrap {
  display: block;
  width: 90%;
  max-width: 100%;
  margin: 0 auto;
}

.settings-cover-preview {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  aspect-ratio: 820 / 312;
  height: auto;
  min-height: 72px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background-color: var(--bg-page);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  margin: 0 auto 10px;
  overflow: hidden;
}

.settings-cover-preview.has-cover {
  border-style: solid;
}

@media (max-width: 539px) {
  .settings-cover-preview {
    aspect-ratio: 16 / 9;
    min-height: 64px;
  }
}

@media (min-width: 540px) {
  .settings-cover-preview {
    background-size: contain;
  }
}

.settings-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-remove-photo-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
