/* ============================================
   Webty Chatbot - Clean UI Styles
   ============================================ */

/* Variables */
:root {
  --webty-primary: #201F5A;
  --webty-secondary: #F26228;
  --webty-gradient: linear-gradient(135deg, #201F5A 0%, #F26228 100%);
  --webty-gradient-hover: linear-gradient(135deg, #2a2970 0%, #ff7538 100%);
  --webty-bg: #ffffff;
  --webty-bg-light: #f8f9fa;
  --webty-text: #1a1a1a;
  --webty-text-light: #6c757d;
  --webty-border: rgba(0, 0, 0, 0.08);
  --webty-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  --webty-shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.25);
  --webty-radius: 20px;
  --webty-radius-sm: 12px;
  --webty-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* FAB Button */
#webty-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 64px;
  height: 64px;
  border: none;
  cursor: pointer;
  z-index: 999999;
  background: transparent;
  background-image: url("https://www.webtymize.com/wp-content/uploads/2025/10/Sanal-Asistan-Webty.webp");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 0 15px rgba(242, 98, 40, 0.4));
  animation: gentleGlow 2s ease-in-out infinite;
}

@keyframes gentleGlow {
  0%, 100% {
    filter: drop-shadow(0 0 15px rgba(242, 98, 40, 0.4));
  }
  50% {
    filter: drop-shadow(0 0 25px rgba(242, 98, 40, 0.6));
  }
}

#webty-fab:hover {
  transform: scale(1.1);
  animation: none;
}

#webty-fab:active {
  transform: scale(0.95);
}

/* Panel Container */
#webty-panel {
  position: fixed;
  right: 24px;
  bottom: 100px;
  width: 360px;
  max-width: calc(100vw - 48px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--webty-bg);
  border-radius: var(--webty-radius);
  border: none;
  box-shadow: var(--webty-shadow-lg);
  z-index: 999998;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  backdrop-filter: blur(10px);
  /* Mobilde scroll davranışını kontrol et */
  touch-action: pan-y;
}

/* States */
.webty-hidden {
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: var(--webty-transition);
}

.webty-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  transition: var(--webty-transition);
}

/* Header */
.webty-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  color: #fff;
  background: var(--webty-gradient);
  padding: 0 20px;
  box-shadow: none;
  flex-shrink: 0;
  border-radius: 0;
  margin: 0;
}

.webty-title {
  font-size: 20px;
  font-weight: 700;
  flex: 1;
  text-align: left;
  position: relative;
  z-index: 1;
  padding: 0;
  box-sizing: border-box;
}

.webty-header-buttons {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
  flex-wrap: nowrap;
}

.webty-x {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--webty-transition);
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.webty-x:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}


/* Messages Area */
.webty-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  background: var(--webty-bg-light);
  scroll-behavior: smooth;
  overscroll-behavior: contain;      /* 1. Kaydırmayı bu kutunun içine hapseder, siteyi kaydırmaz */
  -webkit-overflow-scrolling: touch; /* 2. Mobilde (iOS/Android) takılmadan akıcı kaymasını sağlar */
  touch-action: pan-y;
}

.webty-messages::-webkit-scrollbar {
  width: 8px;
}

.webty-messages::-webkit-scrollbar-track {
  background: rgba(242, 98, 40, 0.05);
  border-radius: 4px;
}

.webty-messages::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #F26228 0%, #201F5A 100%);
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Message Wrapper */
.webty-message-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 12px 0;
  animation: slideIn 0.3s ease-out;
  width: 100%;
}

.webty-wrapper-user {
  align-items: flex-end;
}

/* İçerik Satırı (Avatar + Balon) */
.webty-msg-row {
  display: flex;
  gap: 10px;
  max-width: 85%;
  align-items: flex-end;
}

.webty-row-bot {
  justify-content: flex-start;
}

.webty-row-user {
  justify-content: flex-end;
}

/* Avatar */
.webty-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background-image: url("https://www.webtymize.com/wp-content/uploads/2025/10/Sanal-Asistan-Webty.webp");
  background-size: contain;
  flex-shrink: 0;
  background-position: center;
  background-repeat: no-repeat;
}

/* Bubbles */
.webty-bubble {
  padding: 14px 18px;
  border-radius: var(--webty-radius-sm);
  line-height: 1.6;
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  position: relative;
  word-wrap: break-word;
  max-width: 100%;
}

