/* ==========================================
   Davix Chat – unified widget + bubble CSS
   Uses CSS variables only (no PHP here)
========================================== */

/* Shared base */
#davixChatWidget,
#davixChatWidget * {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, sans-serif;
}
#davixChatWidget button,
#davixChatWidget input,
#davixChatWidget a {
  text-decoration: none;
  font-family: inherit;
}
#davixChatWidget button {
  border: none;
  background: none;
  padding: 0;
  margin: 0;
}

/* Main layout */
#davixChatWidget {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: var(--widgetH, 100%);
  color: var(--davix-primary-text);
  background: var(--davix-composer-bg);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

/* Top bar */
.davix-topbar {
  background: linear-gradient(135deg, var(--davix-header-gradient-start), var(--davix-header-gradient-end));
  padding: 12px 16px;
  border-bottom: 1px solid var(--davix-divider);
}
.davix-topwrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.davix-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.davix-logo img {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
}
.davix-brand {
  font-weight: 800;
  font-size: var(--davix-brand-size, 26px);
  letter-spacing: .3px;
  color: var(--davix-header-title);
}
.davix-spacer {
  flex: 1;
}

/* Icon chips (theme / fullscreen) */
.davix-iconchip {
  width: var(--davix-icon-size, 32px);
  height: var(--davix-icon-size, 32px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--iconchipBorder, transparent);
  background: var(--iconchipBg, transparent);
  color: var(--davix-header-icon) !important;
  cursor: pointer;
  backdrop-filter: blur(0);
  transition: transform .12s ease, background-color .15s ease, box-shadow .2s ease;
}
.davix-iconchip .davix-ico {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}

/* Theme icon: show sun in light, moon in dark */
#davixChatWidget[data-theme="light"] .davix-icon-sun { display: block; }
#davixChatWidget[data-theme="light"] .davix-icon-moon { display: none; }
#davixChatWidget[data-theme="dark"] .davix-icon-sun { display: none; }
#davixChatWidget[data-theme="dark"] .davix-icon-moon { display: block; }

/* Fullscreen icon states */
#davix-fsBtn[data-fs="off"] .icon-enterFs { display: block; }
#davix-fsBtn[data-fs="off"] .icon-exitFs  { display: none; }
#davix-fsBtn[data-fs="on"] .icon-enterFs  { display: none; }
#davix-fsBtn[data-fs="on"] .icon-exitFs   { display: block; }

.davix-iconchip:hover {
  transform: scale(1.08);
  background: rgba(255, 255, 255, .28);
}
#davixChatWidget[data-theme="dark"] .davix-iconchip:hover {
  background: rgba(255, 255, 255, .12);
}

.davix-fallback {
  display: none;
}

/* Scroll area */
.davix-scroll {
  flex: 1 1 auto;
  overflow: auto;
  padding: 18px;
  background: var(--davix-chat-bg);
}
.davix-sys {
  font-size: 14px;
  color: var(--davix-muted-text);
  background: rgba(0, 0, 0, .04);
  border: 1px solid var(--davix-divider);
  padding: 10px 12px;
  border-radius: 10px;
  width: max-content;
  max-width: 92%;
  margin: 8px auto;
}

/* Bubbles */
.davix-row {
  display: flex;
  margin: 14px 0;
}
.davix-row.davix-bot  { justify-content: flex-start; }
.davix-row.davix-user { justify-content: flex-end; }

/* Different text colors per role */
.davix-row.davix-user .davix-bubble {
  color: var(--davix-user-text);
}

.davix-bubble {
  max-width: 78%;
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--davix-ai-bubble-bg);
  color: var(--davix-ai-text);
  border: 1px solid rgba(0, 0, 0, .06);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .05);
  line-height: 1.6;
  font-size: 16px;
}

/* Human agent bubble (Telegram replies) */
.davix-row.davix-human .davix-bubble {
  background: var(--davix-human-bubble-bg);
  color: var(--davix-human-text);
  border-style: dashed;
  font-style: italic;
}

