/* Modern Developer Chatbot - Sleek Dark Theme */

.gpt-mini {
  display: flex;
  flex-direction: column;
  width: 380px;
  height: 520px;
  background: linear-gradient(145deg, #0f0f0f 0%, #1a1a1a 100%);
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(0, 255, 65, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  color: #e8e8e8;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  backdrop-filter: blur(20px);
  transition: all 0.3s ease;
}

.floating-chat {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
}

.floating-chat:hover .gpt-mini {
  transform: translateY(-2px);
  box-shadow: 
    0 25px 50px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(0, 255, 65, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Modern Header with Shipibo Pattern */
.gpt-mini .header {
  background: linear-gradient(135deg, #00ff41 0%, #00cc33 100%);
  color: #000000;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.95rem;
  position: relative;
  border-bottom: 1px solid rgba(0, 255, 65, 0.3);
  overflow: hidden;
  cursor: move;
  user-select: none;
}

.drag-handle {
  font-size: 18px;
  font-weight: bold;
  cursor: grab;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  color: rgba(0, 0, 0, 0.6);
}

.drag-handle:hover {
  background: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.8);
}

.drag-handle:active {
  cursor: grabbing;
}

.header-title {
  flex: 1;
  text-align: center;
}

.header-controls {
  display: flex;
  gap: 8px;
}

.minimize-btn {
  background: rgba(0, 0, 0, 0.1);
  border: none;
  color: #000000;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.2s ease;
}

.minimize-btn:hover {
  background: rgba(0, 0, 0, 0.2);
  transform: scale(1.1);
}

.close-btn {
  background: rgba(255, 0, 0, 0.1);
  border: none;
  color: #000000;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.2s ease;
  margin-left: 4px;
}

.close-btn:hover {
  background: rgba(255, 0, 0, 0.3);
  transform: scale(1.1);
}

.chat-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  transition: all 0.3s ease;
}

.gpt-mini.minimized .chat-body {
  height: 0;
  overflow: hidden;
}

.gpt-mini.minimized {
  height: auto;
}

.gpt-mini .header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    repeating-linear-gradient(45deg,
      transparent 0px,
      transparent 3px,
      rgba(0, 0, 0, 0.1) 3px,
      rgba(0, 0, 0, 0.1) 6px
    ),
    repeating-linear-gradient(-45deg,
      transparent 0px,
      transparent 8px,
      rgba(0, 0, 0, 0.05) 8px,
      rgba(0, 0, 0, 0.05) 16px
    );
  z-index: 1;
}

.gpt-mini .header::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 0;
  right: 0;
  height: 2px;
  background: repeating-linear-gradient(90deg,
    rgba(0, 0, 0, 0.2) 0px,
    rgba(0, 0, 0, 0.2) 4px,
    transparent 4px,
    transparent 8px,
    rgba(0, 0, 0, 0.1) 8px,
    rgba(0, 0, 0, 0.1) 12px,
    transparent 12px,
    transparent 20px
  );
  z-index: 2;
}

.gpt-mini .header > * {
  position: relative;
  z-index: 3;
}

/* Chat History Area */
.gpt-mini .history {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: linear-gradient(145deg, #0a0a0a 0%, #111111 100%);
  font-size: 0.9rem;
  line-height: 1.5;
  scroll-behavior: smooth;
}

.gpt-mini .history::-webkit-scrollbar {
  width: 4px;
}

.gpt-mini .history::-webkit-scrollbar-track {
  background: transparent;
}

.gpt-mini .history::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #00ff41, #00cc33);
  border-radius: 2px;
}

.gpt-mini .history::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #39ff14, #00ff41);
}

/* Modern Message Bubbles */
.message {
  margin-bottom: 16px;
  max-width: 85%;
  word-wrap: break-word;
  animation: messageSlideIn 0.3s ease-out;
}

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

.message.user {
  margin-left: auto;
  text-align: right;
}

.message.user .bubble {
  background: linear-gradient(135deg, #00ff41 0%, #00cc33 100%);
  color: #000000;
  padding: 12px 16px;
  border-radius: 18px 18px 4px 18px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0, 255, 65, 0.2);
}

.message.assistant .bubble {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  color: #e8e8e8;
  padding: 12px 16px;
  border-radius: 18px 18px 18px 4px;
  border: 1px solid #333333;
  position: relative;
}