.webty-bot {
  background: linear-gradient(135deg, #F26228 0%, #ff7538 100%);
  color: #fff;
  border-top-left-radius: 4px;
}

.webty-user {
  background: linear-gradient(135deg, #201F5A 0%, #2a2970 100%);
  color: #fff;
  border-top-right-radius: 4px;
  text-align: right;
}

/* Butonlar */
.webty-btn-container {
  margin-top: 8px;
  margin-left: 46px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: calc(85% - 46px);
}

.webty-link-btn {
  display: inline-block;
  padding: 8px 14px;
  background-color: #fff;
  color: var(--webty-primary);
  border: 1px solid var(--webty-primary);
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  outline: none;
  font-family: inherit;
}

.webty-link-btn:hover {
  background-color: var(--webty-primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.webty-link-btn:active {
  transform: translateY(0);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Typing */
.webty-typing {
  display: inline-flex;
  gap: 4px;
  padding: 14px 18px;
  background: linear-gradient(135deg, #F26228 0%, #ff7538 100%);
  border-radius: var(--webty-radius-sm);
  border-top-left-radius: 4px;
}

.webty-typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: typing 1.4s infinite;
}

.webty-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.webty-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0%, 60%, 100% {
    opacity: 0.7;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-5px);
  }
}

/* Input */
.webty-input {
  display: flex;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--webty-border);
  background: var(--webty-bg);
  flex-shrink: 0;
}

#webty-input {
  flex: 1;
  padding: 14px 18px;
  border-radius: var(--webty-radius-sm);
  border: 2px solid var(--webty-border);
  outline: none;
  background: var(--webty-bg-light);
  font-size: 15px;
  font-family: inherit;
  color: var(--webty-text);
  /* Mobilde zoom'u engelle */
  touch-action: manipulation;
}

#webty-input::placeholder {
  color: var(--webty-text-light);
}

#webty-input:focus {
  border-color: var(--webty-secondary);
  background: #fff;
  /* Focus'ta scroll'u engelle */
  scroll-margin: 0;
}

#webty-send {
  width: 48px;
  height: 48px;
  border-radius: var(--webty-radius-sm);
  border: 0;
  cursor: pointer;
  background: var(--webty-gradient);
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--webty-transition);
  flex-shrink: 0;
}

#webty-send:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(242, 98, 40, 0.4);
}

#webty-send:active {
  transform: translateY(0);
}

/* Overlay */
.webty-overlay {
  position: fixed;
  inset: 0;
  z-index: 999997;
  background: transparent;
  transition: var(--webty-transition);
}

/* Mobile */
@media (max-width: 520px) {
  /* Body scroll'unu kilitle - panel açıkken */
  body:has(#webty-panel.webty-visible) {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }
  
  #webty-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 85vh;
    max-height: 85vh;
    border-radius: 20px 20px 0 0;
    /* Klavye açıldığında panelin sabit kalması için */
    position: fixed !important;
  }

  #webty-fab {
    right: 16px;
    bottom: 16px;
    width: 56px;
    height: 56px;
  }
  
  /* Panel açıkken FAB'ı gizle - daha iyi bir yöntem */
  #webty-panel.webty-visible ~ #webty-fab {
    opacity: 0;
    transform: scale(0.5) translateY(20px);
    pointer-events: none;
  }

  .webty-header {
    height: 60px;
    padding: 0 12px;
  }

  .webty-title {
    font-size: 18px;
    padding: 0 100px 0 12px;
  }
  
  .webty-header-buttons {
    right: 8px;
    gap: 6px;
    flex-wrap: nowrap;
  }
  
  .webty-end-chat-btn {
    padding: 4px 8px;
    height: 24px;
    font-size: 11px;
  }
  
  .webty-end-chat-text {
    font-size: 11px;
  }
  
  /* Küçük ekranlarda buton metnini kısalt */
  @media (max-width: 360px) {
    .webty-end-chat-text {
      display: none;
    }
    
    .webty-end-chat-btn {
      width: 24px;
      padding: 4px;
    }
    
    .webty-end-chat-btn::before {
      content: "✕";
      font-size: 14px;
    }
  }

  .webty-x {
    width: 24px;
    height: 24px;
    font-size: 16px;
  }
  
  .webty-header-buttons {
    right: 8px;
    gap: 6px;
    flex-wrap: nowrap;
  }
  
  .webty-end-chat-btn {
    padding: 5px 10px;
    height: 26px;
    font-size: 12px;
    min-width: auto;
  }
  
  .webty-end-chat-text {
    font-size: 12px;
  }
  
  .webty-x {
    width: 26px;
    height: 26px;
    font-size: 18px;
    flex-shrink: 0;
  }

  .webty-messages {
    padding: 16px;
  }

  .webty-msg-row {
    max-width: 90%;
  }

  .webty-avatar {
    width: 32px;
    height: 32px;
    min-width: 32px;
  }

  .webty-bubble {
    padding: 12px 16px;
    font-size: 14px;
  }

  .webty-btn-container {
    margin-left: 42px;
    max-width: calc(90% - 42px);
  }

  .webty-link-btn {
    padding: 7px 12px;
    font-size: 12px;
  }

  .webty-input {
    padding: 12px;
    gap: 8px;
  }

  #webty-input {
    padding: 12px 16px;
    font-size: 14px;
    /* Mobil Safari'de zoom'u önle */
    font-size: 16px;
  }

  #webty-send {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
}

