/**
 * The Madison Tattoo Company - Chatbot Widget Styles
 * Dark theme with gold accents
 */

/* CSS Custom Properties for theming */
:root {
  --mtc-bg: #0F0F0F;
  --mtc-bg-secondary: #1a1a1a;
  --mtc-bg-tertiary: #252525;
  --mtc-text: #F5F5F3;
  --mtc-text-muted: rgba(245, 245, 243, 0.7);
  --mtc-accent: #c9a227;
  --mtc-accent-hover: #d4b03a;
  --mtc-user-bg: #c9a227;
  --mtc-user-text: #0F0F0F;
  --mtc-bot-bg: #252525;
  --mtc-border: rgba(245, 245, 243, 0.12);
  --mtc-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  --mtc-radius: 16px;
  --mtc-radius-sm: 12px;
  --mtc-transition: 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --mtc-font: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Base widget container */
#mtc-chatbot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: var(--mtc-font);
  font-size: 14px;
  line-height: 1.5;
}

/* Toggle button */
.mtc-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--mtc-accent);
  color: var(--mtc-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--mtc-shadow);
  transition: background var(--mtc-transition), transform var(--mtc-transition);
}

.mtc-toggle:hover {
  background: var(--mtc-accent-hover);
  transform: scale(1.05);
}

.mtc-toggle:focus-visible {
  outline: 3px solid var(--mtc-accent);
  outline-offset: 3px;
}

.mtc-toggle svg {
  width: 24px;
  height: 24px;
  transition: opacity var(--mtc-transition), transform var(--mtc-transition);
}

.mtc-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg);
}

#mtc-chatbot.mtc-open .mtc-icon-chat {
  opacity: 0;
  transform: rotate(90deg);
}

#mtc-chatbot.mtc-open .mtc-icon-close {
  opacity: 1;
  transform: rotate(0deg);
}

/* Chat window */
.mtc-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 380px;
  height: 520px;
  background: var(--mtc-bg);
  border-radius: var(--mtc-radius);
  box-shadow: var(--mtc-shadow);
  border: 1px solid var(--mtc-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: opacity var(--mtc-transition), transform var(--mtc-transition), visibility var(--mtc-transition);
}

#mtc-chatbot.mtc-open .mtc-window {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.mtc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--mtc-bg-secondary);
  border-bottom: 1px solid var(--mtc-border);
  flex-shrink: 0;
}

.mtc-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mtc-header-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--mtc-text);
}

.mtc-header-subtitle {
  font-size: 12px;
  color: var(--mtc-text-muted);
}

.mtc-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--mtc-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--mtc-transition), color var(--mtc-transition);
}

.mtc-close:hover {
  background: var(--mtc-bg-tertiary);
  color: var(--mtc-text);
}

.mtc-close:focus-visible {
  outline: 2px solid var(--mtc-accent);
  outline-offset: 2px;
}

.mtc-close svg {
  width: 18px;
  height: 18px;
}

/* Messages area */
.mtc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

/* Scrollbar styling */
.mtc-messages::-webkit-scrollbar {
  width: 6px;
}

.mtc-messages::-webkit-scrollbar-track {
  background: transparent;
}

.mtc-messages::-webkit-scrollbar-thumb {
  background: var(--mtc-border);
  border-radius: 3px;
}

.mtc-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(245, 245, 243, 0.2);
}

/* Message bubbles */
.mtc-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--mtc-radius-sm);
  word-wrap: break-word;
  animation: mtc-fade-in 0.2s ease-out;
}

@keyframes mtc-fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mtc-bot {
  background: var(--mtc-bot-bg);
  color: var(--mtc-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

/* Links in bot messages */
.mtc-bot a {
  color: var(--mtc-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--mtc-transition);
}

.mtc-bot a:hover {
  color: var(--mtc-accent-hover);
}

.mtc-bot a:focus-visible {
  outline: 2px solid var(--mtc-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.mtc-user {
  background: var(--mtc-user-bg);
  color: var(--mtc-user-text);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.mtc-typing {
  padding: 12px 16px;
}

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

.mtc-typing-dots span {
  width: 8px;
  height: 8px;
  background: var(--mtc-text-muted);
  border-radius: 50%;
  animation: mtc-typing-bounce 1.4s infinite ease-in-out both;
}

.mtc-typing-dots span:nth-child(1) {
  animation-delay: -0.32s;
}

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

@keyframes mtc-typing-bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Quick replies */
.mtc-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--mtc-border);
  background: var(--mtc-bg-secondary);
  transition: opacity var(--mtc-transition), max-height var(--mtc-transition);
  max-height: 150px;
  overflow: hidden;
}

.mtc-quick-replies.mtc-hidden {
  opacity: 0;
  max-height: 0;
  padding: 0 16px;
  pointer-events: none;
}

.mtc-quick-btn {
  padding: 8px 12px;
  border-radius: 20px;
  border: 1px solid var(--mtc-border);
  background: transparent;
  color: var(--mtc-text);
  font-size: 12px;
  font-family: var(--mtc-font);
  cursor: pointer;
  transition: background var(--mtc-transition), border-color var(--mtc-transition);
}

.mtc-quick-btn:hover {
  background: var(--mtc-bg-tertiary);
  border-color: var(--mtc-accent);
}

.mtc-quick-btn:focus-visible {
  outline: 2px solid var(--mtc-accent);
  outline-offset: 2px;
}

/* Input area */
.mtc-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--mtc-border);
  background: var(--mtc-bg-secondary);
  flex-shrink: 0;
}

.mtc-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 24px;
  border: 1px solid var(--mtc-border);
  background: var(--mtc-bg);
  color: var(--mtc-text);
  font-size: 14px;
  font-family: var(--mtc-font);
  outline: none;
  transition: border-color var(--mtc-transition);
}

.mtc-input::placeholder {
  color: var(--mtc-text-muted);
}

.mtc-input:focus {
  border-color: var(--mtc-accent);
}

.mtc-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--mtc-accent);
  color: var(--mtc-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--mtc-transition), transform var(--mtc-transition);
}

.mtc-send:hover {
  background: var(--mtc-accent-hover);
  transform: scale(1.05);
}

.mtc-send:focus-visible {
  outline: 2px solid var(--mtc-accent);
  outline-offset: 2px;
}

.mtc-send svg {
  width: 18px;
  height: 18px;
}

/* Mobile responsive */
@media (max-width: 480px) {
  #mtc-chatbot {
    bottom: 16px;
    right: 16px;
  }

  .mtc-window {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: calc(100vh - 80px);
    max-height: 100%;
    border-radius: var(--mtc-radius) var(--mtc-radius) 0 0;
    transform: translateY(100%);
  }

  #mtc-chatbot.mtc-open .mtc-window {
    transform: translateY(0);
  }

  .mtc-toggle {
    width: 52px;
    height: 52px;
  }

  .mtc-message {
    max-width: 90%;
  }

  .mtc-quick-replies {
    max-height: 120px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .mtc-toggle,
  .mtc-toggle svg,
  .mtc-window,
  .mtc-close,
  .mtc-quick-btn,
  .mtc-input,
  .mtc-send,
  .mtc-quick-replies {
    transition: none;
  }

  .mtc-message {
    animation: none;
  }

  .mtc-typing-dots span {
    animation: none;
    opacity: 0.7;
    transform: scale(0.8);
  }

  .mtc-messages {
    scroll-behavior: auto;
  }
}

/* Hide on print */
@media print {
  #mtc-chatbot {
    display: none !important;
  }
}
