/*
* IPA Chat Widget — widget.css
* Premium BMW-style widget preview.
*/

#ipa-chat *,
#ipa-chat *::before,
#ipa-chat *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}

#ipa-chat {
--ipa-bg: #ffffff;
--ipa-panel: #ffffff;
--ipa-panel-2: #f8f8f8;
--ipa-panel-3: #f3f3f3;
--ipa-panel-4: #ffffff;
--ipa-border: rgba(34, 31, 31, 0.10);
--ipa-border-strong: rgba(34, 31, 31, 0.16);
--ipa-text: #221f1f;
--ipa-text-soft: #5f5f5f;
--ipa-text-muted: #7b7b7b;
--ipa-accent: #1c69d4;
--ipa-accent-strong: #0653b6;
--ipa-accent-soft: rgba(28, 105, 212, 0.18);
--ipa-user-bg: #dfe9f5;
--ipa-user-text: #112133;
--ipa-shadow:
0 10px 28px rgba(0, 0, 0, 0.22),
0 0 0 1px rgba(255, 255, 255, 0.06);
font-family: var(--typography-font-family, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif);
font-size: 14px;
line-height: 1.45;
color: var(--ipa-text);
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
}

#ipa-chat .ipa-widget {
width: min(100%, 420px);
min-height: 560px;
height: clamp(560px, 72vh, 760px);
display: flex;
flex-direction: column;
background: #ffffff;
border-radius: var(--radius-lg, 0);
border: 0;
box-shadow: var(--ipa-shadow);
overflow: hidden;
transition: height 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

#ipa-chat .ipa-widget.ipa-minimized {
height: 72px;
}

#ipa-chat .ipa-widget.ipa-minimized .ipa-body,
#ipa-chat .ipa-widget.ipa-minimized .ipa-input-area {
display: none;
}

#ipa-chat .ipa-header {
flex-shrink: 0;
display: flex;
align-items: center;
gap: 10px;
padding: 14px 18px;
min-height: 64px;
background:
linear-gradient(180deg, rgba(28, 105, 211, 0.03), rgba(255, 255, 255, 0)),
#ffffff;
border-bottom: 0;
color: var(--ipa-text);
}

#ipa-chat .ipa-header-icon {
flex-shrink: 0;
width: 28px;
height: 28px;
border-radius: 10px;
border: 0;
background: #ffffff;
display: flex;
align-items: center;
justify-content: center;
color: #221f1f;
box-shadow: none;
}

#ipa-chat .ipa-header-icon svg {
display: block;
}

#ipa-chat .ipa-header-text {
flex: 1;
min-width: 0;
}

#ipa-chat .ipa-header-title {
font-size: 14px;
font-weight: 400;
letter-spacing: 0;
text-transform: none;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

#ipa-chat .ipa-header-subtitle {
margin-top: 2px;
font-size: 11px;
color: var(--ipa-text-soft);
letter-spacing: 0.02em;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

#ipa-chat .ipa-header-welcome {
display: none;
font-size: 11px;
color: #6f6f6f;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 122px;
}

#ipa-chat .ipa-header-actions {
flex-shrink: 0;
display: flex;
align-items: center;
}

#ipa-chat .ipa-icon-btn {
width: 28px;
height: 28px;
background: #ffffff;
border: 0;
border-radius: 10px;
cursor: pointer;
color: rgba(34, 31, 31, 0.72);
display: flex;
align-items: center;
justify-content: center;
transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
line-height: 1;
}

#ipa-chat .ipa-icon-btn:hover {
background: rgba(28, 105, 211, 0.06);
border-color: rgba(28, 105, 211, 0.18);
color: #221f1f;
}

#ipa-chat .ipa-icon-btn:focus-visible,
#ipa-chat .ipa-send-btn:focus-visible,
#ipa-chat .ipa-quick-action:focus-visible,
#ipa-chat .ipa-input:focus-visible {
outline: none;
box-shadow: 0 0 0 1px var(--ipa-accent), 0 0 0 4px rgba(28, 105, 212, 0.2);
}

#ipa-chat .ipa-body {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
background: #ffffff;
}

#ipa-chat .ipa-welcome-panel {
display: none;
}

