/* ==========================================================================
   TrimFile - TrimBot Smart Guide & Navigator Stylesheet
   ========================================================================== */

:root {
  --tb-primary: #e11d48;
  --tb-primary-hover: #be123c;
  --tb-primary-glow: rgba(225, 29, 72, 0.4);
  --tb-bg: rgba(10, 14, 20, 0.94);
  --tb-card-border: rgba(225, 29, 72, 0.28);
  --tb-text: #f8fafc;
  --tb-text-muted: #94a3b8;
  --tb-user-msg-bg: linear-gradient(135deg, #9f1239 0%, #6f0d23 100%);
  --tb-bot-msg-bg: rgba(18, 24, 34, 0.85);
  --tb-radius: 18px;
}

/* Floating 3D Spherical Launcher Button */
.trimbot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9998;
  width: 58px;
  height: 58px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.trimbot-launcher-sphere {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #ff4b72 0%, #e11d48 30%, #be123c 60%, #6f0d23 88%, #38040e 100%);
  box-shadow: 
    inset 0 2px 4px rgba(255, 255, 255, 0.65),
    inset 0 -6px 14px rgba(0, 0, 0, 0.75),
    inset -3px 0 8px rgba(0, 0, 0, 0.5),
    0 10px 26px rgba(0, 0, 0, 0.65),
    0 0 24px rgba(225, 29, 72, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 3D Specular Highlight Curvature */
.trimbot-launcher-gloss {
  position: absolute;
  top: 3px;
  left: 8px;
  width: 38px;
  height: 19px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
  transform: rotate(-14deg);
  z-index: 3;
}

/* TrimBot Avatar inside the sphere */
.trimbot-launcher-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  z-index: 2;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: block;
}

/* Pulse dot on the sphere perimeter - positioned outside overflow:hidden so it never gets clipped */
.trimbot-launcher .trimbot-pulse-dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 12px;
  height: 12px;
  background: #10b981;
  border: 2px solid #06090e;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981, 0 0 14px rgba(16, 185, 129, 0.6);
  z-index: 10;
  pointer-events: none;
  animation: trimbotBeacon 2s infinite ease-in-out;
}

@keyframes trimbotBeacon {
  0%, 100% {
    background: #10b981;
    box-shadow: 0 0 6px #10b981, 0 0 10px rgba(16, 185, 129, 0.5);
    transform: scale(1);
  }
  50% {
    background: #34d399;
    box-shadow: 0 0 10px #34d399, 0 0 18px rgba(52, 211, 153, 0.85);
    transform: scale(1.15);
  }
}

/* Hover 3D floating effect */
.trimbot-launcher:hover {
  transform: translateY(-4px) scale(1.08);
}
.trimbot-launcher:hover .trimbot-launcher-sphere {
  box-shadow: 
    inset 0 3px 6px rgba(255, 255, 255, 0.8),
    inset 0 -8px 18px rgba(0, 0, 0, 0.8),
    0 16px 36px rgba(0, 0, 0, 0.75),
    0 0 35px rgba(225, 29, 72, 0.8),
    0 0 0 1px rgba(255, 255, 255, 0.25);
}
.trimbot-launcher:hover .trimbot-launcher-avatar {
  transform: scale(1.05);
}
.trimbot-launcher:active {
  transform: translateY(-1px) scale(0.98);
}

/* Active chat open state */
.trimbot-launcher.chat-open .trimbot-launcher-sphere {
  box-shadow: 
    inset 0 2px 4px rgba(255, 255, 255, 0.7),
    inset 0 -6px 14px rgba(0, 0, 0, 0.7),
    0 0 30px rgba(225, 29, 72, 0.85),
    0 0 0 2px rgba(254, 205, 211, 0.65);
}

/* Tooltip badge next to 3D sphere */
.trimbot-launcher-tooltip {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  background: rgba(14, 18, 26, 0.95);
  border: 1px solid rgba(225, 29, 72, 0.4);
  color: #ffffff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10;
}
.trimbot-launcher:hover .trimbot-launcher-tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.trimbot-pulse-dot {
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  animation: trimbotPulse 2s infinite ease-in-out;
}

@keyframes trimbotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.25); }
}

