/* Olokleros — CostIQ paleti */
:root {
  --gold: #e9a83a;
  --bg: #ffffff;
  --bg2: #bccbb9;
  --bg3: #e7e7e7;
  --nav: #717c7d;
  --text: #2c3232;
  --text-soft: #5c6565;
  --radius: 16px;
  --maxw: 720px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
    Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.loading {
  margin: auto;
  color: var(--text-soft);
}

/* --- Genel yerleşim --- */
.screen {
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  flex: 1;
  display: flex;
  flex-direction: column;
}

.brand {
  text-align: center;
  margin: 8px 0 24px;
}
.brand h1 {
  font-size: 1.8rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.5px;
}
.brand .tagline {
  color: var(--text-soft);
  font-size: 0.95rem;
  margin-top: 6px;
}
.brand .logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin-bottom: 8px;
}
/* Landing/giriş sayfasında logo büyütülür.
   Kök neden: olokleros_logo.png karesinin içinde asıl logo mark'ı yalnızca
   ~%60 genişlik / ~%55 yükseklik kaplıyor; geri kalanı beyaz boşluk. Bu yüzden
   CSS kutusunu (72px→216px) büyütmek görünen mark'ı belirgin büyütmedi:
   object-fit: contain tüm boşluklu kareyi ölçekliyordu.
   Çözüm (yalnızca login sayfası): logoyu overflow:hidden bir kutuya alıp
   görseli büyütüp içindeki boşluğu kırparak asıl mark'ı kutuya sığdırmak. */
.brand .logo-crop {
  display: inline-block;
  width: 260px;
  height: 210px;
  overflow: hidden;
  margin-bottom: 12px;
  line-height: 0;
}
.brand .logo.logo-lg {
  width: 100%;
  height: auto;
  margin: 0;
  transform: scale(1.5);
  transform-origin: center 48%;
}

/* --- Mod seçim ekranı (seans başı: Canlı konuşma / Yazarak) --- */
.mode-select {
  display: flex;
  gap: 14px;
}
.mode-card {
  flex: 1 1 0;
  background: var(--bg);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  padding: 28px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.05s ease;
}
.mode-card:hover {
  border-color: var(--gold);
}
.mode-card:active {
  transform: scale(0.99);
}
.mode-emoji {
  font-size: 2.2rem;
  line-height: 1;
}
.mode-title {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
}
.mode-desc {
  font-size: 0.82rem;
  color: var(--text-soft);
}

/* --- Form / kartlar --- */
.card {
  background: var(--bg);
  border: 1px solid var(--bg3);
  border-radius: var(--radius);
  padding: 24px;
}

label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-soft);
  margin: 14px 0 6px;
}

input[type='email'],
input[type='password'],
input[type='text'] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--bg3);
  border-radius: 12px;
  font-size: 1rem;
  background: var(--bg);
}
input:focus {
  outline: none;
  border-color: var(--gold);
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  transition: opacity 0.15s ease, transform 0.05s ease;
}
button:active {
  transform: scale(0.99);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-primary {
  background: var(--gold);
  color: #fff;
  font-weight: 600;
  width: 100%;
}
.btn-ghost {
  background: transparent;
  color: var(--nav);
}
.btn-soft {
  background: var(--bg2);
  color: var(--text);
}

.link {
  color: var(--nav);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  font-size: 0.9rem;
}

.error {
  color: #b23b3b;
  font-size: 0.9rem;
  margin-top: 12px;
  min-height: 1.2em;
}

/* Aynı satırda gösterilen OLUMLU bildirim (ör. "şifren güncellendi" mesajı
   giriş ekranına dönerken). Kırmızı hata rengini bastırır — başarı, hata gibi
   görünmemelidir. */
.error.success {
  color: var(--text);
  font-weight: 600;
}

.disclaimer {
  background: var(--bg3);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.82rem;
  color: var(--text-soft);
  margin: 16px 0;
}

/* Bekleme listesi teşekkür mesajı (form gönderildikten sonra). */
.waitlist-done {
  background: var(--bg2);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 8px;
  color: var(--text);
  font-weight: 600;
  text-align: center;
}

/* Çerez/analitik onay bildirimi — sayfanın altında, tek seferlik. */
.consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: var(--text);
  color: #fff;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 18px;
  font-size: 0.88rem;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
}
.consent-banner .consent-text {
  max-width: 640px;
}
.consent-banner .consent-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.consent-banner .consent-btn {
  margin: 0;
  width: auto;
  padding: 8px 18px;
  white-space: nowrap;
}
.consent-banner .link {
  color: #fff;
  opacity: 0.85;
}