.davix-bubble img {
  max-width: 100%;
  border-radius: 12px;
  border: 1px solid var(--davix-divider);
}

/* Composer */
.davix-composer {
  border-top: 1px solid var(--davix-divider);
  background: var(--davix-composer-bg);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Chips row ABOVE input+buttons */
.davix-chipsRow {
  padding: 8px 14px 0;
  max-width: 1400px;
  margin: 0 auto;
}
.davix-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.davix-bar {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  max-width: 1400px;
  margin: 0 auto;
}

.davix-inputWrap {
  flex: 1;
  display: flex;
}

/* Input */
#davix-msg {
  flex: 1;
  padding: 10px 12px;
  background: var(--davix-input-bg);
  border: 1px solid #ddd5c6;
  border-radius: 22px;
  outline: none;
  font-size: 14px;
  color: var(--davix-input-text);
}

/* Placeholder color */
#davixChatWidget input#davix-msg::placeholder {
  color: var(--davix-input-placeholder) !important;
  opacity: 1;
}

/* Attachment chips */
.davix-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--davix-user-bubble-bg);
  border: 1px solid var(--davix-user-bubble-border);
  color: var(--davix-primary-text);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
}
.davix-chip button {
  border: 0;
  background: transparent;
  color: var(--davix-muted-text);
  cursor: pointer;
  padding: 0 2px;
}
.davix-chip .davix-thumb {
  width: 18px;
  height: 18px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--davix-user-bubble-border);
}

/* Buttons (attach + send) */
.davix-btns {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
}

.davix-round {
  width: var(--davix-composer-button-size, var(--davix-round-size, 45px));
  height: var(--davix-composer-button-size, var(--davix-round-size, 45px));
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--davix-divider);
  cursor: pointer;
  transition: transform .12s ease, filter .15s ease, box-shadow .2s ease;
  background: var(--roundBg);
  color: var(--davix-header-icon) !important;
}
#davixChatWidget[data-theme="dark"] .davix-round {
  border-color: var(--davix-divider);
}
.davix-round .davix-ico {
  width: 22px;
  height: 22px;
  display: block;
  fill: currentColor;
}

/* Make sure SVGs follow theme color */
#davixChatWidget .davix-iconchip .davix-ico,
#davixChatWidget .davix-iconchip .davix-ico *,
#davixChatWidget .davix-round .davix-ico,
#davixChatWidget .davix-round .davix-ico * {
  fill: currentColor !important;
  stroke: currentColor !important;
  color: inherit;
}

.davix-round:hover {
  transform: scale(1.08);
  filter: brightness(1.05);
}
.davix-round.davix-solid {
  background: var(--roundBg);
  border-color: var(--davix-header-gradient-start);
}
.davix-round.davix-ghost {
  background: var(--roundBg);
  border-color: var(--davix-header-gradient-start);
}

/* Attachments inside bubbles */
.davix-attachments-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.davix-attachments-inline a {
  text-decoration: none;
  color: inherit;
}
.davix-attachments-inline a:focus {
  outline: 2px solid var(--davix-header-gradient-start);
  outline-offset: 2px;
}
.davix-attachments-inline .davix-thumb {
  width: 124px;
  height: 124px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--davix-divider);
}
.davix-attachments-inline .davix-filechip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--davix-user-bubble-bg);
  border: 1px solid var(--davix-user-bubble-border);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
}

.davix-bubble .davix-imglink img {
  cursor: zoom-in;
}
.davix-dlrow {
  margin-top: 6px;
  font-size: 12px;
  color: var(--davix-muted-text);
}
.davix-dlrow a {
  text-decoration: underline;
  color: inherit;
}

/* Fullscreen page mode */
html.page-fs,
body.page-fs {
  height: 100dvh;
  overflow: hidden;
}
.page-fs #davixChatWidget {
  position: fixed;
  inset: 0;
  z-index: 999999;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  margin: 0;
  border: 0;
  border-radius: 0;
}
.page-fs #davixChatWidget .davix-composer {
  padding-bottom: max(env(safe-area-inset-bottom), 12px);
}

