/* ===== Date / Match App (缘分) ===== */
/* 设计风格对齐 wowo.css: 暖调米色、柔软阴影、圆角 */

:root {
  --date-pink: #FFB7B2;
  --date-pink-deep: #ff8fa3;
  --date-bg: #FDFBF7;
  --date-text-main: #6D5D6E;
  --date-text-light: #A493A4;
  --date-shadow: 0 4px 20px rgba(100, 80, 100, 0.08);
  --date-card-bg: #FFF;
}

/* --- Tabs --- */
.date-tab-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.date-tab-content[hidden] { display: none; }

/* --- Main screen content --- */
.date-home {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 90px 16px calc(80px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  width: 100%;
  box-sizing: border-box;
}

.date-list-home {
  align-items: stretch;
}

.date-list-header {
  width: 100%;
  margin-bottom: 14px;
  text-align: center;
}

.date-list-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--date-text-main);
  margin: 0 0 4px;
  text-align: center;
}

.date-list-hint {
  font-size: 12px;
  color: var(--date-text-light);
  margin: 0;
  text-align: center;
}

.date-matched-empty {
  text-align: center;
  color: var(--date-text-light);
  font-size: 13px;
  padding: 60px 0;
  display: none;
}
.date-matched-section.empty .date-matched-empty { display: block; }

/* --- Bottom tab bar --- */
.date-bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  gap: 4px;
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(253, 251, 247, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid rgba(0, 0, 0, 0.06);
  z-index: 20;
}

.date-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 0;
  border: none;
  background: transparent;
  color: var(--date-text-light);
  cursor: pointer;
  transition: color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.date-nav-btn:active { transform: scale(0.94); }

.date-nav-btn.active {
  color: var(--date-pink-deep);
}

.date-nav-icon {
  width: 24px;
  height: 24px;
}

.date-nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
}

/* --- Filters card --- */
.date-filters {
  width: 100%;
  background: var(--date-card-bg);
  border-radius: 18px;
  box-shadow: var(--date-shadow);
  padding: 12px 14px;
  margin-bottom: 20px;
  box-sizing: border-box;
}

.date-filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.date-filters-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--date-text-main);
}

.date-filters-toggle {
  border: none;
  background: transparent;
  color: var(--date-pink-deep);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
}

.date-filters-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.date-filters-body[hidden] { display: none; }

.date-filter-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.date-filter-label {
  font-size: 12px;
  color: var(--date-text-light);
  padding-left: 2px;
}

.date-filter-input {
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--date-text-main);
  background: #FAFAFA;
  font-family: inherit;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  transition: border-color 0.15s;
}

.date-filter-input:focus {
  border-color: var(--date-pink);
  background: #FFF;
}

.date-filter-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-filter-input.small {
  flex: 1;
}

.date-filter-dash {
  color: var(--date-text-light);
}

.date-filters-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.date-filters-clear,
.date-filters-save {
  border: none;
  border-radius: 12px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s;
}

.date-filters-clear {
  background: #F0E7EE;
  color: var(--date-text-main);
}

.date-filters-save {
  background: linear-gradient(135deg, #FFB7B2 0%, #ff8fa3 100%);
  color: #FFF;
  box-shadow: 0 2px 8px rgba(255, 143, 163, 0.3);
}

.date-filters-clear:active,
.date-filters-save:active {
  transform: scale(0.96);
}

.date-filters.has-preferences .date-filters-title::after {
  content: " ●";
  color: var(--date-pink-deep);
  font-size: 10px;
  vertical-align: super;
}

.date-gender-picker {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.date-gender-btn {
  padding: 10px 32px;
  border-radius: 22px;
  border: 1.5px solid #EEE;
  background: #FFF;
  font-size: 15px;
  font-weight: 600;
  color: #999;
  transition: all 0.25s;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.date-gender-btn.selected {
  border-color: var(--date-pink);
  background: var(--date-pink);
  color: #FFF;
  box-shadow: 0 4px 14px rgba(255, 183, 178, 0.4);
}

.date-match-btn {
  min-width: 132px;
  height: 42px;
  padding: 0 28px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #FFB7B2 0%, #ff8fa3 100%);
  color: #FFF;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 3px;
  box-shadow: 0 4px 14px rgba(255, 143, 163, 0.3);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  margin-bottom: 24px;
}

.date-match-btn:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(255, 143, 163, 0.2);
}

.date-match-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

/* --- Cards result area --- */
.date-cards-area {
  width: 100%;
  display: none;
}

.date-cards-area.visible {
  display: block;
}

.date-cards-title {
  text-align: center;
  font-size: 14px;
  color: var(--date-text-light);
  margin-bottom: 14px;
}

.date-cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 0 4px;
}

.date-card {
  background: var(--date-card-bg);
  border-radius: 20px;
  padding: 20px 14px;
  text-align: center;
  box-shadow: var(--date-shadow);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1.5px solid transparent;
  position: relative;
}

.date-card:active {
  transform: scale(0.96);
  border-color: var(--date-pink);
  box-shadow: 0 6px 24px rgba(255, 183, 178, 0.25);
}

.date-card-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFE4E1 0%, #FFB7B2 100%);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.date-card-avatar.male {
  background: linear-gradient(135deg, #d6e8ff 0%, #a8c8ff 100%);
}

.date-avatar-svg {
  color: #FFF;
}

.date-avatar-svg svg {
  width: 70%;
  height: 70%;
  display: block;
  color: rgba(255, 255, 255, 0.9);
}

.date-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--date-text-main);
  margin-bottom: 3px;
}