/* Dil seçici (TR · EN) */
.lang-switch {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--text-soft);
  font-size: 0.85rem;
}
.lang-switch button {
  background: none;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  font: inherit;
  padding: 2px 6px;
  border-radius: 6px;
}
.lang-switch button.active {
  color: var(--text);
  font-weight: 700;
  text-decoration: underline;
}
.lang-switch button:hover {
  color: var(--text);
}

/* --- Landing footer + bilgilendirme sayfaları --- */
.landing-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  color: var(--text-soft);
  font-size: 0.85rem;
}
.info-card p {
  margin: 0 0 14px;
}
.info-card p:last-child {
  margin-bottom: 0;
}
/* Maté alıntısı — hafif vurgulu blockquote */
.info-quote {
  margin: 18px 0 0;
  padding: 4px 0 4px 14px;
  border-left: 3px solid var(--gold);
}
.info-quote-text {
  margin: 0 0 6px;
  font-style: italic;
  color: var(--text);
}
.info-quote-by {
  color: var(--text-soft);
  font-size: 0.85rem;
  font-style: normal;
}

/* --- Onboarding tarama --- */
.question {
  padding: 14px 0;
  border-bottom: 1px solid var(--bg3);
}
.question p {
  margin: 0 0 10px;
}
.yesno {
  display: flex;
  gap: 10px;
}
.yesno button {
  flex: 1;
  background: var(--bg3);
  color: var(--text);
}
.yesno button.selected {
  background: var(--nav);
  color: #fff;
}

/* --- Sohbet / seans --- */
.session-screen {
  padding: 0;
  max-width: var(--maxw);
}
.session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--bg3);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 5;
}
.session-header .title {
  font-weight: 600;
}
/* Seans başı bilgi şeridi — süre sınırı yok + istediğin an durabilirsin */
.session-info {
  margin: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--bg3);
  font-size: 0.8rem;
  text-align: center;
}

/* Seans ayar toggle'ları — her zaman görünür, doğrudan seans ekranında */
.session-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--bg3);
  background: var(--bg);
}
.btn-toggle {
  background: transparent;
  color: var(--nav);
  border: 1px solid var(--bg3);
  padding: 7px 12px;
  font-size: 0.8rem;
  border-radius: 999px;
}
.btn-toggle.on {
  border-color: var(--gold);
  color: var(--gold);
}
/* Sonlandırma butonu her zaman görünür (Güvenlik Katmanı #2) */
.btn-end {
  background: transparent;
  color: var(--nav);
  border: 1px solid var(--bg3);
  padding: 8px 14px;
  font-size: 0.85rem;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg.user {
  align-self: flex-end;
  background: var(--bg2);
  color: var(--text);
  border-bottom-right-radius: 4px;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--bg3);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.msg.crisis {
  align-self: stretch;
  max-width: 100%;
  background: #fbeee0;
  border: 1px solid var(--gold);
}
/* Sistem notu (ör. canlı moddan yazılıya geçiş bildirimi) */
.msg.system-note {
  align-self: center;
  max-width: 100%;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.82rem;
  text-align: center;
  padding: 6px 12px;
}

/* Nefes / bekleme animasyonu ([PAUSE:n]) */
.pause {
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 0;
  color: var(--text-soft);
  font-size: 0.85rem;
}
.breath {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg2);
  animation: breathe 8s ease-in-out infinite;
}
@keyframes breathe {
  0%,
  100% {
    transform: scale(0.7);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
}

/* Giriş alanı */
.composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--bg3);
  background: var(--bg);
}
.composer textarea {
  flex: 1;
  resize: none;
  border: 1px solid var(--bg3);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  max-height: 140px;
}
.composer textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.icon-btn {
  background: var(--bg3);
  color: var(--nav);
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
/* Dinleniyor göstergesi: renk + nabız animasyonu */
.icon-btn.active {
  background: var(--gold);
  color: #fff;
  animation: mic-pulse 1.4s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(233, 168, 58, 0.55);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(233, 168, 58, 0);
  }
}

/* "Dinleniyor…" durum şeridi */
.mic-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.8rem;
  color: var(--gold);
  background: var(--bg2);
  border-top: 1px solid var(--bg3);
}
.mic-status[hidden] {
  display: none;
}
.mic-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  animation: mic-pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
.icon-btn.send {
  background: var(--gold);
  color: #fff;
}

.typing {
  align-self: flex-start;
  color: var(--text-soft);
  font-size: 0.85rem;
  padding: 4px 8px;
}

