/* TELMO Chat Widget - Fixed Sizing, Input & Message Duplicates */
/* Version 3.1.5 - Responsive Height & Robust Dedup Fix */

:root {
  --z-top: 2147483000;
  --telmo-primary: #10b981;
  --telmo-primary-dark: #128c7e;
  --telmo-primary-darker: #075e54;
  --telmo-user-bubble: #dcf8c6;
  --telmo-admin-bubble: #ffffff;
  --telmo-bg-light: #f0f2f5;
  --telmo-bg-pattern: linear-gradient(to bottom, #e5ddd5 0%, #f0f2f5 100%);
  --telmo-border: #e1e5e9;
  --telmo-text: #333333;
  --telmo-text-light: #667781;
  --telmo-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  --telmo-shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --telmo-danger: #dc3545;
}



#telmo-chat-launcher { position: fixed; right:18px; bottom:18px; width:64px; height:64px; border-radius:50%; z-index:2147483647; }

#telmo-chat-launcher .telmo-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: linear-gradient(135deg, #e23545, #c83641);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  pointer-events: none; /* tıklamayı engellemesin */
}



/* ZORUNLU: Launcher Button - Document.body'nin doğrudan çocuğu */
#telmo-chat-launcher {
  position: fixed;
  right: 18px;
  bottom: 80px;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: var(--telmo-primary);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22), 0 8px 10px rgba(0, 0, 0, 0.2);
  z-index: var(--z-top);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  touch-action: manipulation;
}

#telmo-chat-launcher:hover {
  background: #059669;
  transform: scale(1.05);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28), 0 12px 16px rgba(0, 0, 0, 0.24);
}

#telmo-chat-launcher:active {
  transform: scale(0.95);
}

/* ZORUNLU: Hidden state - üç yönlü gizleme */
#telmo-chat-launcher.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none;
}

/* Launcher inner content */
#telmo-chat-launcher .launcher-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#telmo-chat-launcher .telmo-user-avatar {
  width: 78px;
  height: 68px;
  border-radius: 50%;
  background: #fff;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

/* ZORUNLU: Unread badge */
#telmo-chat-unread.badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ff3b30;
  color: #fff;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
  min-width: 18px;
  text-align: center;
  border: 2px solid white;
  animation: telmo-pulse 2s infinite;
}

@keyframes telmo-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

/* ZORUNLU: Mobile responsive launcher */
@media (max-width: 520px) {
  #telmo-chat-launcher {
    right: 12px;
    bottom: 80px;
    width: 60px;
  }

  #telmo-chat-launcher .telmo-user-avatar {
    width: 70px;
    height: 64px;
  }
}

/* Reset and Base */
.telmo-chat-widget * {
  box-sizing: border-box;
}

.telmo-chat-widget {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  position: fixed;
  z-index: calc(var(--z-top) - 1);
  pointer-events: none;
}

.telmo-chat-widget > * {
  pointer-events: auto;
}

/* Welcome Popup */
.telmo-welcome {
  position: fixed;
  bottom: 153px;
  right: 20px;
  background: linear-gradient(135deg, var(--telmo-primary), var(--telmo-primary-dark));
  color: white;
  padding: 16px 20px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--telmo-shadow-lg);
  display: none;
  z-index: calc(var(--z-top) - 1);
  animation: telmo-welcome-bounce 0.6s ease-out;
  max-width: 280px;
  cursor: pointer;
}

.telmo-welcome.show {
  display: block;
}

.telmo-welcome-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.telmo-welcome-close:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

