/* Lopasic Chatbot modern interface */

:root {
  --lop-bg: #f5f5f7;
  --lop-panel: rgba(255, 255, 255, 0.86);
  --lop-panel-solid: #ffffff;
  --lop-text: #1d1d1f;
  --lop-text-secondary: #6e6e73;
  --lop-text-tertiary: #86868b;
  --lop-border: rgba(0, 0, 0, 0.12);
  --lop-border-soft: rgba(0, 0, 0, 0.07);
  --lop-blue: #007aff;
  --lop-blue-dark: #0066d6;
  --lop-green: #30d158;
  --lop-user: #1d1d1f;
  --lop-assistant: #ffffff;
  --lop-shadow: 0 22px 60px rgba(0, 0, 0, 0.10), 0 4px 16px rgba(0, 0, 0, 0.06);
  --lop-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --lop-radius: 26px;
}

.modernus-lopasic-wrap,
.modernus-lopasic-wrap * {
  box-sizing: border-box;
  letter-spacing: 0;
}

.modernus-lopasic-wrap {
  font-family: var(--lop-font);
  color: var(--lop-text);
  width: min(100%, 980px);
  margin: 28px auto;
  overflow: hidden;
  border: 1px solid var(--lop-border-soft);
  border-radius: var(--lop-radius);
  background:
    radial-gradient(circle at top left, rgba(0, 122, 255, 0.09), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.96), rgba(245,245,247,0.92));
  box-shadow: var(--lop-shadow);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

.modernus-lopasic-chat-panel {
  display: contents;
}

@supports (backdrop-filter: blur(20px)) {
  .modernus-lopasic-wrap {
    background: rgba(245, 245, 247, 0.78);
    backdrop-filter: blur(24px) saturate(1.5);
  }
}

@media (min-width: 1200px) {
  .modernus-lopasic-wrap { width: min(100%, 1080px); }
}

.modernus-lopasic-mode-popup {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99999;
  width: auto;
  margin: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.modernus-lopasic-mode-popup .modernus-lopasic-chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: flex;
  flex-direction: column;
  width: min(420px, calc(100vw - 32px));
  height: min(680px, calc(100vh - 112px));
  overflow: hidden;
  border: 1px solid var(--lop-border-soft);
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(0, 122, 255, 0.09), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245,245,247,0.94));
  box-shadow: var(--lop-shadow);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  pointer-events: none;
  transform-origin: bottom right;
  transition: opacity .18s ease, transform .18s ease;
}

@supports (backdrop-filter: blur(20px)) {
  .modernus-lopasic-mode-popup .modernus-lopasic-chat-panel {
    background: rgba(245,245,247,0.82);
    backdrop-filter: blur(24px) saturate(1.5);
  }
}

.modernus-lopasic-mode-popup.modernus-lopasic-popup-open .modernus-lopasic-chat-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.modernus-lopasic-popup-launcher {
  appearance: none;
  position: relative;
  width: 62px;
  height: 62px;
  margin: 0;
  border: 1px solid rgba(255,255,255,0.74);
  border-radius: 22px;
  background: rgba(255,255,255,0.86);
  box-shadow: 0 18px 46px rgba(0,0,0,0.18), 0 3px 12px rgba(0,0,0,0.08);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
}

.modernus-lopasic-popup-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 54px rgba(0,0,0,0.20), 0 4px 14px rgba(0,0,0,0.09);
}

.modernus-lopasic-popup-avatar {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: url('../images/avatar.jpg') center/cover no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.78);
}

.modernus-lopasic-popup-dot {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 13px;
  height: 13px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--lop-green);
}

.modernus-lopasic-popup-close {
  appearance: none;
  width: 34px;
  height: 34px;
  margin: 0;
  border: 1px solid var(--lop-border-soft);
  border-radius: 999px;
  background: rgba(255,255,255,0.76);
  color: var(--lop-text-secondary);
  cursor: pointer;
  font: 600 22px/1 var(--lop-font);
}

.modernus-lopasic-popup-close:hover {
  color: var(--lop-text);
  background: #fff;
}