.date-card-info {
  font-size: 13px;
  color: var(--date-text-light);
}

.date-card-zodiac {
  margin-top: 6px;
  font-size: 18px;
}

/* --- Matched list --- */
.date-matched-section {
  width: 100%;
  margin-top: 8px;
  display: block;
}

.date-matched-title {
  font-size: 13px;
  color: var(--date-text-light);
  margin-bottom: 10px;
  padding-left: 4px;
}

.date-matched-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.date-matched-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FFF;
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: var(--date-shadow);
  cursor: pointer;
  transition: transform 0.15s;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.date-matched-item:active {
  transform: scale(0.98);
}

.date-matched-item.pinned {
  background: linear-gradient(180deg, #fff5f2 0%, #FFF 60%);
  border: 1px solid rgba(255, 143, 163, 0.25);
}

.date-matched-pin-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  background: var(--date-pink);
  color: #FFF;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(255, 143, 163, 0.35);
  letter-spacing: 1px;
}

/* --- Long-press action sheet --- */
.date-action-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 20, 26, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 100000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: dateOverlayFade 0.18s ease-out;
}

@keyframes dateOverlayFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.date-action-sheet {
  width: 100%;
  max-width: 420px;
  background: #FFF;
  border-radius: 18px 18px 0 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: dateSheetIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes dateSheetIn {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.date-action-title {
  text-align: center;
  font-size: 13px;
  color: var(--date-text-light);
  padding: 6px 0 4px;
}

.date-action-btn {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 12px;
  background: #F6EFF2;
  color: var(--date-text-main);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.date-action-btn:active {
  transform: scale(0.98);
  background: #ecdfe6;
}

.date-action-btn.danger {
  color: #e57373;
}

.date-action-btn.cancel {
  margin-top: 6px;
  background: #FFF;
  border: 1px solid #eee;
}

.date-matched-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #FFE4E1 0%, #FFB7B2 100%);
}

.date-matched-avatar.male {
  background: linear-gradient(135deg, #d6e8ff 0%, #a8c8ff 100%);
}

.date-matched-info {
  flex: 1;
  min-width: 0;
}

.date-matched-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--date-text-main);
}

.date-matched-preview {
  font-size: 13px;
  color: var(--date-text-light);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-matched-affinity {
  flex-shrink: 0;
}

.date-affinity-heart {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--date-pink);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(255, 183, 178, 0.4);
}

/* --- Date Chat Screen --- */
#date-chat-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--date-bg);
  z-index: 9999;
  display: none;
  flex-direction: column;
}

#date-chat-screen.active {
  display: flex;
}

.date-chat-header {
  display: flex;
  align-items: center;
  padding: 0 15px;
  padding-top: 30px;
  height: 70px;
  box-sizing: border-box;
  background: rgba(253, 251, 247, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.06);
  gap: 8px;
  position: relative;
  z-index: 10;
  flex-shrink: 0;
}

.date-chat-back-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: var(--date-text-main);
}

.date-chat-back-btn svg {
  width: 22px;
  height: 22px;
}

.date-chat-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--date-text-main);
  flex: 1;
  text-align: center;
}

.date-chat-affinity-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.date-chat-affinity-heart {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--date-pink);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(255, 183, 178, 0.35);
}

.date-chat-add-friend-btn {
  background: linear-gradient(135deg, #FFB7B2, #ff8fa3);
  border: none;
  border-radius: 14px;
  padding: 5px 12px;
  color: #FFF;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(255, 143, 163, 0.3);
  transition: opacity 0.2s;
  display: none;
}

.date-chat-add-friend-btn.visible {
  display: block;
}

.date-chat-add-friend-btn:active {
  opacity: 0.7;
}

.date-chat-test-btn {
  display: none;
}

/* Messages area */
.date-chat-messages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.date-msg {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.45;
  word-break: break-word;
  animation: dateMessageIn 0.25s ease-out;
}

@keyframes dateMessageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.date-msg.sent {
  align-self: flex-end;
  background: var(--date-pink);
  color: #FFF;
  border-bottom-right-radius: 6px;
}

.date-msg.received {
  align-self: flex-start;
  background: #FFF;
  color: var(--date-text-main);
  border-bottom-left-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.date-msg.action {
  align-self: center;
  background: none;
  color: var(--date-text-light);
  font-size: 12px;
  font-style: italic;
  max-width: 85%;
  text-align: center;
}

.date-chat-typing {
  align-self: flex-start;
  color: var(--date-text-light);
  font-size: 13px;
  padding: 6px 14px;
  margin: 0 16px 4px;
  display: none;
  background: #FFF;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  width: fit-content;
}

.date-chat-typing.visible {
  display: block;
  animation: dateMessageIn 0.2s ease-out;
}

.date-chat-typing .dots {
  display: inline-block;
}

.date-chat-typing .dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 1px;
  background: var(--date-pink);
  border-radius: 50%;
  animation: dateTypingBounce 1.2s infinite ease-in-out;
}

.date-chat-typing .dots span:nth-child(2) { animation-delay: 0.15s; }
.date-chat-typing .dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dateTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Input bar */
.date-chat-input-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px;
  padding-bottom: max(env(safe-area-inset-bottom, 8px), 8px);
  background: rgba(253, 251, 247, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.date-chat-input {
  flex: 1;
  border: 1.5px solid #EEE;
  border-radius: 20px;
  padding: 9px 16px;
  font-size: 15px;
  outline: none;
  resize: none;
  max-height: 100px;
  line-height: 1.4;
  background: #FFF;
  font-family: inherit;
  color: var(--date-text-main);
}

.date-chat-input:focus {
  border-color: var(--date-pink);
}

.date-chat-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--date-pink);
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
  box-shadow: 0 2px 8px rgba(255, 183, 178, 0.4);
}

