:root {
  --green: #2a8768;
  --green-dark: #1f6f54;
  --brown: #5b3a24;
  --bg: #f4f6f5;
  --card: #ffffff;
  --text: #1b2420;
  --muted: #6b7a73;
  --border: #e2e8e4;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ---------- ANA EKRAN (LANDING) ---------- */
.landing {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  /* Arka plan görseli + üzerine soluk beyaz katman (yazılar okunsun diye) */
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.45)),
    url("/bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.landing-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px;
}
.landing-logo {
  height: 78px;
  width: auto;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.75);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.lang-toggle button {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: 13px; padding: 2px 4px;
}
.lang-toggle button.active { color: var(--green-dark); text-decoration: underline; }
.lang-toggle span { color: #bbb; }

.hero {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 48px;
}
.hero-card {
  width: 100%;
  max-width: 640px;
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 24px;
  padding: 32px 28px 36px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.hero-pre {
  color: var(--brown);
  letter-spacing: .35em;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}
.hero-title {
  color: var(--brown);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: .06em;
  margin-bottom: 14px;
}
.hero-title span { display: block; font-size: clamp(30px, 8vw, 58px); }
.hero-sub {
  color: var(--brown);
  font-size: clamp(15px, 3.5vw, 20px);
  margin-bottom: 22px;
  opacity: .9;
}
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-btn {
  display: inline-block;
  padding: 13px 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  border: 2px solid var(--brown);
  background: rgba(91,58,36,.85);
  color: #fff;
  text-decoration: none;
  transition: transform .05s;
}
.hero-btn:active { transform: translateY(1px); }
.hero-btn.primary {
  background: var(--green);
  border-color: var(--green-dark);
}

.landing-map {
  display: flex;
  justify-content: center;
  padding: 0 16px 8px;
}
.landing-map img {
  width: 100%;
  max-width: 640px;
  border-radius: 16px;
  box-shadow: 0 8px 28px rgba(0,0,0,.18);
}

.landing-footer {
  text-align: center;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  font-size: 13px;
  color: var(--brown);
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.7);
}
.landing-footer a {
  color: var(--green-dark);
  font-weight: 700;
  text-decoration: none;
}
.landing-footer a:hover { text-decoration: underline; }

/* Giriş ve sohbet ekranlarındaki ince "Powered by" satırı */
.mini-footer {
  text-align: center;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  font-size: 11px;
  color: var(--muted);
  background: var(--card);
}
.mini-footer a { color: var(--green-dark); font-weight: 600; text-decoration: none; }
.mini-footer a:hover { text-decoration: underline; }
/* Giriş ekranı (koyu zemin): alta sabit, açık renkli */
.mini-footer.light {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
}
.mini-footer.light a { color: #fff; text-decoration: underline; }

/* ---------- GİRİŞ ---------- */
.login-screen {
  position: relative;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  /* Ana ekranla aynı manzara arka planı + okunurluk için soluk katman */
  background-image:
    linear-gradient(rgba(31, 111, 84, 0.55), rgba(24, 90, 68, 0.55)),
    url("/bg.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}
.login-card {
  position: relative;
  background: var(--card);
  width: 100%;
  max-width: 360px;
  border-radius: 20px;
  padding: 36px 24px 28px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-back {
  position: absolute;
  top: 14px; left: 14px;
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 13px;
}
.login-logo-img { height: 60px; border-radius: 6px; margin-bottom: 8px; }
.login-card h1 { font-size: 20px; color: var(--green-dark); }
.login-sub { color: var(--muted); margin-bottom: 20px; font-size: 14px; }
.login-card .btn-text { color: var(--green-dark); font-size: 13px; margin-top: 4px; opacity: 1; }
.login-card input {
  width: 100%; padding: 14px 16px;
  border: 1px solid var(--border); border-radius: 12px;
  font-size: 16px; margin-bottom: 12px;
}
.login-card input:focus { outline: none; border-color: var(--green); }
.login-error { color: #c0392b; font-size: 14px; margin-top: 10px; }
.login-hint { color: var(--muted); font-size: 12px; margin-top: 16px; }
.consent-text {
  text-align: left; border: 1px solid var(--border); border-radius: 12px;
  padding: 0 14px; margin-bottom: 14px; font-size: 14px;
}
.consent-text summary {
  min-height: 44px; display: flex; align-items: center; cursor: pointer;
  color: var(--green-dark); font-weight: 600;
}
.consent-text p { margin: 0 0 12px; line-height: 1.5; }
.consent-check {
  display: flex; align-items: flex-start; gap: 10px; text-align: left;
  font-size: 14px; margin-bottom: 14px; cursor: pointer; min-height: 44px;
}
.login-card .consent-check input {
  width: 22px; height: 22px; flex-shrink: 0; margin: 1px 0 0; padding: 0; accent-color: var(--green);
}

/* ---------- SOHBET ---------- */
.chat-screen { display: flex; flex-direction: column; height: 100dvh; max-width: 720px; margin: 0 auto; background: var(--bg); }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--green); color: #fff;
}
.topbar-title { display: flex; align-items: center; gap: 10px; }
.topbar-logo { height: 34px; border-radius: 5px; }
.topbar-title strong { display: block; font-size: 15px; }
.topbar-title small { font-size: 12px; opacity: .85; }
.btn-text { background: none; border: none; color: #fff; font-size: 14px; cursor: pointer; opacity: .9; }

.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.welcome { text-align: center; margin: auto 0; color: var(--muted); }
.welcome-emoji { font-size: 40px; }
.welcome h2 { color: var(--text); margin: 8px 0 4px; }
.welcome p { font-size: 14px; margin-bottom: 18px; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; font-size: 13px; color: var(--green-dark); cursor: pointer; }
.chip:active { background: #eef3f0; }

.msg { max-width: 85%; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--green); color: #fff; border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.ai p { margin: 0 0 8px; } .msg.ai p:last-child { margin-bottom: 0; }
.msg.ai ul, .msg.ai ol { margin: 4px 0 8px 20px; }
.msg.ai code { background: #eef3f0; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.msg.ai strong { font-weight: 600; }

.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing span { width: 7px; height: 7px; background: var(--muted); border-radius: 50%; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }

.input-bar { display: flex; gap: 8px; padding: 10px 12px; background: var(--card); border-top: 1px solid var(--border); }
.input-bar textarea { flex: 1; resize: none; border: 1px solid var(--border); border-radius: 22px; padding: 11px 16px; font-size: 16px; font-family: inherit; max-height: 120px; line-height: 1.4; }
.input-bar textarea:focus { outline: none; border-color: var(--green); }

.btn-primary { width: 100%; padding: 14px; background: var(--green); color: #fff; border: none; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; }
.btn-primary:active { background: var(--green-dark); }
.btn-primary:disabled { opacity: .6; }
.btn-send { width: 44px; height: 44px; flex-shrink: 0; border: none; border-radius: 50%; background: var(--green); color: #fff; font-size: 18px; cursor: pointer; }
.btn-send:disabled { opacity: .5; }

/* ---------- ARAÇLARIM ---------- */
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.topbar-actions .btn-text { min-height: 44px; padding: 0 10px; }
.modal {
  position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--card); border-radius: 16px; width: 100%; max-width: 440px;
  max-height: 90dvh; overflow-y: auto; padding: 18px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-close { background: none; border: none; font-size: 20px; min-width: 44px; min-height: 44px; cursor: pointer; color: var(--muted); }
.vehicle-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.vehicle-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
}
.vehicle-list .vehicle-info { display: flex; flex-direction: column; font-size: 14px; min-width: 0; }
.vehicle-list .vehicle-info strong { font-size: 15px; }
.vehicle-list .vehicle-info span { color: var(--muted); overflow-wrap: anywhere; }
.vehicle-empty { color: var(--muted); font-size: 14px; border: none !important; padding: 4px 0 !important; }
.vehicle-del {
  background: none; border: 1px solid #c0392b; color: #c0392b; border-radius: 10px;
  min-width: 44px; min-height: 44px; padding: 0 12px; font-size: 14px; cursor: pointer; flex-shrink: 0;
}
.vehicle-del.confirm { background: #c0392b; color: #fff; }
.item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.vehicle-edit {
  background: none; border: 1px solid var(--green); color: var(--green-dark); border-radius: 10px;
  min-width: 44px; min-height: 44px; padding: 0 12px; font-size: 14px; cursor: pointer; flex-shrink: 0;
}
.vehicle-form.editing { border-top: 2px solid var(--green); padding-top: 12px; }
.btn-cancel {
  width: 100%; min-height: 44px; margin-top: 8px; background: none; border: 1px solid var(--border);
  border-radius: 12px; font-size: 15px; color: var(--muted); cursor: pointer;
}
.btn-cancel.hidden { display: none; }
.vehicle-form h4 { margin: 0 0 10px; font-size: 15px; }
.vehicle-form input {
  width: 100%; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: 12px; font-size: 16px; margin-bottom: 10px;
}
.vehicle-form input:focus { outline: none; border-color: var(--green); }
.vehicle-form select {
  width: 100%; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: 12px; font-size: 16px; margin-bottom: 10px; background: #fff;
}
.vehicle-form select.hidden { display: none; }
.vehicle-form textarea {
  width: 100%; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: 12px; font-size: 16px; margin-bottom: 10px; resize: vertical; font-family: inherit;
}
.vehicle-form textarea:focus { outline: none; border-color: var(--green); }
.request-ok { color: var(--green-dark); font-size: 14px; margin: 6px 0 0; }
.request-ok.hidden { display: none; }
.request-list-title { margin: 18px 0 8px; font-size: 15px; }
.request-status { font-size: 12px; color: var(--green-dark); font-weight: 600; }
@media (max-width: 480px) {
  .topbar-actions .btn-text { padding: 0 6px; font-size: 13px; }
  .topbar-title small { display: none; }
  .topbar-title { min-width: 0; }
  .topbar-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* ---------- Mobil: üst çubuk menüsü ---------- */
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; row-gap: 8px; padding-bottom: 10px; }
  .topbar-actions {
    width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  }
  .topbar-actions .btn-text {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 52px; padding: 6px 2px; font-size: 12px; line-height: 1.15; text-align: center;
    background: rgba(255,255,255,.16); border-radius: 10px; opacity: 1;
  }
  .topbar-actions .btn-text:active { background: rgba(255,255,255,.3); }
  .topbar-actions .btn-text::before { font-size: 18px; line-height: 1; }
  #eventsBtn::before { content: "🎉"; }
  #requestBtn::before { content: "📝"; }
  #familyBtn::before { content: "👨‍👩‍👧"; }
  #vehiclesBtn::before { content: "🚗"; }
  #logoutBtn::before { content: "🚪"; }

  /* Pencereler: alttan açılan tam genişlikli sayfa gibi */
  .modal { align-items: flex-end; padding: 0; }
  .modal-card {
    max-width: none; border-radius: 16px 16px 0 0; max-height: 92dvh;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  }
  .vehicle-list li { align-items: flex-start; }
}

/* Mobilde üst çubukta başlık yazıları gizlenir (sadece logo + menü düğmeleri) */
@media (max-width: 600px) {
  .topbar-title > div { display: none; }
  .topbar-title { width: 100%; justify-content: center; }
}

/* Mobil: logo solda, "Çıkış" sağda küçük bağlantı; altta 3 geniş menü düğmesi */
@media (max-width: 600px) {
  .topbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; align-items: center; }
  .topbar-actions { display: contents; }
  .topbar-title { grid-column: 1 / 4; grid-row: 1; width: auto; justify-content: flex-start; }
  #logoutBtn {
    grid-column: 4; grid-row: 1; justify-self: end;
    flex-direction: row; min-height: 44px; padding: 0 8px;
    background: none; font-size: 13px; text-decoration: underline; opacity: .95;
  }
  #logoutBtn::before { content: none; }
  #logoutBtn:active { background: none; opacity: .7; }
}

/* Mobil: Etkinlik / Talep / Ailem / Araçlarım — simge üstte, kısa ad altında */
@media (max-width: 600px) {
  #eventsBtn, #requestBtn, #familyBtn, #vehiclesBtn { font-size: 12px; font-weight: 600; min-height: 58px; gap: 3px; }
  #eventsBtn::before, #requestBtn::before, #familyBtn::before, #vehiclesBtn::before { font-size: 24px; }
}

/* ---------- ETKİNLİKLER ---------- */
.events-hint { font-size: 14px; color: var(--muted); margin: 0 0 12px; }
.vehicle-list li.event-item { flex-direction: column; align-items: stretch; }
.event-item .event-desc { white-space: pre-line; }
.event-status { font-size: 13px; color: var(--green-dark); font-weight: 600; }
.event-row { display: flex; gap: 8px; margin-top: 8px; }
.event-row input {
  width: 90px; min-height: 44px; padding: 0 12px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 16px;
}
.event-row input:focus { outline: none; border-color: var(--green); }
.event-row .event-save {
  flex: 1; min-height: 44px; background: var(--green); color: #fff; border: none;
  border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.event-row .event-save:disabled { opacity: .6; }
