/* Chat Widget CSS - Modern Dark Theme */
/* Neon mavi vurgular, yuvarlatılmış köşeler, minimal tasarım */

:root {
  --chat-primary: #00d4ff;
  --chat-primary-dark: #0099cc;
  --chat-secondary: #1a1a1a;
  --chat-bg: #0f0f0f;
  --chat-surface: #1a1a1a;
  --chat-surface-hover: #2a2a2a;
  --chat-text: #ffffff;
  --chat-text-muted: #888888;
  --chat-border: #333333;
  --chat-success: #00ff88;
  --chat-error: #ff4444;
  --chat-warning: #ffaa00;
  --chat-shadow: 0 8px 32px rgba(0, 212, 255, 0.1);
  --chat-shadow-hover: 0 12px 48px rgba(0, 212, 255, 0.2);
}

/* Chat Widget Ana Container */
.chat-widget {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 600px;
  height: 800px;
  background: var(--chat-bg);
  border: 1px solid var(--chat-border);
  border-radius: 16px;
  box-shadow: var(--chat-shadow);
  z-index: 9999;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: var(--chat-text);
  overflow: hidden;
  transform: translateX(-100%);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
}

.chat-widget.open {
  transform: translateX(0);
  opacity: 1;
}

/* Chat Widget Header */
.chat-widget-header {
  background: linear-gradient(135deg, var(--chat-surface), var(--chat-surface-hover));
  padding: 16px 20px;
  border-bottom: 1px solid var(--chat-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.chat-widget-header:hover {
  background: linear-gradient(135deg, var(--chat-surface-hover), var(--chat-surface));
}

.chat-widget-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 16px;
}

.chat-widget-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 12px;
}

.chat-widget-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--chat-text-muted);
}

.chat-widget-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chat-success);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.chat-widget-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-widget-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--chat-text-muted);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 16px;
}

.chat-widget-btn:hover {
  background: var(--chat-surface-hover);
  color: var(--chat-text);
}

.chat-widget-btn.minimize {
  transform: rotate(180deg);
}

/* Chat Widget Body */
.chat-widget-body {
  height: calc(100% - 60px);
  display: flex;
  flex-direction: column;
}

/* Konuşma Listesi */
.chat-conversations {
  width: 300px;
  background: var(--chat-surface);
  border-right: 1px solid var(--chat-border);
  display: flex;
  flex-direction: column;
}

.chat-conversations-header {
  padding: 16px;
  border-bottom: 1px solid var(--chat-border);
  background: var(--chat-surface-hover);
}

.chat-conversations-title {
  font-weight: 600;
  font-size: 16px;
  color: var(--chat-text);
}

.chat-conversations-list {
  flex: 1;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.chat-conversations-list::-webkit-scrollbar {
  width: 4px;
}

.chat-conversations-list::-webkit-scrollbar-track {
  background: var(--chat-bg);
}

.chat-conversations-list::-webkit-scrollbar-thumb {
  background: var(--chat-border);
  border-radius: 2px;
}

.chat-conversations-list::-webkit-scrollbar-thumb:hover {
  background: var(--chat-primary);
}

.chat-conversation-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--chat-border);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 80px;
}

.chat-conversation-item:hover {
  background: var(--chat-surface-hover);
}

.chat-conversation-item.active {
  background: var(--chat-primary);
  color: white;
}

.chat-conversation-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 16px;
  flex-shrink: 0;
}

.chat-conversation-info {
  flex: 1;
  min-width: 0;
}

.chat-conversation-name {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-conversation-last-message {
  font-size: 14px;
  color: var(--chat-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-conversation-time {
  font-size: 11px;
  color: var(--chat-text-muted);
  margin-top: 4px;
}

.chat-conversation-unread {
  background: var(--chat-primary);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  flex-shrink: 0;
}

/* Chat Mesaj Alanı */
.chat-messages-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 300px;
}

.chat-widget-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  scroll-behavior: smooth;
  font-size: 16px;
}

.chat-widget-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-widget-messages::-webkit-scrollbar-track {
  background: var(--chat-bg);
}

.chat-widget-messages::-webkit-scrollbar-thumb {
  background: var(--chat-border);
  border-radius: 2px;
}

.chat-widget-messages::-webkit-scrollbar-thumb:hover {
  background: var(--chat-primary);
}

/* Message Styles */
.chat-message {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-message.sent {
  align-items: flex-end;
}

.chat-message.received {
  align-items: flex-start;
}

.chat-message-bubble {
  max-width: 85%;
  padding: 16px 20px;
  border-radius: 20px;
  word-wrap: break-word;
  position: relative;
  animation: messageSlide 0.3s ease-out;
  font-size: 16px;
}

@keyframes messageSlide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-message.sent .chat-message-bubble {
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
  color: white;
  border-bottom-right-radius: 4px;
}

.chat-message.received .chat-message-bubble {
  background: var(--chat-surface);
  color: var(--chat-text);
  border: 1px solid var(--chat-border);
  border-bottom-left-radius: 4px;
}

.chat-message-time {
  font-size: 11px;
  color: var(--chat-text-muted);
  margin: 0 8px;
}

.chat-message-status {
  font-size: 10px;
  margin-top: 2px;
  text-align: right;
}

.chat-message-status.delivered {
  color: var(--chat-text-muted);
}

.chat-message-status.read {
  color: var(--chat-primary);
}

/* Typing Indicator */
.chat-typing {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  color: var(--chat-text-muted);
  font-style: italic;
  font-size: 12px;
}

.chat-typing-dots {
  display: flex;
  gap: 2px;
}

.chat-typing-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--chat-primary);
  animation: typingDot 1.4s infinite ease-in-out;
}