/* Mobile bubbles */
@media (max-width: 640px) {
  .davix-bubble {
    max-width: 100%;
  }
}

/* Login popup / fullpage */
.davix-login-popup {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--davix-login-overlay, #1b2017);
  color: var(--davix-login-text-color, #e9efe5);
  text-align: center;
  font-size: var(--davix-login-text-size, 15px);
}
.davix-login-popup-card {
  max-width: 320px;
  background: var(--davix-login-card-bg, transparent);
  border: 1px solid var(--davix-login-card-border, transparent);
  border-radius: 20px;
  padding: 24px 20px;
  box-shadow: 0 12px 30px rgba(35, 49, 31, .12);
}
.davix-login-popup h2 {
  font-size: var(--davix-login-title-size, 26px);
  margin-bottom: 10px;
  color: var(--davix-login-title-color, #a3b783);
}
.davix-login-popup p {
  font-size: var(--davix-login-subtitle-size, 14px);
  margin-bottom: 16px;
  color: var(--davix-login-subtitle-color, #c7ccbf);
}
.davix-login-popup a {
  display: inline-block;
  padding: var(--davix-login-button-padding-y, 10px) var(--davix-login-button-padding-x, 18px);
  border-radius: var(--davix-login-button-radius, 999px);
  margin: 4px;
  border: 1px solid var(--davix-login-button-border, #6f8755);
  background: var(--davix-login-button-bg, #8ea66e);
  color: var(--davix-login-button-text, #0f160c);
  font-weight: 600;
  font-size: var(--davix-login-button-text-size, 14px);
}

.davix-login-fullwrap {
  max-width: 720px;
  margin: 40px auto;
}
.davix-login-fullcard {
  border-radius: 16px;
  border: 1px solid var(--davix-login-card-border, #e5e1d8);
  background: var(--davix-login-card-bg, #ffffff);
  box-shadow: 0 12px 30px rgba(35, 49, 31, .08);
  overflow: hidden;
}
.davix-login-fulltop {
  padding: 16px 20px;
  background: linear-gradient(135deg, #7f995f, #a3b783);
  display: flex;
  align-items: center;
  gap: 12px;
  color: #15200f;
}
.davix-login-fulltop img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
}
.davix-login-fullbrand {
  font-weight: 800;
  font-size: 20px;
}
.davix-login-fullbody {
  padding: 28px 22px 24px;
  text-align: center;
}
.davix-login-fullbody h1 {
  margin: 0 0 10px;
  font-size: var(--davix-login-title-size, 26px);
  color: var(--davix-login-title-color, #a3b783);
}
.davix-login-fullbody p {
  margin: 0 0 18px;
  color: var(--davix-login-text-color, #6b705b);
  font-size: var(--davix-login-text-size, 15px);
  line-height: 1.6;
}
.davix-login-fullbtns {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.davix-login-fullbtns a {
  display: inline-block;
  padding: var(--davix-login-button-padding-y, 10px) var(--davix-login-button-padding-x, 18px);
  border-radius: var(--davix-login-button-radius, 999px);
  border: 1px solid var(--davix-login-button-border, #6f8755);
  background: var(--davix-login-button-bg, #8ea66e);
  color: var(--davix-login-button-text, #0f160c);
  font-weight: 600;
  font-size: var(--davix-login-button-text-size, 14px);
}
.davix-login-fullbtns a.davix-primary {
  background: var(--davix-login-button-bg, #8ea66e);
  border-color: var(--davix-login-button-border, #6f8755);
  color: var(--davix-login-button-text, #0f160c);
}

/* Fullpage wrapper for shortcode */
.davix-fullpage-wrapper {
  max-width: 1100px;
  margin: 40px auto;
  height: 70vh;
}
.davix-fullpage-wrapper #davixChatWidget {
  height: 100%;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(35, 49, 31, .12);
}

/* Mode switch slot & chip styling */
#davixChatWidget .davix-mode-external {
  background: transparent;
  padding-top: 4px;
  padding-bottom: 0;
}
#davixChatWidget .davix-modeSwitch {
  background: transparent;
}
#davixChatWidget .davix-modeChip {
  background: transparent !important;
  border-color: var(--davix-divider);
  font-size: var(--davix-switch-text-size, 14px);
  border-radius: var(--davix-switch-radius, 999px);
  min-height: var(--davix-switch-height, 34px);
  padding: 4px 16px;
  display: inline-flex;
  align-items: center;
}

/* Bubble popup layout: widget inside popup fills remaining space */
#davix-chat-popup {
  display: flex;
  flex-direction: column;
}
#davix-chat-popup #davixChatWidget {
  --widgetH: auto;
  height: auto;
  flex: 1 1 auto;
}

/* ==========================
   Bubble Button + Popup CSS
========================== */

#davix-chat-bubble-container {
  position: fixed;
  bottom: var(--davix-bubble-offset-bottom);
  right:  var(--davix-bubble-offset-right, auto);
  left:   var(--davix-bubble-offset-left, auto);
  z-index: 9999;
}

#davix-chat-bubble-button {
  background-color: var(--davix-bubble-color);
  border: none;
  border-radius: 50%;
  width: var(--davix-bubble-size);
  height: var(--davix-bubble-size);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  background-image: var(--davix-bubble-logo-image);
  background-size: var(--davix-bubble-logo-size);
  background-position: center;
  background-repeat: no-repeat;
}

/* Popup */
#davix-chat-popup {
  position: fixed;
  bottom: calc(var(--davix-bubble-offset-bottom) + var(--davix-bubble-size) + 7px);
  right:  var(--davix-bubble-offset-right, auto);
  left:   var(--davix-bubble-offset-left, auto);
  width:  var(--davix-bubble-width-desktop);
  height: var(--davix-bubble-height-desktop);
  border: none;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  display: none; /* JS will set display:flex */
  z-index: 9998;
  overflow: hidden;
  background: transparent;
  flex-direction: column;
}

@media (max-width: 480px) {
  #davix-chat-popup {
    width:  var(--davix-bubble-width-mobile);
    height: var(--davix-bubble-height-mobile);
  }
}

@media (min-width: 481px) and (max-width: 1024px) {
  #davix-chat-popup {
    width:  var(--davix-bubble-width-tablet);
    height: var(--davix-bubble-height-tablet);
  }
}

/* Wrapper for the AI/Human switch button in bubble popup (row ABOVE header) */
#davix-bubble-switch-wrap {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  justify-content: var(--davix-switch-justify, center);
  align-items: center;
  padding-top: 4px;
  margin-bottom: var(--davix-switch-offset, 6px);
  background: transparent;
}

#davix-bubble-switch-wrap.davix-switch-left {
  justify-content: flex-start;
  text-align: left;
}

#davix-bubble-switch-wrap.davix-switch-center {
  justify-content: center;
  text-align: center;
}

#davix-bubble-switch-wrap.davix-switch-right {
  justify-content: flex-end;
  text-align: right;
}

/* Inner switch alignment */
#davix-bubble-switch-wrap .davix-mode-external,
#davix-bubble-switch-wrap .davix-modeSwitch {
  width: auto;
  text-align: left;
  margin: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start !important;
}
#davix-bubble-switch-wrap .davix-modeChip {
  margin: 0 !important;
}