.session-screen {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Canlı sesli konuşma (Realtime) — tam ekran katman */
.rt-btn.rt-btn {
  border-color: var(--gold);
  color: var(--gold);
}
.rt-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
}
.rt-orb {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--bg2);
  animation: breathe 6s ease-in-out infinite;
}
.rt-orb[data-status='connecting'] {
  opacity: 0.5;
}
.rt-orb[data-status='reconnecting'] {
  opacity: 0.6;
  background: var(--nav);
  animation: mic-pulse 1s ease-in-out infinite;
}
.rt-orb[data-status='listening'] {
  background: var(--gold);
  animation: mic-pulse 1.6s ease-in-out infinite, breathe 6s ease-in-out infinite;
}
.rt-orb[data-status='speaking'] {
  background: var(--nav);
  animation: breathe 2.4s ease-in-out infinite;
}
.rt-status {
  font-size: 1rem;
  color: var(--text-soft);
}
.rt-caption {
  max-width: 32ch;
  min-height: 2.4em;
  color: var(--text);
  font-size: 1.05rem;
  line-height: 1.5;
}
.rt-endbtn {
  margin-top: 8px;
}
.rt-note {
  position: absolute;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 24px;
  right: 24px;
  font-size: 0.75rem;
  color: var(--text-soft);
}
/* Sessiz reconnect notu — sakin, geçici; kesinti/hata hissi vermemeli. */
.rt-notice {
  min-height: 1.1em;
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-soft);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.rt-notice.show {
  opacity: 0.9;
}

/* Karartma modu — ekran açık kalır (Wake Lock) ama görsel olarak karartılır */
.dim-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  text-align: center;
  padding: 24px;
  cursor: pointer;
}
.dim-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #3a3a38;
  animation: dim-breathe 5s ease-in-out infinite;
}
@keyframes dim-breathe {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50% { opacity: 0.7; transform: scale(1.15); }
}
.dim-hint {
  color: #4a4a48;
  font-size: 0.8rem;
  line-height: 1.6;
  max-width: 30ch;
}

/* Seans sonrası geri bildirim anketi (modal) */
.survey-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(44, 50, 50, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.survey-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 22px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}
.survey-sub {
  color: var(--text-soft);
  font-size: 0.85rem;
  margin: 4px 0 16px;
}
.survey-row {
  padding: 10px 0;
  border-top: 1px solid var(--bg3);
}
.survey-label {
  font-size: 0.92rem;
  margin-bottom: 8px;
}
.stars {
  display: flex;
  gap: 6px;
}
.star {
  background: transparent;
  color: var(--bg3);
  font-size: 1.6rem;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 6px;
}
.star.on {
  color: var(--gold);
}
.survey-tags-label {
  font-size: 0.85rem;
  color: var(--soft, var(--text-soft));
  margin: 16px 0 8px;
}
#survey-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tag-chip {
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--bg3);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.82rem;
  text-align: left;
}
.tag-chip.on {
  border-color: var(--gold);
  background: #fdf3e0;
  color: var(--text);
}
.survey-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

/* Tek seferlik bilgilendirme banner'ı (ana ekran, akış içinde — çerez
   bildiriminden farklı olarak sabit/fixed DEĞİL, sayfayı kapatmaz). */
.notice-banner {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text);
}
.notice-banner .notice-text {
  margin-bottom: 12px;
}
.notice-banner .notice-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}
.notice-banner .notice-btn {
  width: auto;
  padding: 8px 16px;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* --- Ayarlar ekranı (seanslar arası hafıza — opt-out) --- */
.settings-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 600;
}
.settings-desc {
  color: var(--text-soft);
  font-size: 0.9rem;
  margin: 0 0 12px;
}
.settings-meta {
  color: var(--text-soft);
  font-size: 0.82rem;
  margin-top: 10px;
}
.settings-hint {
  color: var(--text-soft);
  font-size: 0.8rem;
  margin: 8px 0 0;
}
.settings-sep {
  height: 1px;
  background: var(--bg3);
  margin: 20px 0 18px;
}
/* "Hafıza geçmişimi sil" — yıkıcı ama nadir; vurgulu değil, net. */
.settings-danger {
  width: 100%;
  font-size: 0.9rem;
}

/* Geçmiş seans satırları — tarih/saat + silme ikonu */
.history-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.history-row + .history-row {
  border-top: 1px solid var(--bg3);
}
.history-open {
  flex: 1;
  text-align: left;
  padding: 12px 0;
  color: var(--text);
}
.history-del {
  background: transparent;
  color: var(--nav);
  padding: 8px 10px;
  font-size: 1rem;
  border-radius: 8px;
  flex-shrink: 0;
  line-height: 1;
}
.history-del:hover {
  color: #b23b3b;
}