#ipa-chat .ipa-kicker {
font-size: 11px;
font-weight: 400;
letter-spacing: 0;
text-transform: none;
color: #6f6f6f;
}

#ipa-chat .ipa-welcome-heading {
margin-top: 4px;
font-size: 20px;
font-weight: 400;
line-height: 1.4;
letter-spacing: -0.03em;
color: #221f1f;
}

#ipa-chat .ipa-welcome-copy {
margin-top: 12px;
font-size: 12.5px;
line-height: 1.45;
color: var(--ipa-text-soft);
max-width: 300px;
}

#ipa-chat .ipa-quick-actions {
margin-top: 14px;
display: flex;
flex-wrap: wrap;
gap: 8px;
}

#ipa-chat .ipa-quick-action {
appearance: none;
border: 0;
background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
color: #edf2f7;
border-radius: 14px;
padding: 10px 12px;
font: inherit;
font-size: 13px;
font-weight: 400;
letter-spacing: 0.01em;
cursor: pointer;
transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

#ipa-chat .ipa-quick-action:hover {
border-color: rgba(28, 105, 212, 0.45);
background: linear-gradient(180deg, rgba(28, 105, 212, 0.16), rgba(28, 105, 212, 0.08));
transform: translateY(-1px);
}

#ipa-chat .ipa-trust-line {
margin-top: 12px;
padding-top: 10px;
border-top: 0;
font-size: 11px;
color: #6f6f6f;
}

#ipa-chat .ipa-messages {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 4px 16px 8px;
display: flex;
flex-direction: column;
gap: 8px;
scroll-behavior: smooth;
}

#ipa-chat .ipa-messages::-webkit-scrollbar {
width: 5px;
}

#ipa-chat .ipa-messages::-webkit-scrollbar-track {
background: transparent;
}

#ipa-chat .ipa-messages::-webkit-scrollbar-thumb {
background: rgba(255, 255, 255, 0.12);
border-radius: 10px;
}

#ipa-chat .ipa-message {
display: flex;
flex-direction: column;
max-width: 86%;
animation: ipa-bubble-in 0.18s ease both;
}

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

#ipa-chat .ipa-message.ipa-user {
align-self: flex-end;
align-items: flex-end;
}

#ipa-chat .ipa-message.ipa-agent {
align-self: flex-start;
align-items: flex-start;
}

#ipa-chat .ipa-bubble {
padding: 10px 12px;
border-radius: 0;
font-size: 13px;
line-height: 1.5;
word-break: break-word;
white-space: pre-wrap;
}

#ipa-chat .ipa-message.ipa-user .ipa-bubble {
background: #1c69d3;
color: #ffffff;
border: 0;
border-bottom-right-radius: 0;
box-shadow: none;
}

#ipa-chat .ipa-message.ipa-agent .ipa-bubble {
background: #ffffff;
color: var(--ipa-text);
border: 0;
border-bottom-left-radius: 0;
box-shadow: none;
}

#ipa-chat .ipa-message-time {
font-size: 11px;
color: #6f6f6f;
margin-top: 4px;
padding: 0 2px;
}

#ipa-chat .ipa-typing {
display: flex;
align-items: center;
gap: 5px;
padding: 10px 12px;
background: #ffffff;
border: 0;
border-radius: 0;
border-bottom-left-radius: 0;
align-self: flex-start;
animation: ipa-bubble-in 0.18s ease both;
}

#ipa-chat .ipa-typing-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: rgba(34, 31, 31, 0.35);
animation: ipa-typing-bounce 1.2s ease infinite;
}

#ipa-chat .ipa-typing-dot:nth-child(2) {
animation-delay: 0.2s;
}

#ipa-chat .ipa-typing-dot:nth-child(3) {
animation-delay: 0.4s;
}

@keyframes ipa-typing-bounce {
0%, 60%, 100% {
transform: translateY(0);
opacity: 0.45;
}
30% {
transform: translateY(-4px);
opacity: 1;
}
}

#ipa-chat .ipa-system-msg {
align-self: center;
font-size: 11px;
letter-spacing: 0.06em;
text-transform: none;
color: #6f6f6f;
background: transparent;
border: 0;
padding: 0;
border-radius: 0;
text-align: center;
}