#davix-bubble-switch-wrap.davix-switch-left  .davix-modeChip {
  margin-left: 0;
  margin-right: auto;
}

#davix-bubble-switch-wrap.davix-switch-center .davix-modeChip {
  margin-left: auto;
  margin-right: auto;
}

#davix-bubble-switch-wrap.davix-switch-right .davix-modeChip {
  margin-left: auto;
  margin-right: 0;
}

/* Remove extra padding/gap at the bottom of the bubble popup */
#davix-chat-popup {
  padding: 0;
}

/* Make the widget fill the popup so there is no weird bottom gap */
#davix-chat-popup .davix-widget {
  height: 100%;
  margin-bottom: 0;
}

/* Ensure scroll area uses remaining height nicely */
#davix-chat-popup .davix-scroll {
  max-height: none;
}

/* Just in case: chat bubbles (extra utility classes only) */
.davix-row-user {
  justify-content: flex-end;
}

.davix-row-bot {
  justify-content: flex-start;
}

.davix-bubble-user {
  background: var(--davix-user-bubble-bg);
  color: var(--davix-user-text, var(--davix-primary-text));
}

.davix-bubble-bot {
  background: var(--davix-composer-bg);
  color: var(--davix-ai-text, var(--davix-primary-text));
}

/* ==========================
   Debug log viewer styles
========================== */

