@import url('../shared/ios-tokens.css');
@import url('../shared/ios-ui.css');
@import url('../shared/calendar.css');
/* ─── Prototype shell (PC: phone preview + page picker, NOT macOS window) ─── */

.prototype-shell {
  display: flex;
  min-height: 100vh;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  padding: 20px;
  background: #d1d1d6;
}

.sitemap {
  display: none;
  width: 260px;
  background: var(--ios-bg-grouped);
  border-radius: var(--ios-radius-lg);
  padding: 12px;
  color: var(--ios-label);
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: var(--ios-shadow);
}

.sitemap h2 {
  font-size: 17px;
  font-weight: 600;
  margin: 4px 8px 12px;
  color: var(--ios-label);
}

.sitemap-section {
  font-size: 13px;
  color: var(--ios-label-secondary);
  margin: 12px 8px 4px;
  text-transform: none;
}

.sitemap-link {
  display: block;
  padding: 10px 12px;
  border-radius: var(--ios-radius-sm);
  color: var(--ios-label);
  font-size: 15px;
  margin-bottom: 1px;
}

.sitemap-link:hover {
  background: var(--ios-fill);
  text-decoration: none;
}

.sitemap-link.active {
  background: rgba(0, 122, 255, 0.12);
  color: var(--ios-blue);
  font-weight: 600;
}

.sitemap-note {
  font-size: 12px;
  color: var(--ios-label-tertiary);
  padding: 12px 8px 4px;
  line-height: 1.4;
}

/* ─── iPhone device frame ─── */

.device-frame {
  width: 100%;
  max-width: var(--phone-width);
  height: min(var(--phone-height), calc(100vh - 40px));
  background: var(--ios-bg-grouped);
  border-radius: 44px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  border: 10px solid #1c1c1e;
  position: relative;
  display: flex;
  flex-direction: column;
}

.device-notch {
  display: none;
}

.screen-viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background: var(--ios-bg-grouped);
  overflow: hidden;
  position: absolute;
  inset: 0;
}

.screen.active {
  display: flex;
  z-index: 1;
}

.screen.screen-push-exit {
  display: flex;
  z-index: 0;
}

.screen.screen-push-enter,
.screen.screen-pop-enter {
  display: flex;
  z-index: 2;
}

.screen-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ─── Navigation bar (iOS UINavigationBar) ─── */

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 8px 0 4px;
  background: var(--ios-blur);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--ios-separator);
  flex-shrink: 0;
}

.nav-bar-large {
  flex-direction: column;
  align-items: stretch;
  padding: 0 16px 8px;
  min-height: auto;
  border-bottom: none;
}

.nav-bar-large .nav-title {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 2px 0 8px;
  line-height: 1.1;
}

.nav-back {
  background: none;
  border: none;
  cursor: pointer;
}

.nav-title-center {
  font-size: 17px;
  font-weight: 600;
  flex: 1;
  text-align: center;
  pointer-events: none;
}

.nav-action {
  background: none;
  border: none;
  color: var(--ios-blue);
  font-size: 17px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 400;
}

.nav-spacer {
  width: 44px;
}

/* ─── Tab bar (iOS UITabBar) ─── */

.tab-bar {
  display: flex;
  flex-wrap: wrap;
  background: var(--ios-blur);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid var(--ios-separator);
  flex-shrink: 0;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 49px;
  padding: 4px 0 2px;
  background: none;
  border: none;
  color: var(--ios-gray-1);
  cursor: pointer;
}

.tab-item.active {
  color: var(--ios-blue);
}

.tab-bar::after {
  content: '';
  display: block;
  width: 134px;
  height: 5px;
  border-radius: 3px;
  background: var(--ios-label);
  opacity: 0.18;
  margin: 2px auto calc(6px + var(--ios-safe-bottom));
  flex-shrink: 0;
  flex-basis: 100%;
}

/* ─── Buttons (iOS, not macOS aqua) ─── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 12px;
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: -0.01em;
}

.btn:active {
  opacity: 0.65;
  transform: scale(0.985);
}

.btn-primary {
  background: var(--ios-blue);
  color: #fff;
}

.btn-secondary {
  background: var(--ios-fill);
  color: var(--ios-blue);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 15px;
  border-radius: 10px;
  font-weight: 500;
}

.bottom-bar {
  padding: 12px 16px;
  background: var(--ios-blur);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid var(--ios-separator);
  flex-shrink: 0;
}

/* ─── Grouped lists ─── */

.group {
  margin: 0 16px 16px;
  background: var(--ios-bg);
  border-radius: var(--ios-radius-lg);
  overflow: hidden;
}

.group-inset {
  margin: 0 16px 16px;
}

.group-header {
  font-size: 13px;
  color: var(--ios-label-secondary);
  padding: 0 32px 8px;
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.cell {
  display: flex;
  align-items: center;
  padding: 11px 16px;
  min-height: 44px;
  background: var(--ios-bg);
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-size: 17px;
  gap: 12px;
  color: var(--ios-label);
}

.cell:active {
  background: var(--ios-gray-6);
}

.cell-body {
  flex: 1;
  min-width: 0;
}

.cell-sub {
  font-size: 15px;
  color: var(--ios-label-secondary);
  margin-top: 2px;
}

.cell-chevron::after {
  content: '';
  width: 8px;
  height: 14px;
  flex-shrink: 0;
  background: var(--ios-gray-3);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M1.5 1.5L6.5 7l-5 5.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 14'%3E%3Cpath d='M1.5 1.5L6.5 7l-5 5.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
  margin-left: auto;
}

.banner {
  margin: 0 16px 12px;
  height: 120px;
  border-radius: var(--ios-radius-lg);
  background: linear-gradient(135deg, #007aff, #5856d6);
  display: flex;
  align-items: flex-end;
  padding: 16px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 17px;
  border: none;
  width: calc(100% - 32px);
}

.session-card {
  margin: 0 16px 10px;
  padding: 14px 16px;
  background: var(--ios-bg);
  border-radius: var(--ios-radius-lg);
  cursor: pointer;
  border: none;
  width: calc(100% - 32px);
  text-align: left;
  font-size: 17px;
  color: var(--ios-label);
}

.session-card:active {
  background: var(--ios-gray-6);
}

.sport-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ios-blue);
  background: rgba(0, 122, 255, 0.12);
  padding: 2px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
}