@keyframes telmo-welcome-bounce {
  0% {
    transform: translateY(30px) scale(0.9);
    opacity: 0;
  }
  50% {
    transform: translateY(-5px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* ZORUNLU: Chat Container - Responsive Height */
.telmo-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 380px;
  /* ZORUNLU: Dinamik yükseklik */
  height: calc(100vh - 40px);
  max-height: 600px;
  border-radius: 16px;
  background: var(--telmo-admin-bubble);
  box-shadow: var(--telmo-shadow-lg);
  display: none;
  flex-direction: column;
  z-index: calc(var(--z-top) - 1);
  overflow: hidden;
  border: 1px solid var(--telmo-border);
}

.telmo-container.show {
  display: flex;
}

/* Responsive container sizing */
@media (max-width: 420px) {
  .telmo-container {
    width: calc(100vw - 20px);
    right: 10px;
  }
}

@media (max-width: 768px) and (min-width: 421px) {
  .telmo-container {
    width: 360px;
  }
}

/* ZORUNLU: Header - Fixed Z-Index */
.telmo-header {
  background: linear-gradient(135deg, var(--telmo-primary-dark) 0%, var(--telmo-primary-darker) 100%);
  color: white;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
  flex-shrink: 0;
  position: relative;
  z-index: calc(var(--z-top) + 10); /* ZORUNLU: En üstte olmalı */
}

.telmo-header-title {
  display: flex;
  align-items: center;
  flex: 1;
  font-size: 18px;
  font-weight: 600;
}

/* Header avatar ve durum stilleri */
.telmo-header-avatar {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  margin-right: 12px;
  object-fit: cover;
  border: 2px solid #fff;
}

.telmo-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #e8f5e9;
  opacity: 0.9;
}

.telmo-status-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  animation: chatmo-pulse-dot 2s infinite;
}

@keyframes chatmo-pulse-dot {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(1.2);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.telmo-header-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ZORUNLU: Header Buttons - Tema Uyumlu Styling */
.telmo-header-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: white;
  font-size: 16px;
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.telmo-header-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* Refresh button - tema uyumlu, mavi değil */
.telmo-header-btn.refresh {
  background: rgba(255, 255, 255, 0.15);
}

.telmo-header-btn.refresh:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* ZORUNLU: Flexbox Content Area - Mesaj Taşması Önleme */
.telmo-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* Prevents children from overflowing */
  position: relative;
  background: var(--telmo-bg-pattern);
  min-height: 0; /* Flexbox için kritik */
}

/* Registration Form */
.telmo-form {
  padding: 24px;
  background: white;
  margin: 20px;
  border-radius: 12px;
  box-shadow: var(--telmo-shadow);
}

.telmo-form-group {
  margin-bottom: 20px;
}

.telmo-form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--telmo-text);
  font-weight: 500;
}

.telmo-form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--telmo-border);
  border-radius: 12px;
  font-size: 14px;
  transition: all 0.2s;
  background: #fafbfc;
}

.telmo-form-input:focus {
  outline: none;
  border-color: var(--telmo-primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.telmo-form-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--telmo-primary), var(--telmo-primary-dark));
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s;
}