body.davix-log-viewer {
  background: #050608;
  color: #f3f4f6;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0;
}

.davix-log-shell {
  min-height: 100vh;
  padding: 32px 16px;
}

.davix-log-panel {
  max-width: 960px;
  margin: 0 auto;
  background: #111827;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

.davix-log-panel h1 {
  margin-top: 0;
  color: #fff;
  font-size: 28px;
}

.davix-log-panel p {
  color: #d1d5db;
  line-height: 1.6;
}

.davix-log-panel a {
  color: #60a5fa;
}

.davix-log-output {
  background: #000;
  color: #f9fafb;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 20px;
  font-family: "SFMono-Regular", "Consolas", "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow: auto;
  max-height: 70vh;
}

.davix-log-actions {
  margin-top: 24px;
}

.davix-log-actions .button-link {
  display: inline-block;
  background: #1f2937;
  color: #f9fafb;
  padding: 12px 20px;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.davix-log-actions .button-link:hover {
  background: #374151;
  color: #fff;
}

/* ---------------------------------------------
   Admin credential callouts (API keys / tokens)
---------------------------------------------- */
.davix-credential-callout {
  background: #0b0d10;
  color: #ffffff;
  padding: 20px 24px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 22px 38px rgba(11, 13, 16, 0.55);
  width: min(100%, 640px);
  display: inline-flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
  margin: 4px 0;
  align-items: stretch;
}

.davix-credential-callout,
.davix-credential-callout label,
.davix-credential-callout span,
.davix-credential-callout strong,
.davix-credential-callout p {
  color: #ffffff;
}

.davix-credential-callout .description {
  color: rgba(255, 255, 255, 0.9) !important;
}

.davix-credential-callout code {
  color: #006fe6;
}

.davix-credential-callout input[type="password"],
.davix-credential-callout input[type="text"],
.davix-credential-callout input[type="email"],
.davix-credential-callout input[type="url"],
.davix-credential-callout textarea {
  width: 100%;
  max-width: 660px;
  background: #ffffff;
  color: #0d1c2c;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 12px 28px rgba(11, 13, 16, 0.35);
}

.davix-credential-callout input::placeholder,
.davix-credential-callout textarea::placeholder {
  color: rgba(8, 24, 40, 0.55);
}

.davix-credential-callout input:focus,
.davix-credential-callout textarea:focus {
  border-color: #b3d7ff;
  box-shadow: 0 0 0 1px #b3d7ff, 0 12px 28px rgba(11, 13, 16, 0.35);
  outline: none;
}

/* ---------------------------------------------------------
   Admin settings bubble styling (Chatbot, Auto-Reply, LLM)
--------------------------------------------------------- */
.wrap.davix-settings-screen {
  background: #f5f8ff;
  padding: 20px 28px 34px;
  border-radius: 26px;
  box-shadow: 0 30px 60px rgba(18, 37, 61, 0.08);
}

.wrap.davix-settings-screen .davix-top-save-wrap,
.wrap.davix-settings-screen .davix-bottom-save-wrap {
  background: transparent;
  display: flex;
  justify-content: flex-end;
}

.wrap.davix-settings-screen .davix-bottom-save-wrap {
  margin-top: 24px;
}

.wrap.davix-settings-screen .davix-top-save-wrap .submit,
.wrap.davix-settings-screen .davix-bottom-save-wrap .submit {
  margin: 0;
}

.wrap.davix-settings-screen h2,
.wrap.davix-settings-screen h3,
.wrap.davix-settings-screen h1,
.wrap.davix-settings-screen .davix-llm-preview-title {
  color: #0b0d10;
}

.davix-settings-bubble {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 26px;
  border: 1px solid transparent;
  margin-bottom: 32px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 18px 38px rgba(19, 54, 92, 0.14);
  overflow: hidden;
}

.davix-settings-bubble th,
.davix-settings-bubble td {
  padding: 18px 26px;
  vertical-align: top;
}

.davix-settings-bubble th {
  width: 240px;
  font-weight: 600;
}

.davix-settings-bubble tr + tr th,
.davix-settings-bubble tr + tr td {
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.davix-settings-bubble--js {
  background: linear-gradient(145deg, rgba(179, 215, 255, 0.98), rgba(179, 215, 255, 0.92));
  border-color: rgba(179, 215, 255, 0.75);
  color: #0b0d10;
}

.davix-settings-bubble--api {
  background: linear-gradient(140deg, rgba(11, 13, 16, 0.95), rgba(11, 13, 16, 0.98));
  border-color: rgba(255, 255, 255, 0.22);
  color: #f5f7fb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 20px 36px rgba(11, 13, 16, 0.55);
}

.davix-settings-bubble--css {
  background: linear-gradient(145deg, rgba(255, 201, 229, 0.98), rgba(255, 201, 229, 0.92));
  border-color: rgba(255, 201, 229, 0.7);
  color: #4a1d35;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 18px 32px rgba(74, 29, 53, 0.18);
}

.davix-settings-bubble--js th,
.davix-settings-bubble--js td,
.davix-settings-bubble--js label,
.davix-settings-bubble--js legend {
  color: #0b0d10;
}

.davix-settings-bubble--css th,
.davix-settings-bubble--css td,
.davix-settings-bubble--css label,
.davix-settings-bubble--css legend {
  color: #4a1d35;
}

.davix-settings-bubble--api th,
.davix-settings-bubble--api td,
.davix-settings-bubble--api label,
.davix-settings-bubble--api legend {
  color: rgba(255, 255, 255, 0.92);
}

.davix-settings-bubble input[type="text"],
.davix-settings-bubble input[type="password"],
.davix-settings-bubble input[type="number"],
.davix-settings-bubble input[type="url"],
.davix-settings-bubble input[type="email"],
.davix-settings-bubble textarea,
.davix-settings-bubble select {
  background: #ffffff;
  color: inherit;
  border: 1px solid rgba(179, 215, 255, 0.75);
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(11, 13, 16, 0.12);
  padding: 9px 14px;
}

.davix-settings-bubble--css input[type="text"],
.davix-settings-bubble--css input[type="password"],
.davix-settings-bubble--css input[type="number"],
.davix-settings-bubble--css input[type="url"],
.davix-settings-bubble--css input[type="email"],
.davix-settings-bubble--css textarea,
.davix-settings-bubble--css select {
  border-color: rgba(255, 201, 229, 0.8);
  box-shadow: 0 8px 18px rgba(74, 29, 53, 0.16);
}

.davix-settings-bubble--api input[type="text"],
.davix-settings-bubble--api input[type="password"],
.davix-settings-bubble--api input[type="number"],
.davix-settings-bubble--api input[type="url"],
.davix-settings-bubble--api input[type="email"],
.davix-settings-bubble--api textarea,
.davix-settings-bubble--api select {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(11, 13, 16, 0.45);
}

.davix-settings-bubble input[type="checkbox"],
.davix-settings-bubble input[type="radio"] {
  accent-color: #b3d7ff;
}

.davix-settings-bubble--css input[type="checkbox"],
.davix-settings-bubble--css input[type="radio"] {
  accent-color: #ffc9e5;
}

.davix-settings-bubble--api input[type="checkbox"],
.davix-settings-bubble--api input[type="radio"] {
  accent-color: #ffffff;
}

.davix-settings-bubble p.description,
.davix-settings-bubble .davix-llm-preview-status,
.davix-settings-bubble .davix-llm-preview-url span {
  color: rgba(11, 13, 16, 0.85);
}

.davix-settings-bubble a,
.davix-credential-callout a {
  color: #006fe6;
  text-shadow: 0 0 8px #fc0082;
}

.davix-settings-bubble a:hover,
.davix-settings-bubble a:focus,
.davix-credential-callout a:hover,
.davix-credential-callout a:focus {
  text-decoration: underline;
}

.davix-settings-bubble--css p.description {
  color: rgba(74, 29, 53, 0.85);
}

.davix-settings-bubble code {
  background: rgba(255, 255, 255, 0.7);
  color: #0b0d10;
  border-radius: 6px;
}

.davix-settings-bubble--css code {
  color: #4a1d35;
}

.davix-settings-bubble .davix-credential-callout,
.davix-settings-bubble--css .davix-credential-callout {
  background: #0b0d10;
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 22px 38px rgba(11, 13, 16, 0.55);
  margin-left: 0;
  margin-right: auto;
  width: min(100%, 640px);
}

.davix-settings-bubble--api .davix-credential-callout {
  background: rgba(0, 0, 0, 0.55);
  border-color: rgba(255, 255, 255, 0.28);
}

.davix-settings-bubble--api p.description {
  color: rgba(255, 255, 255, 0.75);
}

.wrap.davix-settings-screen .nav-tab-wrapper {
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.6);
  padding: 10px 14px;
  border-radius: 16px;
}

.wrap.davix-settings-screen .nav-tab {
  color: #0b0d10;
}

.wrap.davix-settings-screen .nav-tab-active {
  background: #ffffff;
  border-color: rgba(179, 215, 255, 0.75);
}
/* -------------------------------------------------
   Admin header + tabs styling
---------------------------------------------------*/
.davix-settings-screen {
  max-width: 1100px;
}

.davix-plugin-header {
  background: #0b0d10;
  color: #fff;
  padding: 22px 28px;
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(11, 13, 16, 0.25);
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.davix-plugin-header__logo-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}

.davix-plugin-header__spacer {
  flex: 1;
}

.davix-doc-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  background: #424a55;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.4px;
  box-shadow: 0 8px 18px #fc0082;
  transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease,
    box-shadow 0.2s ease;
}

.davix-doc-button:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.35);
  background: #ff64b4;
  box-shadow: 0 10px 22px #fc0082;
}