.modernus-lopasic-mode-full .modernus-lopasic-popup-close,
.modernus-lopasic-mode-full .modernus-lopasic-popup-launcher {
  display: none;
}

.modernus-lopasic-mode-popup .modernus-lopasic-header {
  flex: 0 0 auto;
}

.modernus-lopasic-mode-popup .modernus-lopasic-messages {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
}

.modernus-lopasic-mode-popup .modernus-lopasic-input-row,
.modernus-lopasic-mode-popup .modernus-lopasic-suggestions {
  flex: 0 0 auto;
}

.modernus-lopasic-header {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--lop-border-soft);
  background: rgba(255,255,255,0.72);
}

.modernus-lopasic-avatar,
.modernus-lopasic-msg-avatar {
  background: url('../images/avatar.jpg') center/cover no-repeat;
  border: 1px solid rgba(255,255,255,0.86);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08), 0 0 0 1px var(--lop-border-soft);
  flex-shrink: 0;
}

.modernus-lopasic-avatar {
  width: 56px;
  height: 56px;
  border-radius: 18px;
}

.modernus-lopasic-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.modernus-lopasic-era {
  font: 600 11px/1.2 var(--lop-font);
  color: var(--lop-text-tertiary);
  text-transform: uppercase;
}

.modernus-lopasic-name {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  color: var(--lop-text) !important;
  font: 700 24px/1.12 var(--lop-font) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modernus-lopasic-desc {
  font: 500 13px/1.25 var(--lop-font);
  color: var(--lop-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modernus-lopasic-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.modernus-lopasic-lang-switcher,
.modernus-lopasic-a11y-btns {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--lop-border-soft);
  border-radius: 999px;
  background: rgba(118,118,128,0.10);
}

.modernus-lopasic-lang-switcher[hidden] {
  display: none !important;
}

.modernus-lopasic-lang-btn,
.modernus-lopasic-a11y-toggle,
.modernus-lopasic-a11y-btn {
  appearance: none;
  border: 0;
  margin: 0;
  cursor: pointer;
  font-family: var(--lop-font);
  letter-spacing: 0;
}

.modernus-lopasic-lang-btn {
  min-width: 34px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--lop-text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.modernus-lopasic-lang-btn.active {
  color: #fff;
  background: var(--lop-blue);
  box-shadow: 0 2px 8px rgba(0,122,255,0.25);
}

.modernus-lopasic-a11y-toggle {
  height: 34px;
  min-width: 42px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--lop-text);
  background: rgba(255,255,255,0.76);
  border: 1px solid var(--lop-border-soft);
  font-size: 13px;
  font-weight: 700;
}

.modernus-lopasic-a11y-toggle:hover,
.modernus-lopasic-a11y-toggle[aria-expanded="true"] {
  background: #fff;
  border-color: rgba(0,122,255,0.34);
}

.modernus-lopasic-a11y-panel {
  display: grid;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--lop-border-soft);
  background: rgba(255,255,255,0.62);
}

.modernus-lopasic-a11y-panel[hidden] { display: none; }

.modernus-lopasic-a11y-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.modernus-lopasic-a11y-label {
  min-width: 112px;
  color: var(--lop-text-secondary);
  font: 700 12px/1 var(--lop-font);
}

.modernus-lopasic-a11y-btn {
  height: 28px;
  min-width: 38px;
  padding: 0 10px;
  border-radius: 999px;
  background: transparent;
  color: var(--lop-text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.modernus-lopasic-a11y-btn.active {
  color: #fff;
  background: var(--lop-text);
}

.modernus-lopasic-messages {
  min-height: 360px;
  max-height: 560px;
  overflow-y: auto;
  padding: 22px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(245,245,247,0.72);
  scroll-behavior: smooth;
}

.modernus-lopasic-messages::-webkit-scrollbar { width: 8px; }
.modernus-lopasic-messages::-webkit-scrollbar-track { background: transparent; }
.modernus-lopasic-messages::-webkit-scrollbar-thumb {
  background: rgba(60,60,67,0.22);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.modernus-lopasic-message {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.modernus-lopasic-message.modernus-lopasic-user {
  justify-content: flex-end;
}

.modernus-lopasic-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.modernus-lopasic-message.modernus-lopasic-user .modernus-lopasic-msg-avatar { display: none; }

.modernus-lopasic-bubble {
  max-width: min(78%, 720px);
  padding: 13px 16px;
  border-radius: 20px;
  color: var(--lop-text);
  background: var(--lop-assistant);
  border: 1px solid var(--lop-border-soft);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  font: 400 15px/1.55 var(--lop-font);
}

.modernus-lopasic-assistant .modernus-lopasic-bubble {
  border-bottom-left-radius: 8px;
}

.modernus-lopasic-user .modernus-lopasic-bubble {
  color: #fff;
  background: var(--lop-user);
  border-color: transparent;
  border-bottom-right-radius: 8px;
  font-weight: 500;
}

.modernus-lopasic-bubble.modernus-lopasic-error {
  color: #b42318;
  background: #fff4f2;
  border-color: rgba(180,35,24,0.22);
}

.modernus-lopasic-feedback {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--lop-border-soft);
}

.modernus-lopasic-feedback-label,
.modernus-lopasic-feedback-note {
  color: var(--lop-text-tertiary);
  font: 500 12px/1.35 var(--lop-font);
}

.modernus-lopasic-feedback-btn,
.modernus-lopasic-feedback-submit,
.modernus-lopasic-feedback-cancel {
  appearance: none;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--lop-border-soft);
  border-radius: 999px;
  background: rgba(255,255,255,0.88);
  color: var(--lop-text);
  cursor: pointer;
  font: 600 12px/1.2 var(--lop-font);
}

.modernus-lopasic-feedback-btn:hover,
.modernus-lopasic-feedback-btn.active,
.modernus-lopasic-feedback-submit:hover {
  color: #fff;
  background: var(--lop-blue);
  border-color: var(--lop-blue);
}

.modernus-lopasic-feedback-form {
  margin-top: 10px;
}

.modernus-lopasic-feedback-text {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--lop-border-soft);
  border-radius: 14px;
  background: rgba(255,255,255,0.92);
  color: var(--lop-text);
  font: 400 13px/1.45 var(--lop-font);
}

.modernus-lopasic-feedback-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.modernus-lopasic-feedback-note {
  margin-top: 8px;
}

.modernus-lopasic-typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 60px;
  min-height: 20px;
}

.modernus-lopasic-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lop-text-tertiary);
  animation: lopDot 1.15s ease-in-out infinite;
}

