/* NoryaAI Müşteri İletişim Merkezi — Chat Widget */

.norya-chat-btn {
  position: fixed;
  bottom: calc(100px + env(safe-area-inset-bottom));
  right: 20px;
  z-index: 9998;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0EA5A4 0%, #0d9488 100%);
  border: 3px solid rgba(255, 255, 255, 0.9);
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(14, 165, 164, 0.45), 0 0 0 0 rgba(14, 165, 164, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  animation: noryaChatPulse 3s ease-in-out infinite;
}
.norya-chat-btn:hover {
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 12px 40px rgba(14, 165, 164, 0.55);
  animation: none;
}
.norya-chat-btn.open {
  animation: none;
}
.norya-chat-btn svg {
  width: 30px;
  height: 30px;
  fill: #fff;
}
@keyframes noryaChatPulse {
  0%, 100% { box-shadow: 0 8px 32px rgba(14, 165, 164, 0.45), 0 0 0 0 rgba(14, 165, 164, 0.3); }
  50% { box-shadow: 0 8px 32px rgba(14, 165, 164, 0.45), 0 0 0 10px rgba(14, 165, 164, 0); }
}
.norya-chat-btn .norya-chat-close-icon { display: none; }
.norya-chat-btn.open .norya-chat-open-icon { display: none; }
.norya-chat-btn.open .norya-chat-close-icon { display: block; }

.norya-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid #fff;
  display: block;
}
.norya-chat-btn.open .norya-chat-badge {
  display: none;
}

/* Panel */
.norya-chat-panel {
  position: fixed;
  bottom: calc(176px + env(safe-area-inset-bottom));
  right: 20px;
  z-index: 9999;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 140px);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(148, 163, 184, 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}
.norya-chat-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.norya-chat-header {
  background: linear-gradient(135deg, #0EA5A4 0%, #0d9488 100%);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.norya-chat-header-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}
.norya-chat-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.norya-chat-header-info {
  flex: 1;
  min-width: 0;
}
.norya-chat-header-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}
.norya-chat-header-status {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 2px;
}
.norya-chat-header-status::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  margin-right: 5px;
  vertical-align: middle;
}

/* Messages area */
.norya-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}
.norya-chat-messages::-webkit-scrollbar { width: 4px; }
.norya-chat-messages::-webkit-scrollbar-track { background: transparent; }
.norya-chat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Message bubbles */
.norya-chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  animation: noryaChatFadeIn 0.3s ease;
}
.norya-chat-msg a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.norya-chat-msg-assistant {
  align-self: flex-start;
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 6px;
}
.norya-chat-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #0EA5A4 0%, #0d9488 100%);
  color: #fff;
  border-bottom-right-radius: 6px;
}

/* Typing indicator */
.norya-chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 5px;
  padding: 14px 18px;
  background: #f1f5f9;
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  animation: noryaChatFadeIn 0.3s ease;
}
.norya-chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  animation: noryaChatTypingDot 1.4s infinite;
}
.norya-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.norya-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

/* Quick questions */
.norya-chat-quick {
  padding: 8px 16px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  border-top: 1px solid #f1f5f9;
}
.norya-chat-quick button {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.norya-chat-quick button:hover {
  background: #e0f2f1;
  border-color: #0EA5A4;
  color: #0d9488;
}

/* Input area */
.norya-chat-input-area {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #e2e8f0;
  background: #fafbfc;
  flex-shrink: 0;
}
.norya-chat-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  outline: none;
  max-height: 80px;
  min-height: 40px;
  background: #fff;
  color: #1e293b;
  transition: border-color 0.15s;
}
.norya-chat-input:focus {
  border-color: #0EA5A4;
}
.norya-chat-input::placeholder {
  color: #94a3b8;
}
.norya-chat-send {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #0EA5A4 0%, #0d9488 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.norya-chat-send:hover { transform: scale(1.05); }
.norya-chat-send:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.norya-chat-send svg { width: 18px; height: 18px; fill: #fff; }

/* WhatsApp link in panel */
.norya-chat-wa-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  background: #f8faf8;
  border-top: 1px solid #e2e8f0;
  font-size: 12px;
  color: #64748b;
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.norya-chat-wa-link:hover { background: #ecfdf5; color: #16a34a; }
.norya-chat-wa-link svg { width: 16px; height: 16px; fill: #25D366; }

/* Animations */
@keyframes noryaChatFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes noryaChatTypingDot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .norya-chat-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    border-radius: 0;
  }
  .norya-chat-btn {
    bottom: calc(80px + env(safe-area-inset-bottom));
    right: 16px;
    width: 60px;
    height: 60px;
  }
}