.telmo-form-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.telmo-form-submit:disabled {
  background: #cccccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ZORUNLU: Flexbox Messages Container - Taşma Engelleme */
.telmo-messages {
  flex: 1 1 auto; /* Büyüyebilir, küçülebilir, otomatik boyut */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  min-height: 0; /* Flexbox scrolling için kritik */
  max-height: none; /* Sınırsız yükseklik, flex ile kontrol */
}

.telmo-messages::-webkit-scrollbar {
  width: 6px;
}

.telmo-messages::-webkit-scrollbar-track {
  background: transparent;
}

.telmo-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

/* Message Bubbles */
.telmo-message {
  max-width: 75%;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  animation: telmo-message-appear 0.3s ease-out;
}

@keyframes telmo-message-appear {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.telmo-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.telmo-user-avatar {
  background-image: url("https://esim.telmo.com.tr/assets/images/telmo-balon.png");
  background-color: var(--telmo-primary);
}

.telmo-admin-avatar {
  background-image: url("https://esim.telmo.com.tr/cumali/assets/images/faces/face8.jpg");
  background-color: var(--telmo-primary-dark);
}

.telmo-ai-avatar {
  background-image: url("https://esim.telmo.com.tr/assets/images/faces/face11.jpg");
  background-color: #666666;
}

.telmo-message-content {
  flex: 1;
  position: relative;
}

/* User Messages (Right Side) */
.telmo-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.telmo-message.user .telmo-message-content {
  background: var(--telmo-user-bubble);
  color: var(--telmo-text);
  padding: 8px 12px;
  border-radius: 18px 18px 4px 18px;
  box-shadow: var(--telmo-shadow);
}

.telmo-message.user .telmo-message-content::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: -8px;
  width: 0;
  height: 0;
  border-left: 8px solid var(--telmo-user-bubble);
  border-bottom: 8px solid transparent;
}

/* Assistant/Admin Messages (Left Side) */
.telmo-message.assistant,
.telmo-message.admin {
  align-self: flex-start;
}

.telmo-message.assistant .telmo-message-content,
.telmo-message.admin .telmo-message-content {
  background: var(--telmo-admin-bubble);
  color: var(--telmo-text);
  padding: 8px 12px;
  border-radius: 18px 18px 18px 4px;
  box-shadow: var(--telmo-shadow);
}

.telmo-message.assistant .telmo-message-content::after,
.telmo-message.admin .telmo-message-content::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-right: 8px solid var(--telmo-admin-bubble);
  border-bottom: 8px solid transparent;
}

/* Message Text */
.telmo-message-sender {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--telmo-primary);
}

.telmo-message-text {
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.telmo-message-time {
  font-size: 11px;
  opacity: 0.7;
  text-align: right;
  margin-top: 4px;
  color: var(--telmo-text-light);
}

.telmo-message-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-top: 2px;
  gap: 2px;
}

.telmo-read-status {
  font-size: 12px;
  font-weight: bold;
}

.telmo-read-status.unread {
  color: #999;
}

.telmo-read-status.read {
  color: var(--telmo-primary);
}

/* File Attachments */
.telmo-message-attachment {
  margin-top: 6px;
  font-size: 12px;
}

.telmo-message-attachment img {
  max-width: 200px;
  height: auto;
  border-radius: 8px;
  margin-top: 6px;
  cursor: pointer;
  display: block;
  transition: transform 0.2s;
}

.telmo-message-attachment img:hover {
  transform: scale(1.02);
}

/* ZORUNLU: Flexbox Input Area - Sabit Kalma */
.telmo-input-area {
  flex-shrink: 0; /* Asla küçülmez */
  flex-grow: 0;   /* Asla büyümez */
  padding: 12px 16px;
  border-top: 1px solid var(--telmo-border);
  background: white;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  z-index: 5;
  position: relative; /* Absolute değil, relative */
}

.telmo-input-container {
  background: #f6f7f8;
  border: 1px solid var(--telmo-border);
  border-radius: 24px;
  padding: 6px 8px;
  display: flex;
  /* ZORUNLU: Butonların sabit kalması için */
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  max-width: 100%;
}

/* Auto-resize Textarea */
.telmo-input {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: 0;
  outline: 0;
  border-radius: 18px;
  font-size: 14px;
  transition: all 0.2s;
  resize: none;
  min-height: 38px;
  max-height: 140px;
  font-family: inherit;
  line-height: 1.4;
  overflow-y: auto;
  width: 0; /* Flex item için */
  min-width: 0; /* Flex shrinking için */
}

/* Input Buttons */
.telmo-input-btn {
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 10px;
  border-radius: 50%;
  transition: all 0.2s;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

#telmo-attach-btn {
  background: #fff;
  color: #555;
}

#telmo-send-btn {
  background: var(--telmo-primary);
  color: #fff;
}

#telmo-send-btn:hover {
  background: var(--telmo-primary-dark);
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}

.telmo-input-btn:active {
  transform: scale(0.95);
}

/* File Selection */
.telmo-file-input {
  display: none;
}

.telmo-file-chip {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 20px;
  border: 1px solid var(--telmo-border);
  margin-bottom: 8px;
  font-size: 12px;
  color: #666;
}