.message.assistant .bubble::before {
  content: '';
  position: absolute;
  left: -1px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #00ff41, #00cc33);
  border-radius: 0 2px 2px 0;
}

.message.system {
  text-align: center;
  opacity: 0.7;
}

.message.system .bubble {
  background: rgba(0, 255, 65, 0.1);
  color: #00cc33;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-style: italic;
  border: 1px solid rgba(0, 255, 65, 0.2);
  display: inline-block;
}

/* Modern Input Area */
.gpt-mini .input-area {
  display: flex;
  padding: 16px 20px;
  background: linear-gradient(145deg, #111111 0%, #1a1a1a 100%);
  border-top: 1px solid #2a2a2a;
  gap: 12px;
  align-items: flex-end;
}

.gpt-mini input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid #333333;
  border-radius: 12px;
  background: #0a0a0a;
  color: #e8e8e8;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
  resize: none;
  min-height: 20px;
  max-height: 80px;
}

.gpt-mini input:focus {
  border-color: #00ff41;
  box-shadow: 0 0 0 3px rgba(0, 255, 65, 0.1);
  background: #111111;
}

.gpt-mini input::placeholder {
  color: #666666;
}

.gpt-mini button {
  padding: 12px 16px;
  background: linear-gradient(135deg, #00ff41 0%, #00cc33 100%);
  color: #000000;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  min-width: 50px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gpt-mini button:hover {
  background: linear-gradient(135deg, #39ff14 0%, #00ff41 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 255, 65, 0.3);
}

.gpt-mini button:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 255, 65, 0.2);
}

.gpt-mini button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Modern Toggle Button */
.chat-toggle-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #00ff41 0%, #00cc33 100%);
  color: #000000;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 
    0 8px 24px rgba(0, 255, 65, 0.3),
    0 4px 8px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.chat-toggle-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chat-toggle-btn:hover {
  background: linear-gradient(135deg, #39ff14 0%, #00ff41 100%);
  transform: scale(1.05);
  box-shadow: 
    0 12px 32px rgba(0, 255, 65, 0.4),
    0 6px 12px rgba(0, 0, 0, 0.3);
}

.chat-toggle-btn:hover::before {
  opacity: 1;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #00cc33;
  font-style: italic;
  font-size: 0.85rem;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00ff41;
  animation: typingPulse 1.4s ease-in-out infinite;
}

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

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

@keyframes typingPulse {
  0%, 60%, 100% {
    opacity: 0.3;
    transform: scale(0.8);
  }
  30% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Reopen Button Styles */
.reopen-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: linear-gradient(145deg, #0f0f0f 0%, #1a1a1a 100%);
  border: 2px solid rgba(0, 255, 65, 0.3);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  transition: all 0.3s ease;
  opacity: 0.7;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: gentlePulse 3s ease-in-out infinite;
}

.reopen-btn:hover {
  opacity: 1;
  transform: scale(1.1);
  border-color: rgba(0, 255, 65, 0.6);
  box-shadow: 0 6px 25px rgba(0, 255, 65, 0.2);
  animation: none;
}

.reopen-icon {
  font-size: 24px;
  transition: transform 0.2s ease;
}

.reopen-btn:hover .reopen-icon {
  transform: scale(1.2);
}

.reopen-tooltip {
  position: absolute;
  bottom: 70px;
  right: 0;
  background: rgba(0, 0, 0, 0.9);
  color: #00ff41;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  pointer-events: none;
  border: 1px solid rgba(0, 255, 65, 0.2);
}

.reopen-btn:hover .reopen-tooltip {
  opacity: 1;
  transform: translateY(0);
}

@keyframes gentlePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(0, 255, 65, 0.1);
  }
}

/* Widget close/open animations */
.floating-chat.closed {
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  pointer-events: none;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .floating-chat {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    top: auto;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .floating-chat.chat-open {
    transform: translateY(0);
  }
  
  .gpt-mini {
    width: 100%;
    height: 75vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    max-height: 600px;
  }
  
  .chat-toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1001;
  }
  
  .gpt-mini .input-area {
    padding: 16px 20px 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
  .gpt-mini {
    backdrop-filter: blur(30px);
  }
}