.davix-plugin-header__logo-row img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.davix-plugin-header__plugin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, rgba(179, 215, 255, 0.6), rgba(179, 215, 255, 0.35));
  box-shadow:
    0 14px 30px rgba(179, 215, 255, 0.4),
    inset 0 2px 8px rgba(255, 255, 255, 0.18);
  text-shadow: 0 4px 18px rgba(179, 215, 255, 0.65);
}

.davix-plugin-header__page-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 0;
  padding-top: 20px;
}

.davix-plugin-header__page {
  font-size: 28px;
  font-weight: 700;
}

.davix-plugin-header__description {
  margin: 0;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.78);
  max-width: 720px;
  line-height: 1.5;
}

.davix-plugin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding-top: 8px;
}

.davix-plugin-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: background 0.2s ease, color 0.2s ease, border 0.2s ease;
}

.davix-admin-notice-tray {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  margin: -4px 0 16px;
}

.davix-admin-notice-tray .notice,
.davix-admin-notice-tray .update-nag {
  width: min(100%, 420px);
  margin: 0;
}

.davix-admin-notice-tray .notice-dismiss {
  margin-right: -6px;
}

.davix-notice--relocated {
  animation: davixNoticeFade 0.35s ease;
  border-radius: 12px;
}

@keyframes davixNoticeFade {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 782px) {
  .davix-admin-notice-tray {
    align-items: stretch;
  }
}

