/* ============================================================
   AutoDealer AI Chat Widget – Premium Styles
   Light theme s nastavitelnou primární modrou barvou.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap');

:root {
  /* Dynamic vars passed from WP */
  --akm-chat-gradient-start: #1c2536;
  --akm-chat-gradient-end: #1c2536;
  --akm-chat-bg-dark: #ffffff;

  --akm-chat-white: #ffffff;
  --akm-chat-bubble-gray: #f3f3f3;
  --akm-chat-gray-200: #e2e8f0;
  --akm-chat-gray-400: #94a3b8;
  --akm-chat-gray-600: #475569;
  --akm-chat-text: #000000;
  --akm-chat-primary: #162235;

  --akm-chat-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  --akm-chat-shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.08);
  --akm-chat-radius: 12px;
  --akm-chat-radius-sm: 10px;
  --akm-chat-radius-chat: 10px 10px 0px 10px;
  --akm-chat-radius-chat-inverted: 10px 10px 10px 0px;
  --akm-chat-font: 'Manrope', sans-serif;
  --akm-chat-widget-width: 380px;
  --akm-chat-widget-height: 580px;
  --akm-chat-z: 999999;
}

/* ---- Chat Window ---- */
.akm-chat-window {
  width: var(--akm-chat-widget-width) !important;
  height: var(--akm-chat-widget-height) !important;
  background: var(--akm-chat-white) !important;
  border-radius: var(--akm-chat-radius) !important;
  box-shadow: var(--akm-chat-shadow) !important;
  flex-direction: column !important;
  overflow: hidden !important;
  z-index: var(--akm-chat-z) !important;
  border: 1px solid var(--akm-chat-gray-200) !important;

  /* Hidden state is now managed via inline CSS for modal behavior */
}

.akm-chat-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Header ---- */
.akm-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--akm-chat-white);
  border-bottom: 1px solid var(--akm-chat-gray-200);
  flex-shrink: 0;
}

.akm-chat-avatar-wrapper {
  position: relative;
  display: flex;
  flex-shrink: 0;
}

.akm-chat-online-dot {
  position: absolute;
  top: 0px;
  left: 0px;
  width: 11px;
  height: 11px;
  background-color: #22c55e;
  border-radius: 50%;
  border: 1.5px solid var(--akm-chat-white);
  z-index: 2;
}

.akm-chat-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--akm-chat-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 24px;
}

.akm-chat-header-info {
  flex: 1;
  min-width: 0;
}

.akm-chat-header-name {
  font-family: var(--akm-chat-font);
  font-weight: 700;
  font-size: 16px;
  color: #000000 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.akm-chat-header-actions {
  position: absolute;
  top: 20px;
  right: 20px;
}

.akm-chat-header-btn {
  width: 32px !important;
  height: 32px !important;
  border: none !important;
  background: transparent !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background 0.2s !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.akm-chat-header-btn:hover {
  background: var(--akm-chat-bubble-gray);
}

.akm-chat-minimize-icon {
  width: 14px;
  height: 10px;
  color: var(--akm-chat-text);
}

.logoChat {
  width: 28px;
  height: auto;
}

/* ---- Messages Area ---- */
.akm-chat-messages {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 20px !important;
  padding: 30px 20px !important;
  margin: 0 !important;
  overflow-y: auto !important;
  background: #ffffff !important;
  scroll-behavior: smooth !important;
}

.akm-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.akm-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.akm-chat-messages::-webkit-scrollbar-thumb {
  background: var(--akm-chat-gray-200);
  border-radius: 2px;
}

/* ---- Message Bubbles ---- */
.akm-chat-msg {
  display: flex !important;
  align-items: flex-end !important;
  gap: 8px !important;
  width: 100% !important;
  margin-bottom: 0px !important;
}

.akm-chat-msg--bot {
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 4px !important;
}

.akm-chat-msg--user {
  flex-direction: row-reverse !important;
}

.akm-chat-bot-name-label {
  font-family: var(--akm-chat-font);
  font-size: 13px;
  font-weight: 700;
  color: #000000 !important;
  margin-bottom: 2px;
}

.akm-chat-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--akm-chat-bubble-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.akm-chat-bubble {
  max-width: 85% !important;
  font-family: var(--akm-chat-font) !important;
  font-size: 14px !important;
  line-height: 1.55 !important;
  word-wrap: break-word !important;
  white-space: pre-wrap !important;
  color: #000000 !important;
}

.akm-chat-msg--bot .akm-chat-bubble {
  background: transparent !important;
  color: #000000 !important;
  padding: 0 !important;
  border: none !important;
}

.akm-chat-msg--user .akm-chat-bubble {
  background: var(--akm-chat-bubble-gray) !important;
  color: #000000 !important;
  padding: 14px 20px !important;
  border-radius: var(--akm-chat-radius-chat) !important;
}

.akm-chat-msg-name {
  font-family: var(--akm-chat-font);
  font-size: 14px;
  font-weight: 700;
  color: #000000 !important;
  margin-bottom: 2px;
}



/* Markdown-like bold */
.akm-chat-bubble strong {
  font-weight: 700;
}

.akm-chat-bubble a {
  color: var(--akm-chat-gradient-start);
  text-decoration: underline;
}

/* ---- Typing / Loading Indicator ---- */
.akm-chat-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 0;
  background: transparent;
  width: fit-content;
}

