/* ============================================================
   CHAT EKRANLARI (AI Report / AI Control)
   Zemin: shader arka plan + rgba(10,22,40,0.42) karartma
   ============================================================ */
.view--chat {
  padding: 0;
}

.chat-overlay {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  background: rgba(10, 22, 40, 0.42);
  padding: calc(16px + env(safe-area-inset-top)) 16px 0;
}

.view--chat .topbar {
  gap: 8px;
}

.view--chat .pill--location {
  flex: 1;
  max-width: 112px;
}

.home-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(160, 217, 255, 0.9);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.home-btn svg {
  width: 22px;
  height: 22px;
}

.chat-title {
  font-weight: 700;
  font-size: 18px;
  color: #fff;
  line-height: 1.2;
}

.chat-sub {
  margin: 0;
  font-size: 11px;
}

.chat-header-text {
  display: flex;
  flex-direction: column;
  margin-left: 4px;
}

.view--chat .topbar {
  gap: 8px;
  justify-content: flex-start;
}

.view--chat .pill-group {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.chat-scroll {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin-top: 16px;
  padding-bottom: 12px;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Şık ve şeffaf kaydırma çubuğu (Scrollbar) */
.chat-scroll::-webkit-scrollbar {
  width: 5px;
}

.chat-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.chat-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: 10px;
}

.chat-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* ---- Baloncuklar ---- */
.msg {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}

.msg--user {
  justify-content: flex-end;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  flex: none;
  margin-bottom: 2px;
}

.bubble {
  max-width: 78%;
  min-width: 0;
  /* flex item'ın max-width'i uygulayabilmesi için şart */
  padding: 12px 16px;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: anywhere;
  /* uzun/boşluksuz kelimeyi kutu içinde kır */
  word-break: break-word;
  position: relative;
}

.bubble--ai {
  background: var(--bubble-ai-bg);
  border: 1px solid var(--bubble-ai-border);
  color: var(--bubble-ai-text);
  border-radius: 18px 18px 18px 4px;
  /* asimetrik sol kuyruk */
}

.bubble--user {
  background: var(--bubble-user-bg);
  color: var(--bubble-user-text);
  font-weight: 500;
  border-radius: 18px 18px 4px 18px;
  /* asimetrik sağ kuyruk */
}

.bubble.is-typing {
  opacity: 0.7;
  font-style: italic;
}

/* ---- Giriş satırı ---- */
.chat-input-row {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  min-width: 0;
  padding: 12px 8px calc(20px + env(safe-area-inset-bottom));
}

.chat-input {
  width: 100%;
  flex: 1;
  min-width: 0;
  min-height: 52px;
  max-height: 120px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 16px 20px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 14px;
  outline: none;
  resize: none;
  line-height: 1.4;
  overflow-y: auto;
}

.chat-input::-webkit-scrollbar {
  display: none;
}

.chat-input::placeholder {
  color: rgba(255, 255, 255, 0.75);
}

.chat-input:focus {
  border-color: var(--btn-border);
}

.send-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--cyan);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.send-btn svg {
  width: 18px;
  height: 18px;
}

.send-btn:active {
  transform: scale(0.94);
}

/* Geniş telefon / küçük tablet */
@media (min-width: 541px) {
  body {
    display: flex;
    align-items: stretch;
    justify-content: center;
  }
}

/* ---- Manual Control Panel UI ---- */
.control-panel {
  padding: 0 16px;
  margin-bottom: 8px;
}
.panel-heading {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 8px;
  font-weight: 600;
}
.panel-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 24px;
}
.ctrl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0;
}
.ctrl-row-slider {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.ctrl-row-slider .ctrl-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ctrl-title {
  font-size: 15px;
  color: #fff;
  font-weight: 500;
  display: block;
  margin-bottom: 4px;
}
.ctrl-desc {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}
.ctrl-val {
  color: var(--cyan);
  font-weight: 600;
  font-size: 14px;
}
.ctrl-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0;
}
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255,255,255,0.2);
  transition: .3s;
  border-radius: 24px;
}
.switch .slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}
.switch input:checked + .slider {
  background-color: var(--cyan);
}
.switch input:checked + .slider:before {
  transform: translateX(20px);
}
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  background: transparent;
}
input[type=range]:focus {
  outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}
input[type=range]::-webkit-slider-thumb {
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--cyan);
  cursor: pointer;
  -webkit-appearance: none;
  margin-top: -6px;
}
.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
}
.bubble--done {
  background: #1e2c41 !important;
  border: 1px solid rgba(255,255,255,0.1) !important;
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 10px 16px !important;
  color: #fff !important;
  border-radius: 18px 18px 18px 4px !important;
}
.bubble--done svg {
  width: 18px;
  height: 18px;
}

/* ---- AI Report UI ---- */
.risk-bar-container {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  margin-bottom: -6px;
}
.risk-gradient {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #10B981 0%, #F59E0B 50%, #EF4444 100%);
  position: relative;
  margin-bottom: 4px;
}
.risk-indicator {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
  width: 0; 
  height: 0; 
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 6px solid #fff;
  transition: left 0.5s ease;
}
.risk-label {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  text-align: right;
  margin-top: 8px;
}
.offline-popup-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 20px;
  margin: 16px auto;
  max-width: 280px;
  text-align: center;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}
.offline-popup-icon {
  margin-bottom: 12px;
  opacity: 0.8;
}
.offline-popup-title {
  font-size: 16px;
  color: #fff;
  font-weight: 600;
  margin-bottom: 8px;
}
.offline-popup-text {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.4;
}