.davix-plugin-tab:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.davix-plugin-tab.is-active {
  background: #fff;
  color: #0b0d10;
  border-color: transparent;
}

@media (max-width: 600px) {
  .davix-plugin-header {
    padding: 18px;
  }

  .davix-plugin-header__logo-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .davix-plugin-header__logo-row img {
    width: 48px;
    height: 48px;
  }

  .davix-plugin-header__plugin {
    font-size: 18px;
    padding: 6px 16px;
  }

  .davix-plugin-header__page {
    font-size: 24px;
  }
}

.davix-save-button.button-primary {
  background: #0b0d10;
  border-color: #0b0d10;
  color: #fff;
  border-radius: 999px;
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  text-transform: none;
}

.davix-save-button.button-primary:hover,
.davix-save-button.button-primary:focus {
  background: #0f1318;
  border-color: #0f1318;
  color: #fff;
}

.davix-save-button.button-primary:focus {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.davix-save-button.button-primary[disabled],
.davix-save-button.button-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.davix-aiwriter-panel .components-panel__body-title {
  background: #0b0d10;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px 6px 0 0;
}

.davix-aiwriter-panel .components-panel__body-title button,
.davix-aiwriter-panel .components-panel__body-title .components-panel__icon,
.davix-aiwriter-panel .components-panel__body-title .components-panel__arrow {
  color: #fff;
}

.davix-aiwriter-panel .components-panel__body {
  background: #b3d7ff;
  border-radius: 0 0 6px 6px;
}

.davix-aiwriter-panel-inner {
  background: #b3d7ff;
  padding: 12px;
  border-radius: 0 0 6px 6px;
}

.davix-aiwriter-docs-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.davix-aiwriter-doc-link {
  color: #006fe6;
  text-shadow: 0 0 8px #fc0082;
  font-weight: 600;
  text-decoration: underline;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.davix-aiwriter-doc-link:hover,
.davix-aiwriter-doc-link:focus {
  color: #ffc9e5;
  text-shadow: 0 0 10px #fc0082;
}

.davix-aiwriter-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.davix-aiwriter-expand {
  background: transparent;
  border: 2px solid #ffc9e5;
  border-radius: 6px;
  color: #ffc9e5;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.davix-aiwriter-expand:hover,
.davix-aiwriter-expand:focus {
  color: #fc0082;
  border-color: #fc0082;
  box-shadow: 0 0 8px #fc0082;
}

.davix-aiwriter-panel-inner .components-textarea-control__input,
.davix-aiwriter-panel-inner .components-text-control__input,
.davix-aiwriter-panel-inner .components-select-control__input {
  background: #fff;
}

.davix-aiwriter-prompt-modal.components-modal__frame {
  width: 960px;
  max-width: 90vw;
  min-height: 70vh;
}

.davix-aiwriter-prompt-modal .components-modal__content {
  min-height: 60vh;
}

.davix-aiwriter-prompt-modal .components-textarea-control__input {
  min-height: 320px;
}

.davix-aiwriter-pro-upsell {
  padding: 16px;
  margin: 8px 0;
  border: 2px dashed #ffc9e5;
  border-radius: 10px;
  background: #fff6fd;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.davix-aiwriter-pro-upsell__copy {
  max-width: 70%;
}

.davix-aiwriter-pro-upsell p {
  margin: 6px 0 0;
}

.davix-aiwriter-pro-upsell .components-button { /* Upgrade CTA stacked under text */
  align-self: stretch;
  justify-content: center;
}

.davix-aiwriter-generate.button-primary:hover,
.davix-aiwriter-generate.button-primary:focus {
  background: #ff64b4;
  border-color: #ff64b4;
  color: #fff;
}

.davix-aiwriter-generate.is-generating {
  background: #ff64b4;
  border-color: #ff64b4;
  color: #fff;
}

.davix-aiwriter-generate.is-generating[disabled],
.davix-aiwriter-generate.is-generating:disabled {
  opacity: 1;
  cursor: progress;
}

.davix-aiwriter-generate .components-spinner {
  border-top-color: #ff64b4;
  border-left-color: #ff64b4;
}