/* Chat Window Container */
.trimbot-window {
  position: fixed;
  bottom: 84px;
  right: 24px;
  z-index: 9999;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 110px);
  background: var(--tb-bg);
  border: 1px solid var(--tb-card-border);
  border-radius: var(--tb-radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 30px rgba(225, 29, 72, 0.22);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.trimbot-window.active {
  display: flex;
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.trimbot-header {
  padding: 14px 16px;
  background: rgba(14, 18, 26, 0.95);
  border-bottom: 1px solid rgba(225, 29, 72, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.trimbot-header-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trimbot-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff4b72 0%, #e11d48 40%, #700d23 100%);
  border: 1.5px solid rgba(254, 205, 211, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 14px rgba(225, 29, 72, 0.4), inset 0 1px 3px rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

.trimbot-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.trimbot-title-wrap {
  display: flex;
  flex-direction: column;
}

.trimbot-name {
  font-size: 0.94rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.trimbot-status {
  font-size: 0.7rem;
  color: #a7f3d0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.trimbot-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.trimbot-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.trimbot-btn-icon {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.trimbot-btn-icon:hover {
  color: #ffffff;
  background: rgba(225, 29, 72, 0.18);
}

/* Messages Area */
.trimbot-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.86rem;
  line-height: 1.5;
  box-sizing: border-box;
}

.trimbot-messages::-webkit-scrollbar {
  width: 5px;
}
.trimbot-messages::-webkit-scrollbar-thumb {
  background: rgba(225, 29, 72, 0.25);
  border-radius: 4px;
}

/* Message Rows */
.trimbot-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  word-break: break-word;
}

.trimbot-msg.bot {
  align-self: flex-start;
}

.trimbot-msg.user {
  align-self: flex-end;
}

.trimbot-bubble {
  padding: 10px 14px;
  border-radius: 14px;
}

.trimbot-msg.bot .trimbot-bubble {
  background: var(--tb-bot-msg-bg);
  border: 1px solid rgba(225, 29, 72, 0.22);
  color: var(--tb-text);
  border-top-left-radius: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.trimbot-msg.user .trimbot-bubble {
  background: var(--tb-user-msg-bg);
  border: 1px solid rgba(244, 63, 94, 0.4);
  color: #ffffff;
  border-top-right-radius: 3px;
  box-shadow: 0 4px 12px rgba(112, 13, 35, 0.35);
}

.trimbot-time {
  font-size: 0.65rem;
  color: #64748b;
  margin-top: 4px;
  padding: 0 4px;
}

.trimbot-msg.user .trimbot-time {
  text-align: right;
}

/* Action Card inside Bot Message */
.trimbot-action-card {
  margin-top: 8px;
  background: rgba(225, 29, 72, 0.1);
  border: 1px solid rgba(225, 29, 72, 0.35);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trimbot-action-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #fecdd3;
  display: flex;
  align-items: center;
  gap: 6px;
}

.trimbot-action-btn {
  background: linear-gradient(135deg, #be123c 0%, #881337 100%);
  border: 1px solid rgba(254, 205, 211, 0.4);
  color: #ffffff !important;
  text-decoration: none !important;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  cursor: pointer;
}

.trimbot-action-btn:hover {
  background: linear-gradient(135deg, #e11d48 0%, #9f1239 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.4);
}

/* Starter Quick Chips */
.trimbot-chips-title {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 6px;
  margin-bottom: 2px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.trimbot-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.trimbot-chip {
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.25);
  color: #fda4af;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s ease;
  user-select: none;
}

.trimbot-chip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f43f5e;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.trimbot-chip-text {
  font-weight: 600;
}

.trimbot-chip:hover {
  background: rgba(225, 29, 72, 0.22);
  color: #ffffff;
  border-color: rgba(225, 29, 72, 0.45);
  transform: translateY(-1px);
}

.trimbot-chip:hover .trimbot-chip-icon {
  color: #ffffff;
}

/* Typing Indicator */
.trimbot-typing {
  display: none;
  align-self: flex-start;
  background: var(--tb-bot-msg-bg);
  border: 1px solid rgba(225, 29, 72, 0.2);
  padding: 8px 14px;
  border-radius: 14px;
  border-top-left-radius: 3px;
  gap: 5px;
  align-items: center;
}

.trimbot-dot {
  width: 6px;
  height: 6px;
  background: #fda4af;
  border-radius: 50%;
  animation: trimbotBounce 1.4s infinite ease-in-out;
}
.trimbot-dot:nth-child(2) { animation-delay: 0.2s; }
.trimbot-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes trimbotBounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* Chat Input Bar */
.trimbot-input-bar {
  padding: 12px 14px;
  background: rgba(14, 18, 26, 0.95);
  border-top: 1px solid rgba(225, 29, 72, 0.25);
  display: flex;
  gap: 8px;
  align-items: center;
  box-sizing: border-box;
}

.trimbot-input {
  flex: 1;
  background: rgba(4, 10, 14, 0.9);
  border: 1px solid rgba(225, 29, 72, 0.3);
  border-radius: 12px;
  padding: 10px 14px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.trimbot-input:focus {
  border-color: #e11d48;
  box-shadow: 0 0 12px rgba(225, 29, 72, 0.3);
}

.trimbot-input::placeholder {
  color: #64748b;
  font-size: 0.82rem;
}

.trimbot-btn-send {
  background: linear-gradient(135deg, #be123c 0%, #881337 100%);
  border: 1px solid rgba(254, 205, 211, 0.35);
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.trimbot-btn-send:hover:not(:disabled) {
  background: linear-gradient(135deg, #e11d48 0%, #9f1239 100%);
  box-shadow: 0 0 12px rgba(225, 29, 72, 0.4);
  transform: translateY(-1px);
}

.trimbot-btn-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .trimbot-launcher {
    bottom: 16px;
    right: 16px;
    width: 52px;
    height: 52px;
  }
  .trimbot-launcher-sphere {
    width: 52px;
    height: 52px;
  }
  .trimbot-launcher-avatar {
    width: 38px;
    height: 38px;
  }
  .trimbot-window {
    bottom: 72px;
    right: 12px;
    width: calc(100vw - 24px);
    height: calc(100vh - 90px);
  }
}

/* In-Chat Report Issue Card (Embedded inside TrimBot) */
.trimbot-inchat-report {
  margin-top: 10px;
  background: rgba(18, 22, 34, 0.98);
  border: 1px solid rgba(225, 29, 72, 0.4);
  border-radius: 14px;
  padding: 14px 14px 12px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 0 16px rgba(225, 29, 72, 0.15);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.trimbot-inchat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.trimbot-inchat-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 800;
  color: #ffffff;
}

.trimbot-inchat-title svg {
  color: #fb7185;
  flex-shrink: 0;
}

.trimbot-inchat-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(225, 29, 72, 0.2);
  border: 1px solid rgba(225, 29, 72, 0.5);
  color: #fecdd3;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.trimbot-inchat-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.trimbot-inchat-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.trimbot-inchat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #cbd5e1;
}

.trimbot-inchat-count {
  font-size: 0.68rem;
  color: #64748b;
  font-family: var(--font-mono, monospace);
}

.trimbot-inchat-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.trimbot-inchat-cat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.69rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  font-family: inherit;
}

.trimbot-inchat-cat:hover {
  background: rgba(225, 29, 72, 0.15);
  border-color: rgba(225, 29, 72, 0.4);
  color: #ffffff;
}

.trimbot-inchat-cat.is-selected {
  background: rgba(225, 29, 72, 0.28);
  border-color: #e11d48;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(225, 29, 72, 0.3);
}

.trimbot-inchat-textarea {
  width: 100%;
  background: rgba(9, 12, 18, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.76rem;
  line-height: 1.4;
  padding: 8px 10px;
  resize: vertical;
  min-height: 60px;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.trimbot-inchat-textarea:focus,
.trimbot-inchat-input:focus {
  outline: none;
  border-color: var(--tb-accent, #e11d48);
  box-shadow: 0 0 10px rgba(225, 29, 72, 0.35);
}

.trimbot-inchat-input {
  width: 100%;
  background: rgba(9, 12, 18, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.74rem;
  padding: 6px 10px;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.trimbot-inchat-diag {
  font-size: 0.68rem;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 5px;
}

.trimbot-inchat-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.trimbot-inchat-btn-cancel {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 0.15s ease;
}

.trimbot-inchat-btn-cancel:hover {
  color: #ffffff;
}

.trimbot-inchat-btn-submit {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  border: 1px solid rgba(254, 205, 211, 0.4);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  font-family: inherit;
}

.trimbot-inchat-btn-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.45);
}

.trimbot-inchat-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* In-Chat Success View */
.trimbot-inchat-success {
  padding: 16px 12px;
  text-align: center;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.trimbot-inchat-success-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(16, 185, 129, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6ee7b7;
  margin-bottom: 2px;
}

.trimbot-inchat-success-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #ffffff;
}

.trimbot-inchat-success-sub {
  font-size: 0.74rem;
  color: #94a3b8;
  line-height: 1.4;
  max-width: 280px;
}

.trimbot-inchat-ticket {
  font-size: 0.7rem;
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 3px 9px;
  border-radius: 6px;
  margin-top: 4px;
}