.telmo-file-chip.show {
  display: flex;
}

/* ZORUNLU: File Remove Button - Belirgin ❌ */
.telmo-file-remove {
  border: none;
  color: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  padding: 4px 8px;
  margin-left: auto;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.telmo-file-remove:hover {
  background: #c82333;
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(220, 53, 69, 0.4);
}

.telmo-file-remove::before {
  content: "❌";
  font-size: 12px;
}

/* Typing Indicator */
.telmo-typing {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: var(--telmo-admin-bubble);
  border-radius: 18px 18px 18px 4px;
  margin-bottom: 8px;
  align-self: flex-start;
  box-shadow: var(--telmo-shadow);
  max-width: 75%;
}

.telmo-typing-dots {
  display: flex;
  gap: 4px;
  margin-right: 8px;
}

.telmo-typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--telmo-primary);
  animation: telmo-typing-anim 1.4s infinite ease-in-out;
}

.telmo-typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}
.telmo-typing-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes telmo-typing-anim {
  0%,
  80%,
  100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ZORUNLU: Footer Status - Desktop positioning */
.telmo-footer {
  padding: 8px 16px;
  border-top: 1px solid var(--telmo-border);
  font-size: 11px;
  color: var(--telmo-text-light);
  text-align: center;
  background: white;
  flex-shrink: 0;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.telmo-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.telmo-status.online .telmo-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--telmo-primary);
  border-radius: 50%;
  animation: telmo-online-pulse 2s infinite;
}

@keyframes telmo-online-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ZORUNLU: Custom Reset Modal */
.telmo-reset-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: calc(var(--z-top) + 100);
  backdrop-filter: blur(4px);
}

.telmo-reset-modal.show {
  display: flex;
}

.telmo-reset-modal-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: telmo-modal-appear 0.3s ease-out;
}

@keyframes telmo-modal-appear {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.telmo-reset-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--telmo-text);
  margin-bottom: 12px;
  text-align: center;
}

.telmo-reset-modal-text {
  font-size: 14px;
  color: var(--telmo-text-light);
  margin-bottom: 24px;
  text-align: center;
  line-height: 1.5;
}

.telmo-reset-modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.telmo-reset-modal-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 80px;
}

.telmo-reset-modal-btn.cancel {
  background: #f8f9fa;
  color: var(--telmo-text);
  border: 1px solid var(--telmo-border);
}

.telmo-reset-modal-btn.cancel:hover {
  background: #e9ecef;
}

.telmo-reset-modal-btn.confirm {
  background: var(--telmo-danger);
  color: white;
}

