.chat-widget {
  background: #fafafa;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  width: 380px;
  height: 500px;
  display: flex;
  flex-direction: column;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  transition: all 0.2s ease-out;
  border: 1px solid rgba(0, 0, 0, 0.05);
  transform-origin: right bottom;
}

.chat-widget.minimized {
  bottom: 0;
  right: 30px;
  height: 160px;
  width: 120px;
  border-radius: 0%;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  transform-origin: right bottom;
}

.chat-widget.minimized .chat-messages,
.chat-widget.minimized .chat-input-area,
.chat-widget.minimized .kasim-abi-info,
.chat-widget.minimized .minimize-btn {
  display: none;
}

.chat-widget.minimized .chat-header {
  background: transparent;
  border: none;
  padding: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-widget.minimized .kasim-abi-avatar {
  width: 100%;
  height: 100%;
  margin: 0;
  border-radius: 0%;
  background: transparent;
}

.chat-header {
  background: #ffffff;
  color: #333;
  padding: 12px 16px;
  text-align: left;
  position: relative;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.kasim-abi-avatar {
  width: 36px;
  height: 36px;
  background: transparent;
  border-radius: 0%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
  overflow: hidden;
}

.kasim-abi-avatar img {
  width: 100%;
  height: 100%;
  /* object-fit: cover; */
  border-radius: 0%;
}

/* Chat açıkken küçük avatar göster */
.avatar-normal {
  display: block;
}

.avatar-minimized {
  display: none;
}

/* Chat minimized iken büyük resmi göster */
.chat-widget.minimized .avatar-normal {
  display: none;
}

.chat-widget.minimized .avatar-minimized {
  display: block;
}

/* Desktop resmi - varsayılan */
.kasim-abi-img-mobile {
  display: none;
}

/* Mobil resmi - mobilde göster */
@media (max-width: 768px) {
  .kasim-abi-img-desktop {
    display: none;
  }

  .kasim-abi-img-mobile {
    display: block;
  }
}

.kasim-abi-info {
  flex: 1;
  min-width: 0;
}

.kasim-abi-name {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
  color: #333;
}

.kasim-abi-status {
  font-size: 11px;
  color: #666;
  display: flex;
  align-items: center;
}

.minimize-btn {
  background: none;
  border: none;
  color: #666;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.minimize-btn:hover {
  background: #f5f5f5;
  color: #333;
}

.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 18px;
  position: relative;
  word-wrap: break-word;
  animation: messageSlide 0.3s ease-out;
}

.message.kasim-abi {
  background: #ffffff;
  color: #333;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e5e5;
}

.message.kasim-abi::before {
  content: "";
  position: absolute;
  left: -8px;
  bottom: 0;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-right-color: #ffffff;
  border-bottom: none;
}

.message.user {
  background: #007aff;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 122, 255, 0.2);
}

.message.user::before {
  content: "";
  position: absolute;
  right: -8px;
  bottom: 0;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-left-color: #007aff;
  border-bottom: none;
}

.message-time {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 5px;
  text-align: right;
}

.message.kasim-abi .message-time {
  text-align: left;
  color: #666;
}

.typing-indicator {
  display: none;
  align-self: flex-start;
  background: #fafafa;
  padding: 12px 16px;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e5e5;
}

.typing-indicator::before {
  content: "";
  position: absolute;
  left: -8px;
  bottom: 0;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-right-color: #ffffff;
  border-bottom: none;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  background: #999;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out;
}

.chat-input-area {
  padding: 16px;
  background: white;
  border-top: 1px solid #f0f0f0;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.input-group {
  position: relative;
}

.form-control {
  border-radius: 8px;
  border: 1px solid #e5e5e5;
  padding: 10px 16px;
  font-size: 14px;
  transition: all 0.2s ease;
  background: #fafafa;
}

.form-control:focus {
  border-color: #007aff;
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
  background: white;
}

.btn-send {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: #007aff;
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all 0.2s ease;
  font-size: 12px;
  z-index: 10; /* input üstünde kal */
}

.form-control:disabled {
  background: #f5f5f5;
  color: #999;
  cursor: not-allowed;
}

.btn-send:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: translateY(-50%);
}

.btn-send:disabled:hover {
  background: #ccc;
  transform: translateY(-50%);
}

.terms-text {
  text-align: center;
  font-size: 10px;
  color: #999;
  margin-top: 12px;
  line-height: 1.3;
}

.terms-text a {
  color: #007aff;
  text-decoration: none;
}

.terms-text a:hover {
  text-decoration: underline;
}

/* Mobil Responsive */
@media (max-width: 768px) {
  .chat-widget {
    /* ÖNCE modern ünite (destekli tarayıcılar) */
    height: 100dvh;
    /* Eski Safari fallback (JS ile beslenen) */
    height: calc(var(--vh, 1vh) * 100);

    width: 100vw;
    bottom: 0;
    left: 0;
    right: 0;
    top: 0;
    max-width: none;
    border-radius: 0;
    padding-bottom: env(safe-area-inset-bottom);
    transform-origin: right bottom;
  }

  .chat-widget.minimized {
    width: 90px;
    height: 120px;
    border-radius: 0%;
    background: transparent;
    border: none;
    box-shadow: none;
    bottom: calc(70px + env(safe-area-inset-bottom));
    right: 20px;
    top: auto;
    left: auto;
    padding-bottom: 0;
    transform-origin: right bottom;
  }

  .chat-header {
    padding: 10px 12px;
  }

  .kasim-abi-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
    margin-right: 10px;
  }

  .kasim-abi-name {
    font-size: 13px;
  }

  .kasim-abi-status {
    font-size: 10px;
  }

  .chat-messages {
    padding: 12px;
  }

  .chat-input-area {
    padding: 12px;
  }
}

/* Safari ve Chrome uyumluluğu */
.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 2px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}

/* Firefox için */
.chat-messages {
  scrollbar-width: thin;
  scrollbar-color: #ddd transparent;
}

/* Animasyonlar */
.message {
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-10px);
  }
}

/* Kasım Abi karakterine özel detaylar */
.kasim-abi-emoji {
  font-size: 14px;
  margin-left: 4px;
}

.discount-badge {
  background: #ff6b6b;
  color: white;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 600;
  margin-left: 4px;
  display: inline-block;
}
