:root {
  --pink: #e01e5a;
  --pink-light: #ff3b6e;
  --bg: #fff5f7;
  --text: #2a2a2a;
  --shadow: 0 6px 24px rgba(224, 30, 90, 0.18);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text); background: var(--bg);
  overscroll-behavior: none;
}
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; }

/* ---- Giriş ---- */
.login {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #fff5f7, #ffe1ea);
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 360px;
  background: #fff; border-radius: 24px; padding: 32px 24px;
  box-shadow: var(--shadow); text-align: center;
}
.login-logo {
  width: 128px; height: 128px; border-radius: 28px;
  box-shadow: var(--shadow); display: block; margin: 0 auto 24px;
}
.login-card input {
  width: 100%; padding: 14px 16px; margin-bottom: 12px;
  border: 1.5px solid #f0c8d4; border-radius: 14px; font-size: 16px;
  background: #fff; outline: none;
}
.login-card input:focus { border-color: var(--pink-light); }

button {
  cursor: pointer; border: none; font-size: 16px; font-weight: 600;
  border-radius: 14px; padding: 14px 18px;
  background: var(--pink); color: #fff; transition: transform .05s;
}
button:active { transform: scale(0.97); }
button.ghost { background: transparent; color: var(--pink); }
button.danger { background: #d33; }
.login-card button { width: 100%; margin-top: 4px; }

.error { color: #d33; font-size: 14px; margin-top: 10px; min-height: 18px; }

/* ---- Uygulama ---- */
.app { }
#map { position: absolute; inset: 0; z-index: 1; }

.topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 500;
  display: flex; align-items: center; justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
}

/* ---- Sekme paneli ---- */
.tab-panel {
  position: absolute; inset: 0; display: none;
  bottom: calc(64px + env(safe-area-inset-bottom));
}
.tab-panel.active { display: block; }
#map { position: absolute; inset: 0; z-index: 1; }

/* ---- Alt sekme çubuğu ---- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 900;
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: #fff;
  border-top: 1px solid #f0d0da;
  box-shadow: 0 -2px 12px rgba(224,30,90,.08);
}
.tab-btn {
  flex: 1; background: none; border: none; padding: 8px 0 6px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: #b98; font-size: 11px; font-weight: 500; position: relative;
  border-radius: 0;
}
.tab-btn svg { width: 24px; height: 24px; }
.tab-btn.active { color: var(--pink); }
.tab-btn:active { transform: none; }
.badge {
  position: absolute; top: 4px; right: calc(50% - 18px);
  width: 9px; height: 9px; background: var(--pink);
  border-radius: 50%; border: 1.5px solid #fff;
}

.fab {
  position: absolute; z-index: 500;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  width: 62px; height: 62px; padding: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: var(--shadow);
}
.fab:active { transform: translateX(-50%) scale(0.94); }

/* ---- Modal ---- */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(40, 10, 20, .5); padding: 20px;
}
.modal-card {
  width: 100%; max-width: 400px; max-height: 90vh; overflow-y: auto;
  background: #fff; border-radius: 22px; padding: 20px;
  box-shadow: var(--shadow);
}
.modal-card h2 { margin: 0 0 14px; color: var(--pink); }
.preview {
  width: 100%; height: 240px; object-fit: cover;
  border-radius: 14px; background: #f4dde5; display: block;
}
/* Harita detayında foto daha büyük + dokununca tam ekran */
#detailModal .modal-card { max-width: 92vw; }
#detailImg {
  height: min(60vh, 460px); object-fit: contain;
  background: #1a1015; cursor: zoom-in;
}
.loc-info { font-size: 13px; color: #a06; margin: 10px 0; }
textarea {
  width: 100%; padding: 12px; border: 1.5px solid #f0c8d4;
  border-radius: 12px; font-size: 16px; font-family: inherit; resize: none;
  margin-top: 8px; outline: none;
}
textarea:focus { border-color: var(--pink-light); }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.modal-actions button { flex: 1; }
.detail-note { font-size: 17px; margin: 12px 0 4px; font-weight: 600; }
.detail-meta { font-size: 13px; color: #999; }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  z-index: 2000; background: #333; color: #fff;
  padding: 12px 20px; border-radius: 12px; font-size: 14px;
  box-shadow: var(--shadow); max-width: 90%; text-align: center;
}

/* Kalp marker (DivIcon) */
.heart-marker {
  font-size: 30px; line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,.35));
  cursor: pointer; text-align: center;
}

