/*
 * Chatbot Widget Styles
 * sukcesytoprocesy.pl
 * Matches existing design system
 */

:root {
  --stp-beige: #E4D6B3;
  --stp-terracotta: #C26F51;
  --stp-text-dark: #2C2C2C;
  --stp-text-medium: #5A5A5A;
  --stp-white: #FFFFFF;
}

/* =====================================
   CHATBOT CONTAINER
   ===================================== */

.stp-chatbot-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'Work Sans', sans-serif;
}

/* =====================================
   CHAT TRIGGER BUTTON
   ===================================== */

.stp-chat-trigger {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--stp-terracotta);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  animation: pulseGlow 2.5s ease-in-out infinite;
}

.stp-chat-trigger:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.stp-chat-trigger svg {
  width: 28px;
  height: 28px;
  fill: var(--stp-white);
}

.stp-chat-trigger.hidden {
  display: none;
}

/* =====================================
   CHAT WINDOW
   ===================================== */

.stp-chat-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 500px;
  height: 730px;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  background: var(--stp-white);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.stp-chat-window.open {
  display: flex;
}

/* =====================================
   CHAT HEADER
   ===================================== */

.stp-chat-header {
  background: var(--stp-beige);
  padding: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stp-mode-tabs {
  display: flex;
  gap: 8px;
}

.stp-tab {
  background: transparent;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--stp-text-medium);
  cursor: pointer;
  transition: all 0.2s;
}

.stp-tab:hover {
  background: rgba(0, 0, 0, 0.05);
}

.stp-tab.active {
  background: var(--stp-terracotta);
  color: var(--stp-beige);
}

.stp-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--stp-text-medium);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.stp-close:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* =====================================
   MODE PANELS
   ===================================== */

.stp-mode-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.stp-mode-panel.hidden {
  display: none;
}

/* =====================================
   MESSAGES AREA
   ===================================== */

.stp-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stp-message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  font-family: 'Work Sans', sans-serif;
}

.stp-message-user {
  background: var(--stp-terracotta);
  color: var(--stp-white);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.stp-message-assistant {
  background: var(--stp-beige);
  color: var(--stp-text-dark);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

/* Message content formatting */
.stp-message strong {
  font-weight: 700;
  color: var(--stp-terracotta);
}

.stp-message-user strong {
  color: var(--stp-white);
  font-weight: 700;
}

.stp-message ul {
  margin: 8px 0;
  padding-left: 20px;
  list-style: none;
}

.stp-message ul li {
  margin: 6px 0;
  padding-left: 8px;
  position: relative;
}

.stp-message ul li:before {
  content: "•";
  position: absolute;
  left: -12px;
  font-weight: bold;
  color: var(--stp-terracotta);
}

.stp-message-user ul li:before {
  color: var(--stp-white);
}

.stp-message p {
  margin: 8px 0;
}

.stp-message p:first-child {
  margin-top: 0;
}

.stp-message p:last-child {
  margin-bottom: 0;
}

/* =====================================
   INPUT AREA
   ===================================== */

.stp-input-area {
  padding: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  gap: 8px;
}

.stp-input-area textarea {
  flex: 1;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 12px;
  font-family: 'Work Sans', sans-serif;
  font-size: 14px;
  resize: none;
  min-height: 44px;
  max-height: 120px;
}

.stp-input-area textarea:focus {
  outline: none;
  border-color: var(--stp-terracotta);
}

.stp-send {
  background: var(--stp-terracotta);
  color: var(--stp-beige);
  border: none;
  border-radius: 8px;
  padding: 0 20px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.stp-send:hover {
  opacity: 0.9;
}

.stp-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =====================================
   REGISTRATION FORM
   ===================================== */

.stp-registration {
  padding: 24px;
}

.stp-registration h3 {
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--stp-text-dark);
}

.stp-registration p {
  font-size: 14px;
  color: var(--stp-text-medium);
  margin-bottom: 20px;
}

.stp-reg-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stp-reg-form input[type="text"],
.stp-reg-form input[type="email"] {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 12px;
  font-family: 'Work Sans', sans-serif;
  font-size: 14px;
}

.stp-reg-form input:focus {
  outline: none;
  border-color: var(--stp-terracotta);
}

.stp-gdpr {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--stp-text-medium);
  cursor: pointer;
}

.stp-gdpr input[type="checkbox"] {
  margin-top: 2px;
}

.stp-reg-form button[type="submit"] {
  background: var(--stp-terracotta);
  color: var(--stp-beige);
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.stp-reg-form button[type="submit"]:hover {
  opacity: 0.9;
}

/* =====================================
   UPLOAD AREA
   ===================================== */

.stp-upload-area {
  padding: 24px;
}

.stp-upload-area h4 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--stp-text-dark);
}