.akm-chat-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--akm-chat-gray-400);
  display: block;
  animation: akm-chat-typing-bounce 1.2s ease-in-out infinite;
}

.akm-chat-typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.akm-chat-typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes akm-chat-typing-bounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }

  30% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* ---- Input Area ---- */
.akm-chat-input-area {
  display: flex !important;
  align-items: flex-end !important;
  gap: 12px !important;
  padding: 0px 24px 24px 24px !important;
  background: var(--akm-chat-white) !important;
  flex-shrink: 0 !important;
  height: 110px !important;
  box-sizing: border-box !important;
}

.akm-chat-input-wrapper {
  flex: 1 !important;
  position: relative !important;
  display: flex !important;
  background: var(--akm-chat-white) !important;
  border: 1px solid var(--akm-chat-gray-200) !important;
  border-radius: 12px !important;
  transition: border-color 0.2s !important;
  align-items: stretch !important;
  padding: 0 !important;
  height: 100% !important;
}

.akm-chat-input-wrapper:focus-within {
  border-color: var(--akm-chat-gray-400);
}

.akm-chat-lead-label {
  font-family: var(--akm-chat-font);
  font-size: 18px;
  font-weight: 700;
  color: var(--akm-chat-text);
  margin-bottom: -5px;
}

.akm-chat-chat-input {
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  color: #000000 !important;
  font-family: var(--akm-chat-font) !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
  padding: 14px 52px 34px 16px !important;
  resize: none !important;
  outline: none !important;
  box-sizing: border-box !important;
  height: 100% !important;
  max-height: 120px !important;
  overflow-y: auto !important;
  box-shadow: none !important;
}

.akm-chat-chat-input::placeholder {
  color: var(--akm-chat-gray-600);
}

.akm-chat-char-counter {
  position: absolute;
  bottom: 12px;
  left: 16px;
  font-family: var(--akm-chat-font);
  font-size: 11px;
  color: var(--akm-chat-gray-400);
  pointer-events: none;
}

.akm-chat-send {
  position: absolute !important;
  bottom: 10px !important;
  right: 12px !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 8px !important;
  border: none !important;
  background: transparent !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease !important;
  padding: 0 !important;
  box-shadow: none !important;
}

.akm-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.akm-chat-send svg {
  width: 20px !important;
  height: 20px !important;
  fill: var(--akm-chat-primary) !important;
  display: block !important;
}

/* ---- Responsive (mobil) ---- */
@media (max-width: 450px) {

  .akm-chat-window,
  .akm-chat-window.is-open {
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    transform: none !important;
    margin: 0 !important;
  }
}


/* ---- Initial Screen ---- */
.akm-initial-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #FFFFFF;
  z-index: 2;
}

.akm-initial-screen-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.akm-initial-spinner {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.akm-initial-spinner span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #98A2B3;
  opacity: 0.35;
  animation: akmInitialDot 1.2s ease-in-out infinite;
}

.akm-initial-spinner span:nth-child(2) {
  animation-delay: 0.15s;
}

.akm-initial-spinner span:nth-child(3) {
  animation-delay: 0.3s;
}

.akm-initial-screen-text {
  font-size: 15px;
  line-height: 1.5;
  color: #667085;
}

@keyframes akmInitialDot {
  0%, 100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

/* ---- Busy Screen ---- */
.akm-busy-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: #FFFFFF;
  z-index: 3;
}

.akm-busy-screen-inner {
  max-width: 300px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.akm-busy-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
}

.akm-busy-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #F04438;
  box-shadow: 0 0 0 0 rgba(240, 68, 56, 0.25);
  animation: akmBusyDotPulse 1.8s ease-in-out infinite;
  flex: 0 0 8px;
}

.akm-busy-title {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
  color: #101828;
  margin: 0;
  padding-bottom: 1px; /* Optické vycentrování k tečce */
}

.akm-busy-text {
  font-size: 14px;
  line-height: 1.5;
  color: #667085;
  margin-bottom: 8px;
}

.akm-busy-actions {
  display: flex;
  justify-content: center;
  margin-top: 30px;
}

.akm-busy-close {
  min-width: 120px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px !important;
  border-radius: 10px;
  border: 1px solid #E0587E;
  background: #FFFFFF;
  color: #D6336C;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1 !important;
  box-sizing: border-box !important;
}

.akm-busy-close:hover {
  background: #FFF1F5;
  border-color: #D6336C;
}

@keyframes akmBusyDotPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(240, 68, 56, 0.25);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 0 0 4px rgba(240, 68, 56, 0);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(240, 68, 56, 0);
    opacity: 0.85;
  }
}