.meta {
  font-size: 15px;
  color: var(--ios-label-secondary);
  margin-top: 4px;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 16px 12px;
}

.sport-chip,
.slot-chip,
.venue-card {
  cursor: pointer;
}

.sport-chip,
.slot-chip {
  padding: 10px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--ios-gray-4);
  background: var(--ios-bg);
  font-size: 15px;
}

.sport-chip.selected,
.slot-chip.selected {
  border-color: var(--ios-blue);
  background: rgba(0, 122, 255, 0.1);
  color: var(--ios-blue);
  font-weight: 600;
}

.venue-card {
  margin: 0 16px 10px;
  padding: 14px;
  background: var(--ios-bg);
  border-radius: var(--ios-radius-lg);
  border: 2px solid transparent;
  width: calc(100% - 32px);
  text-align: left;
}

.venue-card.selected {
  border-color: var(--ios-blue);
}

.map-card {
  margin: 16px;
  padding: 16px;
  background: var(--ios-bg);
  border-radius: var(--ios-radius-lg);
}

.map-placeholder {
  height: 120px;
  background: var(--ios-gray-5);
  border-radius: var(--ios-radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ios-label-secondary);
  margin-bottom: 12px;
  font-size: 15px;
}

.avatar-row {
  display: flex;
  gap: 4px;
  padding: 0 16px 12px;
  flex-wrap: wrap;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ios-gray-4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--ios-label-secondary);
  font-weight: 500;
}

.badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--ios-orange);
  color: #fff;
  font-weight: 600;
}

.badge-blue {
  background: var(--ios-blue);
}

.chat-messages {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 200px;
}

.chat-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 16px;
  background: var(--ios-gray-5);
  align-self: flex-start;
}

.chat-bubble.me {
  align-self: flex-end;
  background: var(--ios-blue);
  color: #fff;
}

.chat-bubble.system {
  align-self: center;
  background: transparent;
  color: var(--ios-label-secondary);
  font-size: 13px;
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  background: var(--ios-bg);
  border-top: 0.5px solid var(--ios-separator);
}

.chat-input-bar input {
  flex: 1;
  border: none;
  background: var(--ios-gray-6);
  border-radius: 20px;
  padding: 10px 16px;
  outline: none;
  font-size: 17px;
}

.feed-item {
  background: var(--ios-bg);
  margin-bottom: 8px;
  padding-bottom: 12px;
}

.feed-media {
  height: 200px;
  background: var(--ios-gray-5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ios-label-secondary);
  font-size: 15px;
}

.feed-actions {
  display: flex;
  gap: 20px;
  padding: 10px 16px 0;
  font-size: 15px;
  color: var(--ios-label-secondary);
}

.feed-actions button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 15px;
}

.feed-actions .liked {
  color: var(--ios-red);
}

.fab {
  position: absolute;
  right: 20px;
  bottom: 72px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ios-blue);
  color: #fff;
  border: none;
  font-size: 28px;
  box-shadow: var(--ios-shadow);
  cursor: pointer;
  z-index: 10;
}

.form-group {
  padding: 0 16px 16px;
}

.form-label {
  font-size: 13px;
  color: var(--ios-label-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-radius: var(--ios-radius-md);
  background: var(--ios-bg);
  font-size: 17px;
  outline: none;
}

.segmented {
  display: flex;
  background: var(--ios-fill);
  border-radius: 8px;
  padding: 2px;
  margin: 0 16px 16px;
}

.segmented button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ios-label);
}

.segmented button.active {
  background: var(--ios-bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
  font-weight: 600;
}

.toolbar-row {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  align-items: center;
}

.toolbar-row select {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: none;
  background: var(--ios-bg);
  font-size: 17px;
  appearance: none;
  -webkit-appearance: none;
}

/* ─── Overlays ─── */

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
}

.overlay.show {
  display: block;
}

.action-sheet {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  bottom: 0;
  width: 100%;
  max-width: var(--phone-width);
  background: transparent;
  z-index: 101;
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
  padding: 0 8px calc(8px + var(--ios-safe-bottom));
}

.action-sheet.show {
  transform: translateX(-50%) translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 5px;
  background: var(--ios-gray-3);
  border-radius: 3px;
  margin: 8px auto 12px;
}

.sheet-inner {
  padding: 0 8px 8px;
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  padding: 14px 22px;
  border-radius: 12px;
  font-size: 15px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  text-align: center;
  max-width: 85%;
}

.toast.show {
  opacity: 1;
}

/* ─── Responsive: real phone = full screen iOS app ─── */

@media (min-width: 900px) {
  .sitemap {
    display: block;
  }

  .ios-dynamic-island {
    display: block;
  }
}

@media (max-width: 899px) {
  .prototype-shell {
    padding: 0;
    background: var(--ios-bg-grouped);
  }

  .device-frame {
    max-width: none;
    height: 100dvh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }

  .ios-dynamic-island {
    display: none;
  }
}