.date-chat-send-btn:active {
  background: var(--date-pink-deep);
}

.date-chat-send-btn svg {
  width: 24px;
  height: 24px;
}

.date-chat-receive-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #F1E7EE;
  color: #b56b8a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
}

.date-chat-receive-btn:active {
  transform: scale(0.94);
  background: #e6d4df;
}

.date-chat-receive-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.date-chat-receive-btn svg {
  width: 20px;
  height: 20px;
}

/* --- Affinity change toast --- */
.date-affinity-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: rgba(253, 251, 247, 0.95);
  backdrop-filter: blur(10px);
  color: var(--date-text-main);
  padding: 14px 28px;
  border-radius: 16px;
  font-size: 17px;
  font-weight: 700;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 8px 30px rgba(100, 80, 100, 0.12);
}

.date-affinity-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.date-affinity-toast.positive {
  color: #7bc67e;
}

.date-affinity-toast.negative {
  color: #e57373;
}

/* --- Dark mode --- */
@media (prefers-color-scheme: dark) {
  .date-home {
    background: #1a1518;
  }

  .date-gender-btn {
    background: #2a2228;
    border-color: #3d3338;
    color: #bbb;
  }

  .date-gender-btn.selected {
    background: var(--date-pink);
    border-color: var(--date-pink);
    color: #FFF;
  }

  .date-card {
    background: #2a2228;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }

  .date-card-name { color: #eee; }
  .date-card-info { color: #999; }

  .date-matched-item {
    background: #2a2228;
  }
  .date-matched-item.pinned {
    background: linear-gradient(180deg, #3a2530 0%, #2a2228 60%);
    border-color: rgba(255, 143, 163, 0.28);
  }
  .date-matched-name { color: #eee; }
  .date-list-title { color: #eee; }
  .date-list-hint { color: #888; }
  .date-matched-empty { color: #888; }

  .date-bottom-nav {
    background: rgba(26, 21, 24, 0.94);
    border-top-color: rgba(255, 255, 255, 0.06);
  }
  .date-nav-btn { color: #888; }
  .date-nav-btn.active { color: #ff9fb2; }

  .date-filters {
    background: #2a2228;
  }
  .date-filters-title { color: #eee; }
  .date-filters-toggle { color: #ff9fb2; }
  .date-filter-label { color: #888; }
  .date-filter-input {
    background: #221a1f;
    border-color: #3d3338;
    color: #eee;
  }
  .date-filter-input:focus { background: #2a2228; }
  .date-filters-clear {
    background: #3a2c34;
    color: #eee;
  }

  .date-action-sheet {
    background: #221a1f;
  }
  .date-action-title { color: #999; }
  .date-action-btn {
    background: #2f242b;
    color: #eee;
  }
  .date-action-btn:active { background: #3b2c34; }
  .date-action-btn.cancel {
    background: #221a1f;
    border-color: #3d3338;
  }

  #date-chat-screen {
    background: #1a1518;
  }

  .date-chat-header {
    background: rgba(26, 21, 24, 0.92);
    border-bottom-color: rgba(255, 255, 255, 0.06);
  }

  .date-chat-name { color: #eee; }

  .date-msg.received {
    background: #2a2228;
    color: #eee;
    box-shadow: none;
  }

  .date-chat-input-bar {
    background: rgba(26, 21, 24, 0.95);
    border-top-color: rgba(255, 255, 255, 0.06);
  }

  .date-chat-input {
    background: #2a2228;
    border-color: #3d3338;
    color: #eee;
  }

  .date-chat-receive-btn {
    background: #3a2c34;
    color: #e6b7cc;
  }
  .date-chat-receive-btn:active {
    background: #4a3844;
  }

  .date-affinity-toast {
    background: rgba(42, 34, 40, 0.95);
  }
}