.modernus-lopasic-dot:nth-child(2) { animation-delay: .15s; }
.modernus-lopasic-dot:nth-child(3) { animation-delay: .3s; }

@keyframes lopDot {
  0%, 70%, 100% { opacity: .25; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-3px); }
}

.modernus-lopasic-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--lop-border-soft);
  background: rgba(255,255,255,0.70);
}

.modernus-lopasic-sug {
  appearance: none;
  min-height: 34px;
  padding: 7px 13px;
  border: 1px solid var(--lop-border-soft);
  border-radius: 999px;
  color: var(--lop-text);
  background: rgba(255,255,255,0.86);
  cursor: pointer;
  font: 600 13px/1.2 var(--lop-font);
  transition: transform .16s ease, background .16s ease, border-color .16s ease, color .16s ease;
}

.modernus-lopasic-sug:hover {
  color: #fff;
  background: var(--lop-blue);
  border-color: var(--lop-blue);
  transform: translateY(-1px);
}

.modernus-lopasic-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 54px;
  align-items: center;
  min-height: 64px;
  border-top: 1px solid var(--lop-border-soft);
  background: rgba(255,255,255,0.86);
}

.modernus-lopasic-input {
  width: 100%;
  min-width: 0;
  height: 64px;
  padding: 0 18px !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  color: var(--lop-text) !important;
  background: transparent !important;
  font: 400 15px/1.2 var(--lop-font) !important;
}