.stp-url-input {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
  font-family: 'Work Sans', sans-serif;
  font-size: 14px;
}

.stp-dropzone {
  border: 2px dashed rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.stp-dropzone:hover {
  border-color: var(--stp-terracotta);
  background: rgba(228, 214, 179, 0.1);
}

.stp-dropzone input[type="file"] {
  display: none;
}

.stp-process-docs {
  width: 100%;
  background: var(--stp-terracotta);
  color: var(--stp-beige);
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-weight: 600;
  cursor: pointer;
}

.stp-process-docs:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =====================================
   MODE SELECTION
   ===================================== */

.stp-mode-select {
  padding: 24px;
}

.stp-mode-select h4 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--stp-text-dark);
}

.stp-mode-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stp-mode-card {
  background: var(--stp-beige);
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s;
}

.stp-mode-card:hover {
  border-color: var(--stp-terracotta);
}

.stp-mode-card strong {
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
  color: var(--stp-text-dark);
}

.stp-mode-card p {
  font-size: 13px;
  color: var(--stp-text-medium);
  margin-bottom: 8px;
}

.stp-mode-card span {
  font-size: 12px;
  color: var(--stp-terracotta);
}

/* =====================================
   SCREENSHOT MOCKUP
   ===================================== */

.stp-screenshot-mockup {
  position: relative;
  min-height: 150px;
  max-height: 200px;
  background-color: #f5f5f5;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stp-chat-overlay {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 320px;
  background: var(--stp-white);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  max-height: 400px;
}

/* =====================================
   AUTO-SIMULATION RESULTS
   ===================================== */

.stp-auto-results {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

.stp-conversation-display {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-height: 250px;
}

.stp-conversation-display .message {
  margin-bottom: 16px;
  padding: 12px;
  border-radius: 8px;
  background: var(--stp-beige);
}

.stp-conversation-display .message.customer {
  background: #e3f2fd;
  margin-left: 20px;
}

.stp-conversation-display .message.owner {
  background: #fff3e0;
  margin-right: 20px;
}

.stp-conversation-display .message strong {
  display: block;
  margin-bottom: 4px;
  color: var(--stp-text-dark);
  font-weight: 600;
}

.stp-analysis {
  padding: 0 24px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.stp-analysis h4 {
  font-size: 16px;
  margin: 16px 0 8px;
  color: var(--stp-terracotta);
}

.stp-analysis ul {
  margin: 8px 0;
  padding-left: 20px;
}

.stp-analysis li {
  margin: 4px 0;
  font-size: 14px;
  line-height: 1.5;
}

.stp-reset {
  margin: 16px 24px 24px;
  padding: 12px 24px;
  background: var(--stp-terracotta);
  color: var(--stp-white);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.stp-reset:hover {
  opacity: 0.9;
}

/* =====================================
   UTILITY CLASSES
   ===================================== */

.hidden {
  display: none !important;
}

.stp-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* =====================================
   MOBILE RESPONSIVE
   ===================================== */

@media (max-width: 768px) and (min-width: 481px) {
  .stp-chat-window {
    width: 420px;
    height: 650px;
  }
}

@media (max-width: 480px) {
  .stp-chatbot-container {
    bottom: 0;
    right: 0;
  }

  .stp-chat-window {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }

  .stp-chat-trigger {
    bottom: 16px;
    right: 16px;
  }
}

/* =====================================
   ANIMATIONS
   ===================================== */

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(194, 111, 81, 0.4);
  }
  50% {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 0 8px rgba(194, 111, 81, 0);
  }
}

/* =====================================
   TYPING INDICATOR (Loading)
   ===================================== */

.stp-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
}

.stp-typing span {
  width: 8px;
  height: 8px;
  background: var(--stp-terracotta);
  border-radius: 50%;
  opacity: 0.4;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.stp-typing span:nth-child(1) {
  animation-delay: -0.32s;
}

.stp-typing span:nth-child(2) {
  animation-delay: -0.16s;
}

.stp-typing span:nth-child(3) {
  animation-delay: 0s;
}

@keyframes typingBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
