/* IMCourse24h Studio & Workbench Hybrid Live Chat + Instant AI Concierge */
.lc-root {
  position: fixed;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom, 20px));
  z-index: 48;
  font-family: var(--body-font, Manrope, system-ui, sans-serif);
}
.lc-root [hidden] {
  display: none !important;
}

/* Launcher Button */
.lc-launcher {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  padding: 10px 16px 10px 15px;
  border: 1px solid #4c61ea;
  border-radius: 13px;
  background-color: var(--studio-blue, #263bc5);
  background-image: linear-gradient(135deg, #273bc7 0%, #172377 100%);
  color: #fffdf7;
  font-family: var(--display, system-ui, sans-serif);
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow:
    0 18px 34px -12px rgba(17, 25, 78, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition:
    transform 180ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
    box-shadow 180ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1)),
    border-color 180ms ease;
}
.lc-launcher:hover {
  transform: translateY(-2px);
  border-color: var(--studio-signal, #ffd176);
  box-shadow:
    0 22px 38px -12px rgba(17, 25, 78, 0.68),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}
.lc-launcher:active {
  transform: scale(0.98);
}
.lc-launcher:focus-visible,
.lc-mode-btn:focus-visible,
.lc-icon-btn:focus-visible,
.lc-chip:focus-visible,
.lc-prompts-btn:focus-visible,
.lc-send-btn:focus-visible,
.lc-card-item:focus-visible {
  outline: 2.5px solid var(--studio-signal, #ffd176);
  outline-offset: 2px;
}

.lc-launcher-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2bd492;
  box-shadow: 0 0 0 3px rgba(43, 212, 146, 0.28);
  flex: none;
}
.lc-launcher-dot.is-ai {
  background: var(--studio-signal, #ffd176);
  box-shadow: 0 0 0 3px rgba(255, 209, 118, 0.28);
}
.lc-launcher-icon {
  display: inline-grid;
  place-items: center;
}
.lc-launcher-icon .icon {
  width: 19px;
  height: 19px;
}
.lc-launcher-pill {
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 209, 118, 0.44);
  background: rgba(255, 209, 118, 0.16);
  color: var(--studio-signal, #ffd176);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.lc-unread-badge {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  padding-inline: 5px;
  border-radius: 999px;
  background: var(--studio-signal, #ffd176);
  color: var(--navy-deep, #151b3d);
  font-size: 0.74rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Panel Window */
.lc-panel {
  position: fixed;
  right: 20px;
  bottom: calc(max(20px, env(safe-area-inset-bottom, 20px)) + 62px);
  width: min(412px, calc(100vw - 24px));
  height: min(605px, calc(100dvh - 102px));
  display: flex;
  flex-direction: column;
  border: 1px solid #2336ad;
  border-radius: 15px;
  background: var(--surface, #fffdf7);
  color: var(--ink, #202746);
  box-shadow:
    0 28px 64px -18px rgba(16, 23, 70, 0.48),
    0 6px 18px -6px rgba(16, 23, 70, 0.18);
  overflow: hidden;
  transform-origin: bottom right;
  animation: lcPanelOpen 190ms var(--ease-out, cubic-bezier(0.23, 1, 0.32, 1));
  transition: width 200ms var(--ease-out, ease), height 200ms var(--ease-out, ease);
}
.lc-panel.is-expanded {
  width: min(530px, calc(100vw - 28px));
  height: min(710px, calc(100dvh - 96px));
}
@keyframes lcPanelOpen {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Workbench Blueprint Header */
.lc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 13px;
  background-color: var(--studio-blue, #263bc5);
  background-image:
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(218, 226, 255, 0.08) 22px 23px),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(218, 226, 255, 0.08) 22px 23px),
    linear-gradient(135deg, #1b288f 0%, #263bc5 100%);
  color: #fffdf7;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}
.lc-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.lc-avatar-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  flex: none;
}
.lc-avatar {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: block;
  box-shadow: 0 4px 10px rgba(9, 14, 52, 0.35);
}
.lc-status-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #1d2b96;
  background: #2bd492;
  display: block;
}
.lc-status-dot.is-ai {
  background: var(--studio-signal, #ffd176);
}
.lc-header-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.lc-header-copy strong {
  font-family: var(--display, system-ui, sans-serif);
  font-size: 0.96rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-status-line {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: #e2e7ff;
  font-size: 0.73rem;
  font-weight: 680;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lc-header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
}
.lc-mode-btn {
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 209, 118, 0.55);
  border-radius: 8px;
  background: rgba(255, 209, 118, 0.16);
  color: #ffe5ad;
  font-size: 0.73rem;
  font-weight: 780;
  white-space: nowrap;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.lc-mode-btn:hover {
  background: rgba(255, 209, 118, 0.28);
  border-color: var(--studio-signal, #ffd176);
}
.lc-icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fffdf7;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.lc-icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.36);
}
.lc-icon-btn .icon {
  width: 15px;
  height: 15px;
}

/* Status Notice Bar */
.lc-offline-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  background: #eef1ff;
  border-bottom: 1px solid #d4dcf8;
  color: var(--studio-ink, #18246d);
  font-size: 0.74rem;
  line-height: 1.35;
  font-weight: 680;
}
.lc-offline-icon {
  display: inline-grid;
  place-items: center;
  color: var(--studio-blue, #263bc5);
  flex: none;
}
.lc-offline-icon .icon {
  width: 14px;
  height: 14px;
}

/* Message Stream */
.lc-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  background:
    radial-gradient(circle at top right, rgba(228, 233, 255, 0.55), transparent 55%),
    var(--paper, #faf8f1);
}
.lc-msg {
  display: flex;
  flex-direction: column;
  max-width: 89%;
  gap: 4px;
  animation: lcMsgFade 160ms var(--ease-out, ease);
}
@keyframes lcMsgFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.lc-msg-user {
  align-self: flex-end;
  align-items: flex-end;
}
.lc-msg-ai,
.lc-msg-agent {
  align-self: flex-start;
  align-items: flex-start;
}
.lc-msg-system {
  align-self: center;
  max-width: 95%;
}

.lc-meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding-inline: 2px;
  color: var(--muted, #555c73);
  font-size: 0.69rem;
  font-weight: 720;
}
.lc-tag {
  padding: 1px 6px;
  border-radius: 5px;
  background: #e4e9ff;
  border: 1px solid #c9d3fb;
  color: var(--studio-ink, #18246d);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.lc-msg-agent .lc-tag {
  background: #dff3e8;
  border-color: #b7dfc8;
  color: #165934;
}
.lc-speed-pill {
  color: #6a7394;
  font-size: 0.65rem;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.lc-bubble {
  padding: 10px 13px;
  border-radius: 13px;
  font-size: 0.875rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  box-shadow: 0 2px 6px rgba(20, 28, 76, 0.04);
}
.lc-msg-user .lc-bubble {
  background: linear-gradient(135deg, #2438bf 0%, #1a2891 100%);
  color: #fffdf7;
  border-bottom-right-radius: 4px;
}
.lc-msg-user.is-sending .lc-bubble {
  opacity: 0.86;
}
.lc-msg-ai .lc-bubble {
  background: #ffffff;
  color: var(--ink, #202746);
  border: 1px solid #d6dcf2;
  border-bottom-left-radius: 4px;
}
.lc-msg-agent .lc-bubble {
  background: #f0faf4;
  color: #153825;
  border: 1px solid #b8e0c7;
  border-bottom-left-radius: 4px;
}
.lc-msg-system .lc-bubble {
  background: #eef1fc;
  color: #283578;
  border: 1px solid #d4dcf8;
  font-size: 0.78rem;
  text-align: center;
  padding: 6px 12px;
  border-radius: 9px;
}

.lc-bubble a {
  color: var(--studio-blue, #263bc5);
  font-weight: 780;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lc-bubble a:hover {
  color: var(--studio-ink, #18246d);
}
.lc-msg-user .lc-bubble a {
  color: var(--studio-signal, #ffd176);
}
.lc-bubble code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #eef1fc;
  color: var(--studio-ink, #18246d);
  font-size: 0.81em;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.lc-bubble ul,
.lc-bubble ol {
  margin: 6px 0 2px;
  padding-left: 19px;
}
.lc-bubble li {
  margin-bottom: 4px;
}
.lc-bubble li:last-child {
  margin-bottom: 0;
}

/* Rich Interactive Course Cards inside AI Replies */
.lc-cards {
  display: grid;
  gap: 6px;
  width: 100%;
  margin-top: 3px;
}
.lc-card-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid #cfd7f4;
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink, #202746);
  text-decoration: none;
  box-shadow: 0 3px 10px -4px rgba(24, 36, 109, 0.12);
  transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}
.lc-card-item:hover {
  border-color: var(--studio-blue, #263bc5);
  background: #f6f8ff;
  transform: translateY(-1px);
}
.lc-card-thumb {
  width: 46px;
  height: 46px;
  border-radius: 7px;
  overflow: hidden;
  background: #e8ecff;
  border: 1px solid #d5dcf7;
  display: grid;
  place-items: center;
  color: var(--studio-blue, #263bc5);
  font-family: var(--display, sans-serif);
  font-weight: 800;
  font-size: 0.78rem;
  flex: none;
}
.lc-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.lc-card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lc-card-title {
  font-size: 0.8rem;
  font-weight: 780;
  color: var(--studio-ink, #18246d);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lc-card-meta {
  font-size: 0.69rem;
  color: var(--muted, #555c73);
  font-weight: 660;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lc-card-price {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex: none;
}
.lc-card-price strong {
  padding: 2px 7px;
  border-radius: 6px;
  background: #eef1ff;
  color: var(--studio-blue, #263bc5);
  font-size: 0.76rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.lc-card-cta {
  font-size: 0.67rem;
  font-weight: 780;
  color: var(--studio-ink, #18246d);
}

/* Typing State */
.lc-typing {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
}
.lc-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.lc-typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--studio-blue, #263bc5);
  animation: lcPulse 1.05s infinite ease-in-out;
}
.lc-typing-dots i:nth-child(2) { animation-delay: 0.16s; }
.lc-typing-dots i:nth-child(3) { animation-delay: 0.32s; }
.lc-typing-label {
  font-size: 0.77rem;
  font-weight: 700;
  color: var(--muted, #555c73);
}
@keyframes lcPulse {
  0%, 80%, 100% { opacity: 0.28; transform: scale(0.84); }
  40% { opacity: 1; transform: scale(1.12); }
}

/* Quick Prompt Rail */
.lc-quick-chips {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface, #fffdf7);
  border-top: 1px solid var(--line, #dedfe9);
}
.lc-quick-chips::-webkit-scrollbar {
  display: none;
}
.lc-chip {
  flex: none;
  min-height: 31px;
  padding: 5px 11px;
  border: 1px solid #c9d2f2;
  border-radius: 8px;
  background: #f3f5ff;
  color: var(--studio-ink, #18246d);
  font-size: 0.74rem;
  font-weight: 750;
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}
.lc-chip:hover {
  background: #e4e9ff;
  border-color: var(--studio-blue, #263bc5);
}
.lc-chip-context {
  background: #fff6df;
  border-color: #ebc266;
  color: #4f3500;
}
.lc-chip-context:hover {
  background: #ffecb8;
  border-color: #d99f26;
}

/* Follow-up Email Bar */
.lc-email-bar {
  display: flex;
  gap: 6px;
  padding: 7px 12px;
  background: #fff8e6;
  border-top: 1px solid #efdba8;
}
.lc-email-bar input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid #d5c08c;
  border-radius: 8px;
  background: #fff;
  color: var(--ink, #202746);
  font-size: 0.82rem;
}
.lc-email-bar button {
  min-height: 34px;
  padding: 5px 11px;
  border: 0;
  border-radius: 8px;
  background: var(--navy-deep, #151b3d);
  color: #fffdf7;
  font-size: 0.76rem;
  font-weight: 780;
  white-space: nowrap;
  cursor: pointer;
}

/* Composer */
.lc-composer {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  padding: 10px 11px;
  background: var(--surface, #fffdf7);
  border-top: 1px solid var(--line, #dedfe9);
}
.lc-prompts-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line-strong, #bfc3da);
  border-radius: 10px;
  background: #f4f6ff;
  color: var(--studio-ink, #18246d);
  flex: none;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.lc-prompts-btn:hover,
.lc-prompts-btn.is-active {
  background: #e4e9ff;
  border-color: var(--studio-blue, #263bc5);
}
.lc-prompts-btn .icon {
  width: 17px;
  height: 17px;
}

.lc-composer textarea {
  flex: 1 1 auto;
  min-height: 40px;
  max-height: 112px;
  resize: none;
  padding: 9px 12px;
  border: 1px solid var(--line-strong, #bfc3da);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink, #202746);
  font-size: 0.88rem;
  line-height: 1.4;
  transition: border-color 140ms ease;
}
.lc-composer textarea:focus {
  border-color: var(--studio-blue, #263bc5);
  outline: 2px solid rgba(38, 59, 197, 0.22);
  outline-offset: 0;
}
.lc-send-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--studio-blue, #263bc5);
  color: #fffdf7;
  flex: none;
  cursor: pointer;
  transition: background 140ms ease, transform 120ms ease, opacity 140ms ease;
}
.lc-send-btn:hover:not(:disabled) {
  background: var(--primary-hover, #18237d);
}
.lc-send-btn:active:not(:disabled) {
  transform: scale(0.95);
}
.lc-send-btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  .lc-launcher,
  .lc-panel,
  .lc-msg,
  .lc-card-item,
  .lc-typing-dots i {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 560px) {
  .lc-root {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom, 12px));
  }
  .lc-launcher {
    min-height: 48px;
    padding: 9px 14px;
  }
  .lc-launcher-pill,
  .lc-expand-btn {
    display: none;
  }
  .lc-panel,
  .lc-panel.is-expanded {
    right: 8px;
    left: 8px;
    bottom: calc(max(12px, env(safe-area-inset-bottom, 12px)) + 56px);
    width: auto;
    height: min(560px, calc(100dvh - 80px));
  }
  /* Prevent iOS Safari input auto-zoom */
  .lc-composer textarea,
  .lc-email-bar input {
    font-size: 16px;
  }
}