.telmo-reset-modal-btn.confirm:hover {
  background: #c82333;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* ZORUNLU: Mobile Responsive - Tam Ekran Layout */
@media (max-width: 480px) {
  .telmo-welcome {
    bottom: 150px;
    right: 16px;
    max-width: calc(100vw - 100px);
  }

  .telmo-container {
    width: 100vw !important;
    height: 100vh !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: 0 !important;
    border-radius: 0 !important;
    max-height: none; /* ZORUNLU: Mobil için max-height kaldır */
  }

  .telmo-header {
    padding: 16px 20px;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    min-height: 60px;
  }

  .telmo-header-title {
    font-size: 18px;
  }

  .telmo-header-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  /* ZORUNLU: Mobile Messages - Sadece Input için padding */

  .telmo-message {
    max-width: 85%;
  }

  .telmo-message-avatar {
    width: 40px;
    height: 40px;
  }

  /* ZORUNLU: Mobile Input Area - Sabit Positioning */
  .telmo-input-area {
    position: fixed !important;
    bottom: 0 !important; /* ZORUNLU: Footer kaldırıldı, en altta */
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: white;
    border-top: 2px solid var(--telmo-border);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000 !important;
    min-height: 70px; /* Sabit yükseklik yerine min-height */
    height: auto;
  }

  .telmo-input {
    padding: 12px 16px;
    font-size: 16px; /* iOS zoom prevention */
    border-radius: 20px;
    min-height: 44px;
  }

  .telmo-input-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .telmo-form {
    margin: 16px;
    padding: 20px;
  }

  .telmo-form-input {
    padding: 16px;
    font-size: 16px; /* iOS zoom prevention */
  }

  .telmo-form-submit {
    padding: 16px;
    font-size: 16px;
  }

  /* ZORUNLU: Mobile Footer - Kaldırıldı */
  .telmo-footer {
    display: none !important;
  }

  /* Mobile Reset Modal */
  .telmo-reset-modal-content {
    margin: 20px;
    padding: 20px;
  }

  .telmo-reset-modal-buttons {
    flex-direction: column;
  }

  .telmo-reset-modal-btn {
    width: 100%;
  }
}

/* Very Small Screens */
@media (max-width: 320px) {
  .telmo-message {
    max-width: 90%;
  }

  .telmo-container {
    width: 100vw !important;
  }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .telmo-container {
    height: 100vh !important;
  }

  .telmo-header {
    min-height: 50px;
    padding: 12px 20px;
  }

  .telmo-input-area {
    padding: 8px 16px;
    min-height: 60px;
  }

  .telmo-messages {
    padding-bottom: 80px !important;
  }
}

/* Tablet Responsive */
@media (min-width: 481px) and (max-width: 768px) {
  .telmo-container {
    width: 400px;
    max-height: 650px;
  }

  .telmo-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }

  .telmo-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    padding: 12px;
  }

  .telmo-input-area {
    flex-shrink: 0;
    flex-grow: 0;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    position: relative; /* Absolute değil */
  }

  .telmo-footer {
    position: absolute;
    bottom: 0;
  }
}

/* Large Desktop */
@media (min-width: 1200px) {
  .telmo-container {
    width: 420px;
    max-height: 650px;
  }
}

/* ZORUNLU: Çakışma önlemleri - Global .hidden sınıfına karşı koruma */
#telmo-chat-launcher.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none;
}

/* ZORUNLU: Print ve medya sorguları launcher'ı etkilemez */
@media print {
  #telmo-chat-launcher {
    display: none !important;
  }
}

/* ZORUNLU: Prefers-reduced-motion launcher'ı etkilemez */
@media (prefers-reduced-motion: reduce) {
  #telmo-chat-launcher {
    transition: none;
  }

  #telmo-chat-launcher:hover {
    transform: none;
  }
}


/* ZORUNLU: Mobile Messages Container - Input için padding */
@media (max-width: 480px) {
  .telmo-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    /* ZORUNLU: Input alanı için alt padding */
    padding-bottom: 100px !important; /* Input yüksekliği + güvenlik marjı */
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    min-height: 0;
  }

  /* ZORUNLU: Content area - Input için alan bırakma */
  .telmo-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    /* ZORUNLU: Input alanı için alt margin */
    margin-bottom: 80px; /* Input yüksekliği kadar */
  }

  /* ZORUNLU: Input Area - Sabit konumlandırma */
  .telmo-input-area {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: white;
    border-top: 2px solid var(--telmo-border);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000 !important;
    min-height: 70px;
    height: auto;
    /* ZORUNLU: Flexbox'tan çıkarma */
    flex-shrink: 0;
    flex-grow: 0;
  }
}

/* ZORUNLU: Landscape Mobile için ek düzeltme */
@media (max-height: 500px) and (orientation: landscape) {
  .telmo-messages {
    padding-bottom: 90px !important; /* Landscape için daha az padding */
  }
  
  .telmo-content {
    margin-bottom: 70px; /* Landscape için daha az margin */
  }
}

/* ZORUNLU: Very Small Screens için ek düzeltme */
@media (max-width: 320px) {
  .telmo-messages {
    padding-bottom: 110px !important; /* Küçük ekranlar için daha fazla padding */
  }
}