/* ================================================================
   PERITALE APP - App-specific styles
   Supplements peritale.css. Used by app shell and tool pages in app mode.
   ================================================================ */

/* ---------- BOTTOM TAB BAR ---------- */
.pt-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--g100, #EDE9E5);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 9000;
  max-width: 600px;
  margin: 0 auto;
}

.pt-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 0;
  flex: 1;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s;
}

.pt-tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--g400, #8A8078);
  transition: color 0.15s;
}

.pt-tab-label {
  font-family: var(--sans, 'DM Sans', sans-serif);
  font-size: 10px;
  font-weight: 600;
  color: var(--g400, #8A8078);
  transition: color 0.15s;
}

.pt-tab.active .pt-tab-icon,
.pt-tab.active .pt-tab-label {
  color: var(--pk, #FF0080);
}

.pt-tab:active .pt-tab-icon,
.pt-tab:active .pt-tab-label {
  color: var(--pk, #FF0080);
  opacity: 0.7;
}

/* ---------- SPLASH SCREEN ---------- */
.splash {
  position: fixed;
  inset: 0;
  background: var(--cream, #F9F6F3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease;
}

.splash.fade-out {
  opacity: 0;
  pointer-events: none;
}

.splash-logo {
  font-family: var(--serif, 'Playfair Display', serif);
  font-size: 42px;
  font-weight: 700;
  color: var(--pk, #FF0080);
  opacity: 0;
  transform: translateY(12px);
  animation: splashIn 0.8s 0.3s ease forwards;
}

.splash-tagline {
  font-family: var(--sans, 'DM Sans', sans-serif);
  font-size: 14px;
  color: var(--g400, #8A8078);
  margin-top: 8px;
  opacity: 0;
  animation: splashIn 0.6s 0.7s ease forwards;
}

.splash-pulse {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 0, 128, 0.08) 0%, transparent 70%);
  position: absolute;
  animation: splashPulse 2s ease-in-out infinite;
}

@keyframes splashIn {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes splashPulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(2.5); opacity: 0; }
}

/* ---------- ONBOARDING ---------- */
.onboard {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.onboard-progress {
  display: flex;
  gap: 6px;
  padding: 20px 24px 0;
}

.onboard-dot {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--g100, #EDE9E5);
  transition: background 0.3s;
}

.onboard-dot.done {
  background: var(--pk, #FF0080);
}

.onboard-dot.active {
  background: var(--pk, #FF0080);
}

.onboard-screen {
  display: none;
  flex: 1;
  padding: 32px 24px 24px;
  flex-direction: column;
}

.onboard-screen.active {
  display: flex;
}

.onboard-title {
  font-family: var(--serif, 'Playfair Display', serif);
  font-size: 28px;
  font-weight: 700;
  color: var(--text, #1A1510);
  line-height: 1.15;
  margin-bottom: 8px;
}

.onboard-sub {
  font-size: 15px;
  color: var(--text2, #6B6058);
  line-height: 1.6;
  margin-bottom: 28px;
}

/* Goal/option chips */
.onboard-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.onboard-chip {
  padding: 12px 20px;
  border-radius: 9999px;
  border: 1.5px solid var(--g200, #D8D2CC);
  background: var(--white, #fff);
  font-size: 14px;
  font-weight: 500;
  color: var(--text, #1A1510);
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.onboard-chip:active {
  transform: scale(0.97);
}

.onboard-chip.selected {
  background: var(--pk, #FF0080);
  border-color: var(--pk, #FF0080);
  color: white;
}

/* Age range selector */
.onboard-select {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--g200, #D8D2CC);
  border-radius: 14px;
  font-size: 16px;
  font-family: var(--sans, 'DM Sans', sans-serif);
  color: var(--text, #1A1510);
  background: var(--white, #fff);
  margin-bottom: 16px;
  -webkit-appearance: none;
  appearance: none;
}

.onboard-select:focus {
  outline: none;
  border-color: var(--pk, #FF0080);
  box-shadow: 0 0 0 3px rgba(255, 0, 128, 0.1);
}

.onboard-input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--g200, #D8D2CC);
  border-radius: 14px;
  font-size: 16px;
  font-family: var(--sans, 'DM Sans', sans-serif);
  color: var(--text, #1A1510);
  background: var(--white, #fff);
  margin-bottom: 16px;
}

.onboard-input:focus {
  outline: none;
  border-color: var(--pk, #FF0080);
  box-shadow: 0 0 0 3px rgba(255, 0, 128, 0.1);
}

.onboard-input::placeholder {
  color: var(--g300, #B8B0A8);
}

/* Onboarding field label */
.onboard-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text, #1A1510);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

/* Onboarding actions */
.onboard-actions {
  margin-top: auto;
  padding-top: 20px;
  display: flex;
  gap: 12px;
}

.onboard-actions .btn-primary {
  flex: 1;
}

.onboard-skip {
  font-size: 14px;
  font-weight: 600;
  color: var(--text3, #8A8078);
  padding: 16px;
  text-align: center;
  transition: color 0.15s;
}

.onboard-skip:active {
  color: var(--pk, #FF0080);
}

/* ---------- DASHBOARD ---------- */
.dash {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

.dash-header {
  padding: 24px 20px 0;
}

.dash-greeting {
  font-family: var(--serif, 'Playfair Display', serif);
  font-size: 26px;
  font-weight: 700;
  color: var(--text, #1A1510);
  line-height: 1.2;
}

/* Cycle phase banner */
.dash-phase {
  margin: 16px 20px 0;
  padding: 14px 18px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.dash-phase-ring {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif, 'Playfair Display', serif);
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.dash-phase-info {
  flex: 1;
}

.dash-phase-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
}

.dash-phase-tip {
  font-size: 12px;
  opacity: 0.8;
  line-height: 1.4;
}

/* Quick actions */
.dash-quick {
  display: flex;
  gap: 10px;
  padding: 20px 20px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.dash-quick::-webkit-scrollbar { display: none; }

.dash-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 16px;
  background: var(--white, #fff);
  border: 1px solid var(--g100, #EDE9E5);
  border-radius: 16px;
  min-width: 80px;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}

.dash-quick-btn:active {
  transform: scale(0.95);
  border-color: var(--pk, #FF0080);
}

.dash-quick-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-quick-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text, #1A1510);
  text-align: center;
  white-space: nowrap;
}

/* Summary cards */
.dash-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--g400, #8A8078);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 24px 20px 10px;
}

.dash-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0 20px;
}

.dash-card {
  background: var(--white, #fff);
  border: 1px solid var(--g100, #EDE9E5);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.dash-card:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(15, 10, 5, 0.06);
}

.dash-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.dash-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #1A1510);
  margin-bottom: 2px;
}

.dash-card-val {
  font-size: 13px;
  color: var(--text2, #6B6058);
}

.dash-card-progress {
  width: 100%;
  height: 4px;
  background: var(--g100, #EDE9E5);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.dash-card-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.dash-card-arrow {
  color: var(--g300, #B8B0A8);
  flex-shrink: 0;
}

/* Streak */
.dash-streak {
  margin: 20px 20px 0;
  padding: 18px;
  background: linear-gradient(135deg, rgba(255, 0, 128, 0.04), rgba(255, 0, 128, 0.01));
  border: 1px solid rgba(255, 0, 128, 0.08);
  border-radius: 16px;
  text-align: center;
}

.dash-streak-num {
  font-family: var(--serif, 'Playfair Display', serif);
  font-size: 36px;
  font-weight: 700;
  color: var(--pk, #FF0080);
  line-height: 1;
}

.dash-streak-label {
  font-size: 13px;
  color: var(--text2, #6B6058);
  margin-top: 4px;
}

/* Tool grid */
.dash-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 20px;
}

.dash-tool {
  background: var(--white, #fff);
  border: 1px solid var(--g100, #EDE9E5);
  border-radius: 16px;
  padding: 18px 12px;
  text-align: center;
  text-decoration: none;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.dash-tool:active {
  transform: scale(0.96);
  border-color: var(--pk, #FF0080);
}

.dash-tool-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-tool-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text, #1A1510);
  line-height: 1.3;
}

/* ---------- TOOL INTRO SCREENS ---------- */
.tool-intro {
  position: fixed;
  inset: 0;
  z-index: 8000;
  background: var(--cream, #F9F6F3);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.tool-intro-content {
  max-width: 480px;
  margin: 0 auto;
  padding: 40px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tool-intro-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--pk, #FF0080);
  margin-bottom: 16px;
}

.tool-intro-title {
  font-family: var(--serif, 'Playfair Display', serif);
  font-size: clamp(26px, 6vw, 34px);
  font-weight: 700;
  color: var(--text, #1A1510);
  line-height: 1.15;
  margin-bottom: 16px;
}

.tool-intro-body {
  font-size: 15px;
  color: var(--text2, #6B6058);
  line-height: 1.8;
  margin-bottom: 24px;
}

.tool-intro-body p {
  margin-bottom: 14px;
}

.tool-intro-science {
  background: var(--white, #fff);
  border: 1px solid var(--g100, #EDE9E5);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}

.tool-intro-science h3 {
  font-family: var(--serif, 'Playfair Display', serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--text, #1A1510);
  margin-bottom: 10px;
}

.tool-intro-science p {
  font-size: 14px;
  color: var(--text2, #6B6058);
  line-height: 1.7;
  margin-bottom: 8px;
}

.tool-intro-science cite {
  font-size: 11px;
  color: var(--g400, #8A8078);
  font-style: italic;
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--g100, #EDE9E5);
  line-height: 1.5;
}

.tool-intro-who {
  padding: 16px 20px;
  background: rgba(122, 155, 126, 0.08);
  border-left: 3px solid var(--sage, #7A9B7E);
  border-radius: 0 12px 12px 0;
  margin-bottom: 24px;
}

.tool-intro-who h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text, #1A1510);
  margin-bottom: 4px;
}

.tool-intro-who p {
  font-size: 13px;
  color: var(--text2, #6B6058);
  line-height: 1.6;
}

.tool-intro-actions {
  margin-top: auto;
  padding-top: 16px;
}

.tool-intro-actions .btn-primary {
  width: 100%;
  padding: 16px;
  font-size: 16px;
}

/* Phase tip banner (shown at top of tools when cycle data exists) */
.phase-tip-banner {
  margin: 0 20px 12px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.phase-tip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}

.phase-tip-text {
  flex: 1;
  color: var(--text, #1A1510);
}

/* ---------- RESPONSIVE ---------- */
@media (min-width: 600px) {
  .dash {
    box-shadow: -1px 0 0 var(--g100, #EDE9E5), 1px 0 0 var(--g100, #EDE9E5);
  }
}

@media (max-width: 380px) {
  .dash-greeting { font-size: 22px; }
  .dash-tools { grid-template-columns: repeat(2, 1fr); }
  .onboard-title { font-size: 24px; }
}