.modernus-lopasic-input::placeholder {
  color: var(--lop-text-tertiary) !important;
}

.modernus-lopasic-input:disabled { opacity: .55; }

.modernus-lopasic-send-btn {
  appearance: none;
  width: 40px;
  height: 40px;
  margin-right: 10px;
  border: 0;
  border-radius: 999px;
  background: var(--lop-blue);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, opacity .16s ease;
}

.modernus-lopasic-send-btn:hover {
  background: var(--lop-blue-dark);
  transform: translateY(-1px);
}

.modernus-lopasic-send-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

.modernus-lopasic-wrap[data-font="sm"] .modernus-lopasic-bubble { font-size: 14px; }
.modernus-lopasic-wrap[data-font="md"] .modernus-lopasic-bubble { font-size: 15px; }
.modernus-lopasic-wrap[data-font="lg"] .modernus-lopasic-bubble { font-size: 17px; }
.modernus-lopasic-wrap[data-font="xl"] .modernus-lopasic-bubble { font-size: 20px; }

.modernus-lopasic-wrap[data-spacing="normal"] .modernus-lopasic-bubble { line-height: 1.55; }
.modernus-lopasic-wrap[data-spacing="wide"] .modernus-lopasic-bubble { line-height: 1.85; }
.modernus-lopasic-wrap[data-spacing="wider"] .modernus-lopasic-bubble { line-height: 2.15; }

.modernus-lopasic-wrap[data-contrast="high"] {
  --lop-bg: #ffffff;
  --lop-panel: #ffffff;
  --lop-text: #000000;
  --lop-text-secondary: #1d1d1f;
  --lop-text-tertiary: #3a3a3c;
  --lop-border: #000000;
  --lop-border-soft: rgba(0,0,0,0.42);
  --lop-user: #000000;
}

.modernus-lopasic-wrap[data-contrast="high"] .modernus-lopasic-bubble,
.modernus-lopasic-wrap[data-contrast="high"] .modernus-lopasic-sug,
.modernus-lopasic-wrap[data-contrast="high"] .modernus-lopasic-a11y-toggle {
  border: 1.5px solid #000;
}

@media (max-width: 720px) {
  .modernus-lopasic-wrap {
    margin: 12px 0;
    border-radius: 20px;
  }

  .modernus-lopasic-mode-popup {
    right: 12px;
    bottom: 12px;
    margin: 0;
    border-radius: 0;
  }

  .modernus-lopasic-mode-popup .modernus-lopasic-chat-panel {
    right: 0;
    bottom: 72px;
    width: calc(100vw - 24px);
    height: min(640px, calc(100vh - 96px));
    border-radius: 22px;
  }

  .modernus-lopasic-mode-popup .modernus-lopasic-popup-launcher {
    width: 58px;
    height: 58px;
    border-radius: 20px;
  }

  .modernus-lopasic-header {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 12px;
    padding: 14px;
  }

  .modernus-lopasic-avatar {
    width: 48px;
    height: 48px;
    border-radius: 16px;
  }

  .modernus-lopasic-controls { grid-column: 1 / -1; justify-content: space-between; }
  .modernus-lopasic-name { font-size: 21px !important; }
  .modernus-lopasic-desc { font-size: 12px; }

  .modernus-lopasic-messages {
    min-height: 320px;
    max-height: 500px;
    padding: 16px 12px 10px;
    gap: 12px;
  }

  .modernus-lopasic-bubble {
    max-width: 86%;
    padding: 12px 14px;
    font-size: 15px;
  }

  .modernus-lopasic-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 10px;
  }

  .modernus-lopasic-suggestions {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 12px;
    scrollbar-width: none;
  }

  .modernus-lopasic-suggestions::-webkit-scrollbar { display: none; }
  .modernus-lopasic-sug { flex: 0 0 auto; }
  .modernus-lopasic-input { font-size: 16px !important; }
}

@media (max-width: 420px) {
  .modernus-lopasic-era { display: none; }
  .modernus-lopasic-name { font-size: 19px !important; }
  .modernus-lopasic-bubble { max-width: 90%; }
}