/* Tablet */
@media (max-width: 768px) and (min-width: 521px) {
  #webty-panel {
    width: 360px;
    height: 550px;
  }

  .webty-msg-row {
    max-width: 88%;
  }

  .webty-btn-container {
    max-width: calc(88% - 46px);
  }
}

/* Small mobile devices */
@media (max-width: 360px) {
  #webty-panel {
    height: 90vh;
    max-height: 90vh;
  }

  .webty-header {
    height: 56px;
  }

  .webty-title {
    font-size: 16px;
  }

  .webty-messages {
    padding: 12px;
  }

  .webty-msg-row {
    max-width: 92%;
  }

  .webty-bubble {
    padding: 10px 14px;
    font-size: 13px;
  }

  .webty-btn-container {
    margin-left: 38px;
    max-width: calc(92% - 38px);
    gap: 6px;
  }

  .webty-link-btn {
    padding: 6px 10px;
    font-size: 11px;
  }
}
/* YENİ: İsim Formu */
.webty-name-prompt {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.webty-name-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

.webty-name-box {
  position: relative;
  background: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  text-align: center;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.webty-name-box h3 {
  margin: 0 0 10px 0;
  color: #201F5A;
  font-size: 24px;
}

.webty-name-box p {
  margin: 0 0 20px 0;
  color: #6c757d;
  font-size: 15px;
}

#webty-user-name {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  font-size: 16px;
  margin-bottom: 20px;
  transition: border-color 0.2s;
}

#webty-user-name:focus {
  outline: none;
  border-color: #F26228;
}

#webty-name-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #201F5A 0%, #F26228 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

#webty-name-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(242, 98, 40, 0.4);
}

#webty-name-submit:active {
  transform: translateY(0);
}

/* YENİ: İsim Modal */
.webty-name-modal {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.webty-name-content {
  background: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 450px;
  width: 90%;
  text-align: center;
  animation: slideUp 0.4s ease;
  position: relative;
}

/* X Kapatma Butonu */
.webty-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(220, 53, 69, 0.1);
  color: #dc3545;
  font-size: 24px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 300;
}

.webty-modal-close:hover {
  background: #dc3545;
  color: white;
  transform: rotate(90deg);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.webty-name-content h3 {
  margin: 0 0 10px 0;
  color: #201F5A;
  font-size: 24px;
  font-weight: 700;
}

.webty-name-content p {
  margin: 0 0 25px 0;
  color: #6c757d;
  font-size: 15px;
}

#webty-name-input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  font-size: 16px;
  margin-bottom: 15px;
  box-sizing: border-box;
  transition: all 0.2s;
  font-family: inherit;
}

#webty-name-input:focus {
  outline: none;
  border-color: #F26228;
  box-shadow: 0 0 0 3px rgba(242, 98, 40, 0.1);
}

#webty-name-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #201F5A 0%, #F26228 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

#webty-name-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(242, 98, 40, 0.4);
}

#webty-name-submit:active {
  transform: translateY(0);
}

/* Mobilde modal */
@media (max-width: 520px) {
  .webty-name-content {
    padding: 30px 20px;
  }
  
  .webty-name-content h3 {
    font-size: 20px;
  }
}
/* Email ve Telefon inputları için stiller */
#webty-email-input,
#webty-phone-input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  font-size: 16px;
  margin-bottom: 15px;
  transition: all 0.2s;
  font-family: inherit;
  box-sizing: border-box;
}

#webty-email-input:focus,
#webty-phone-input:focus {
  outline: none;
  border-color: #F26228;
  box-shadow: 0 0 0 3px rgba(242, 98, 40, 0.1);
}

/* KVKK Checkbox Label */
.webty-kvkk-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  margin-bottom: 20px;
  cursor: pointer;
  font-size: 13px;
  color: #6c757d;
  line-height: 1.5;
}

.webty-kvkk-label input[type="checkbox"] {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.webty-kvkk-label a {
  color: #F26228;
  text-decoration: underline;
  font-weight: 600;
}

.webty-kvkk-label a:hover {
  color: #201F5A;
}


/* Mobilde Görüşmeyi Sonlandır butonu */
@media (max-width: 520px) {
  .webty-end-chat-btn {
    padding: 10px 14px;
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .webty-end-chat-btn {
    padding: 10px 12px;
    font-size: 11px;
  }
}
/* Header'daki Görüşmeyi Sonlandır Butonu */
.webty-header .webty-end-chat-btn {
  background: rgba(220, 53, 69, 0.9);
  color: #fff;
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--webty-transition);
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
  white-space: nowrap;
  height: 26px;
  flex-shrink: 0;
  margin-right: 8px;
}

.webty-header .webty-end-chat-btn:hover {
  background: #dc3545;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.webty-header .webty-end-chat-btn:active {
  transform: translateY(0);
}

.webty-header .webty-end-chat-btn.webty-hidden {
  display: none;
}
