/* ============================================================
   Ava — Dark Theme · Shared Styles
   Original design · Not derived from any platform
   ============================================================ */

/* --- CSS Variables --- */
:root {
  --bg-deep: #12121a;
  --bg-surface: #1e1e2e;
  --bg-card: #252538;
  --bg-hover: #2a2a40;
  --accent: #c44d6c;
  --accent-soft: #e4728f;
  --accent-glow: rgba(196,77,108,0.25);
  --text-primary: #f0ece6;
  --text-secondary: #9998a8;
  --text-muted: #6b6a7a;
  --border-subtle: #2e2e40;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-height: 60px;
  --max-w: 480px;
}

/* --- Reset --- */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

html,body{
  height:100%;
  -webkit-overflow-scrolling:touch;
}

body{
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  background: var(--bg-deep);
  color: var(--text-primary);
  max-width: var(--max-w);
  margin: 0 auto;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  overscroll-behavior: none;
}

/* --- Page transition: cross-fade on MPA navigation --- */
@view-transition {
  navigation: auto;
}

/* Fallback for browsers without view-transition */
body.page-enter {
  animation: pageFadeIn 0.25s ease-out both;
}

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

/* --- Scrollable body for non-chat pages --- */
body.has-nav {
  padding-bottom: var(--nav-height);
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
  min-height: 100dvh;
}

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-w);
  height: var(--nav-height);
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(18,18,26,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 500;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
  min-width: 56px;
}

.bottom-nav a.active {
  color: var(--accent-soft);
}

.bottom-nav a:active {
  background: var(--bg-hover);
}

.bottom-nav a svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}

.bottom-nav a.active svg {
  stroke: var(--accent-soft);
}

.bottom-nav a svg.filled {
  fill: currentColor;
  stroke: none;
}

/* --- Shared Buttons --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 32px;
  border: none;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:active {
  opacity: 0.85;
  transform: scale(0.97);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border: 1.5px solid var(--accent);
  border-radius: 28px;
  background: transparent;
  color: var(--accent-soft);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-outline:active {
  background: var(--accent);
  color: #fff;
}

/* --- Shared Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
}

/* --- Toast --- */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30,30,46,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  font-size: 13px;
  padding: 10px 22px;
  border-radius: 24px;
  z-index: 1000;
  border: 1px solid var(--border-subtle);
  animation: toastIn 0.25s ease-out;
  pointer-events: none;
  white-space: nowrap;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.toast.fade-out {
  opacity: 0;
  transition: opacity 0.3s;
}

/* --- Age Gate Overlay --- */
.age-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.age-gate-overlay.hidden { display: none; }

.age-gate-box {
  text-align: center;
  max-width: 340px;
  width: 100%;
}

.age-gate-ava {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: #fff;
  font-size: 36px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 32px var(--accent-glow);
}

.age-gate-box h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 6px;
}

.age-gate-box .sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
}

.age-gate-box .disclaimer {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 24px;
  padding: 0 8px;
}

.age-gate-box .btn-primary {
  width: 100%;
}

/* --- Modal Overlay --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease-out;
}

.modal-overlay.hidden { display: none; }

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

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  animation: modalUp 0.25s ease-out;
}

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

.modal-box h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.modal-box p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.modal-box .btn-primary {
  width: 100%;
  margin-bottom: 8px;
}

.modal-box .btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 16px;
  -webkit-tap-highlight-color: transparent;
}

/* --- Geometry Icons (no emoji) --- */
.icon-geo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-geo svg {
  stroke: var(--accent-soft);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Perk icon block (landing page) */
.icon-perk {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(196,77,108,0.12);
}

/* Placeholder image block (feed/gallery) */
.placeholder-img {
  width: 100%;
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-card));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.placeholder-img::before {
  content: '';
  display: block;
  width: 40px;
  height: 40px;
  border: 2px solid var(--border-subtle);
  border-radius: 8px;
  opacity: 0.6;
}

/* Placeholder square (gallery grid) */
.placeholder-sq {
  aspect-ratio: 1;
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-card));
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.placeholder-sq::before {
  content: '';
  display: block;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-subtle);
  border-radius: 5px;
  opacity: 0.5;
}

/* --- Desktop --- */
@media (min-width: 481px) {
  body {
    border-left: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
  }
  .bottom-nav {
    border-left: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
  }
}