.chat-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chat-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingDot {
  0%, 80%, 100% {
    transform: scale(0);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Chat Input */
.chat-widget-input {
  padding: 16px;
  border-top: 1px solid var(--chat-border);
  background: var(--chat-surface);
}

.chat-input-container {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--chat-bg);
  border: 1px solid var(--chat-border);
  border-radius: 28px;
  padding: 12px 20px;
  transition: all 0.2s ease;
  min-height: 50px;
}

.chat-input-container:focus-within {
  border-color: var(--chat-primary);
  box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

.chat-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--chat-text);
  font-size: 16px;
  line-height: 1.4;
  resize: none;
  outline: none;
  min-height: 24px;
  max-height: 120px;
  font-family: inherit;
  padding: 12px;
}

.chat-input::placeholder {
  color: var(--chat-text-muted);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: linear-gradient(135deg, var(--chat-primary), var(--chat-primary-dark));
  color: white;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 18px;
  flex-shrink: 0;
}

.chat-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Minimize özelliği kaldırıldı - sadece kapatma var */

/* Chat Widget Hidden */
.chat-widget.hidden {
  transform: translateY(100%);
  opacity: 0;
}

/* Chat Widget Toggle Button */
.chat-widget-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, #00d4ff, #0099cc);
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  box-shadow: 0 8px 32px rgba(0, 212, 255, 0.3), 0 0 0 1px rgba(0, 212, 255, 0.1);
  z-index: 10000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.chat-widget-toggle:hover {
  transform: scale(1.15);
  box-shadow: 0 12px 48px rgba(0, 212, 255, 0.4), 0 0 0 2px rgba(0, 212, 255, 0.2);
  background: linear-gradient(135deg, #00e6ff, #00aacc);
}

.chat-widget-toggle:active {
  transform: scale(1.05);
}

.chat-widget-toggle.hidden {
  display: none;
}

/* Toggle button her zaman görünür */
.chat-widget-toggle {
  display: flex !important;
}

/* Hidden class'ı sadece widget açıkken çalışsın */
.chat-widget.open ~ .chat-widget-toggle {
  display: none !important;
}

/* Chat Button Animasyon Efektleri */
.chat-widget-toggle::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
}

.chat-widget-toggle:hover::before {
  width: 100%;
  height: 100%;
}

/* Pulse animasyonu */
@keyframes chatPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 212, 255, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(0, 212, 255, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 212, 255, 0);
  }
}

.chat-widget-toggle.pulse {
  animation: chatPulse 2s infinite;
}

/* Notification Badge */
.chat-notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--chat-error);
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  animation: notificationPulse 1s infinite;
}

@keyframes notificationPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Loading States */
.chat-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--chat-text-muted);
}

.chat-loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--chat-border);
  border-top: 2px solid var(--chat-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Error States */
.chat-error {
  background: var(--chat-error);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  margin: 8px 16px;
  font-size: 12px;
  text-align: center;
}

/* Success States */
.chat-success {
  background: var(--chat-success);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  margin: 8px 16px;
  font-size: 12px;
  text-align: center;
}

/* Responsive Design */
@media (max-width: 480px) {
  .chat-widget {
    width: calc(100vw - 40px);
    height: calc(100vh - 40px);
    bottom: 20px;
    right: 20px;
    left: 20px;
  }
  
  .chat-widget-toggle {
    bottom: 20px;
    right: 20px;
  }
}

/* Dark mode optimizations */
@media (prefers-color-scheme: dark) {
  :root {
    --chat-bg: #0a0a0a;
    --chat-surface: #1a1a1a;
    --chat-surface-hover: #2a2a2a;
  }
}

/* Accessibility */
.chat-widget:focus-within {
  outline: 2px solid var(--chat-primary);
  outline-offset: 2px;
}

.chat-widget-btn:focus,
.chat-send-btn:focus,
.chat-widget-toggle:focus {
  outline: 2px solid var(--chat-primary);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --chat-border: #666666;
    --chat-text-muted: #cccccc;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .chat-widget,
  .chat-widget-toggle,
  .chat-message-bubble,
  .chat-typing-dot,
  .chat-notification-badge {
    animation: none;
    transition: none;
  }
}