/* ---- Sohbet ---- */
#tab-chat { display: none; flex-direction: column; background: var(--bg); }
#tab-chat.active { display: flex; }
.messages {
  flex: 1; overflow-y: auto; padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  display: flex; flex-direction: column; gap: 8px;
}
.msg {
  max-width: 78%; padding: 10px 14px; border-radius: 18px;
  font-size: 15px; line-height: 1.35; word-wrap: break-word;
}
.msg.mine { align-self: flex-end; background: var(--pink); color: #fff;
  border-bottom-right-radius: 5px; }
.msg.theirs { align-self: flex-start; background: #fff; color: var(--text);
  border-bottom-left-radius: 5px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.msg .time { display: block; font-size: 10px; opacity: .6; margin-top: 3px; }
.chat-input {
  display: flex; gap: 6px; align-items: center; padding: 8px 10px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid #f0d0da;
}
.chat-input input#chatText {
  flex: 1; padding: 11px 16px; border: 1.5px solid #f0c8d4;
  border-radius: 22px; font-size: 16px; outline: none; min-width: 0;
}
.chat-input input#chatText:focus { border-color: var(--pink-light); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; padding: 0; flex-shrink: 0;
  background: none; color: var(--pink); font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn.send { background: var(--pink); color: #fff; font-size: 17px; }
.icon-btn:active { transform: scale(0.9); }

/* Emoji hızlı paleti */
.emoji-bar {
  display: flex; gap: 4px; flex-wrap: wrap; padding: 8px 12px;
  background: #fff; border-top: 1px solid #f4e4ea; max-height: 160px; overflow-y: auto;
}
.emoji-bar button {
  background: none; padding: 4px; font-size: 26px; border-radius: 8px;
  width: 44px; height: 44px;
}
.emoji-bar button:active { background: #ffe1ea; }

/* Yazıyor göstergesi */
.typing-indicator {
  display: flex; gap: 4px; align-items: center;
  padding: 6px 20px 2px; height: 22px;
}
.typing-indicator span {
  width: 7px; height: 7px; background: #c99; border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: .2s; }
.typing-indicator span:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Mesaj medyası */
.msg img.msg-media, .msg video.msg-media {
  max-width: 220px; max-height: 280px; border-radius: 12px;
  display: block; margin-bottom: 4px; cursor: pointer;
}
.msg .file-card {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: rgba(0,0,0,.06); border-radius: 10px; margin-bottom: 4px;
  cursor: pointer; text-decoration: none; color: inherit;
}
.msg.mine .file-card { background: rgba(255,255,255,.2); }
.msg .file-card .fi { font-size: 22px; }
.msg .file-card .fn { font-size: 13px; word-break: break-all; }

/* Okundu tikleri */
.msg .ticks { font-size: 11px; margin-left: 6px; }
.msg .ticks.read { color: #4fc3f7; }

/* Mesaj bilgi modalı */
.msg-info { font-size: 15px; }
.msg-info .row { display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid #f4e4ea; }
.msg-info .row:last-child { border-bottom: none; }
.msg-info .row span:last-child { color: #a06; }

/* Medya tam ekran görüntüleyici */
.media-viewer {
  position: fixed; inset: 0; background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center; z-index: 1100;
}
.media-viewer img, .media-viewer video { max-width: 96vw; max-height: 90vh; border-radius: 8px; }
.media-close {
  position: absolute; top: max(16px, env(safe-area-inset-top)); right: 16px;
  width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.15);
  color: #fff; font-size: 20px; z-index: 1101;
}

/* Klavye açıkken tab bar gizle (JS body'ye .kbd ekler) */
body.kbd .tabbar { display: none; }
body.kbd .tab-panel { bottom: 0; }

/* ---- Asistan öneri baloncuğu ---- */
.suggestion-bubble {
  align-self: center; max-width: 88%; margin: 6px 0;
  display: flex; gap: 10px; padding: 12px 14px;
  background: linear-gradient(135deg, #fff, #fff0f4);
  border: 1.5px solid var(--pink-light); border-radius: 16px;
  box-shadow: 0 3px 12px rgba(224,30,90,.15);
}
.suggestion-bubble .sg-icon { font-size: 24px; }
.suggestion-bubble .sg-summary { font-size: 14px; margin-bottom: 8px; line-height: 1.4; }
.suggestion-bubble .sg-actions { display: flex; gap: 8px; }
.suggestion-bubble .sg-add {
  padding: 7px 14px; font-size: 13px; border-radius: 10px;
}
.suggestion-bubble .sg-dismiss {
  padding: 7px 12px; font-size: 13px; border-radius: 10px;
  background: none; color: #999;
}

/* Öneri onay formu */
.fld { display: flex; flex-direction: column; font-size: 13px; color: #a06; gap: 4px; margin-top: 10px; }
.fld input {
  padding: 11px 12px; border: 1.5px solid #f0c8d4; border-radius: 10px;
  font-size: 16px; outline: none; color: var(--text);
}
.fld input:focus { border-color: var(--pink-light); }
.fld-row { display: flex; gap: 10px; }
.fld-row .fld { flex: 1; }
.fld-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 15px; }
.fld-check input { width: 18px; height: 18px; }

/* ---- Kalp sekmesi ---- */
.heart-tab { background: linear-gradient(160deg, #fff5f7, #ffe1ea); }
.heart-tab.active { display: flex; }
.heart-tab-inner {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 24px;
}
.big-heart {
  width: 160px; height: 160px; border-radius: 50%;
  background: #fff; color: var(--pink); font-size: 80px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 40px rgba(224,30,90,.25); padding: 0;
}
.big-heart:active { transform: scale(0.9); }
.heart-status { font-size: 14px; color: #a06; min-height: 20px; margin: 0; }

/* ---- Profil ---- */
.profile { background: var(--bg); overflow-y: auto; }
.profile.active { display: block; }
.profile-inner {
  padding: max(32px, env(safe-area-inset-top)) 24px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.profile-logo { width: 88px; height: 88px; border-radius: 22px; box-shadow: var(--shadow); }
.profile h2 { margin: 0; color: var(--pink); }
.profile-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 16px;
  padding: 4px 16px; box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.profile-card .row {
  display: flex; justify-content: space-between; padding: 14px 0;
  border-bottom: 1px solid #f4e4ea; font-size: 15px;
}
.profile-card .row:last-child { border-bottom: none; }
.profile-card .row span:last-child { color: #a06; font-weight: 600; }
button.secondary {
  width: 100%; max-width: 400px; background: #fff; color: var(--pink);
  border: 1.5px solid var(--pink);
}
.profile .ghost { margin-top: 8px; }

/* ---- Kalp yağmuru animasyonu ---- */
.heart-rain { position: fixed; inset: 0; z-index: 3000; pointer-events: none; overflow: hidden; }
.falling-heart {
  position: absolute; top: -40px; font-size: 32px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(40deg); opacity: 0; }
}
.pulse-heart {
  position: fixed; top: 40%; left: 50%; transform: translate(-50%,-50%);
  font-size: 120px; z-index: 3001; pointer-events: none;
  animation: pulseHeart 1.2s ease-out forwards;
}
@keyframes pulseHeart {
  0% { transform: translate(-50%,-50%) scale(0); opacity: 0; }
  30% { transform: translate(-50%,-50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(1); opacity: 0; }
}