#ipa-chat .ipa-input-area {
flex-shrink: 0;
padding: 8px 16px 12px;
background: #ffffff;
border-top: 0;
display: flex;
align-items: flex-end;
gap: 8px;
}

#ipa-chat .ipa-input-wrap {
flex: 1;
display: flex;
align-items: flex-end;
gap: 8px;
padding: 0;
background: #ffffff;
border: 0;
border-radius: 0;
box-shadow: none;
}

#ipa-chat .ipa-input {
flex: 1;
min-height: 40px;
max-height: 110px;
padding: 8px 0;
font-family: inherit;
font-size: 13px;
line-height: 1.45;
color: var(--ipa-text);
background: transparent;
border: 0;
resize: none;
outline: none;
overflow-y: auto;
}

#ipa-chat .ipa-input::placeholder {
color: #8c8a8a;
}

#ipa-chat .ipa-send-btn {
flex-shrink: 0;
width: 38px;
height: 38px;
border-radius: 14px;
background: #1c69d3;
border: 0;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
color: #ffffff;
transition: transform 0.12s ease, filter 0.16s ease, box-shadow 0.16s ease;
box-shadow: none;
}

#ipa-chat .ipa-send-btn:hover:not(:disabled) {
filter: brightness(1.06);
}

#ipa-chat .ipa-send-btn:active:not(:disabled) {
transform: scale(0.96);
}

#ipa-chat .ipa-send-btn:disabled {
background: linear-gradient(180deg, #39424d, #313941);
color: rgba(255, 255, 255, 0.45);
box-shadow: none;
cursor: not-allowed;
}

#ipa-chat .ipa-error {
font-size: 13px;
color: #ffd5d5;
background: rgba(146, 31, 31, 0.2);
border: 1px solid rgba(255, 107, 107, 0.28);
border-radius: 12px;
padding: 8px 11px;
align-self: stretch;
animation: ipa-bubble-in 0.18s ease both;
}

@media (max-width: 479px) {
#ipa-chat .ipa-widget {
width: 100%;
height: min(92vh, 760px);
border-radius: 22px 22px 0 0;
}

#ipa-chat .ipa-header {
padding: 15px 14px 14px;
}

#ipa-chat .ipa-welcome-panel,
#ipa-chat .ipa-messages,
#ipa-chat .ipa-input-area {
padding-left: 14px;
padding-right: 14px;
}

#ipa-chat .ipa-bubble,
#ipa-chat .ipa-input {
font-size: 16px;
}
}

@media (prefers-reduced-motion: reduce) {
#ipa-chat .ipa-widget,
#ipa-chat .ipa-icon-btn,
#ipa-chat .ipa-quick-action,
#ipa-chat .ipa-send-btn,
#ipa-chat .ipa-message,
#ipa-chat .ipa-typing,
#ipa-chat .ipa-typing-dot {
transition: none !important;
animation: none !important;
}
}



@media (max-width: 640px) {
  #ipa-chat .ipa-widget {
    width: 100%;
    min-height: 460px;
    height: auto;
  }

  #ipa-chat .ipa-header {
    padding: 12px 14px;
    min-height: 56px;
  }

  #ipa-chat .ipa-header-title {
    font-size: 13px;
  }

  #ipa-chat .ipa-header-subtitle {
    font-size: 10px;
  }

  #ipa-chat .ipa-messages {
    padding: 2px 14px 8px;
    gap: 6px;
  }

  #ipa-chat .ipa-message {
    max-width: 92%;
  }

  #ipa-chat .ipa-bubble {
    padding: 8px 10px;
    font-size: 12.5px;
    line-height: 1.42;
  }

  #ipa-chat .ipa-message-time {
    font-size: 10px;
    margin-top: 2px;
  }

  #ipa-chat .ipa-input-area {
    padding: 6px 14px 10px;
  }

  #ipa-chat .ipa-input {
    min-height: 36px;
    font-size: 12.5px;
  }

  #ipa-chat .ipa-send-btn {
    width: 34px;
    height: 34px;
    border-radius: 12px;
  }
}
