/* =========================================================================
   Gateonix Feedback Console — styles
   Scope: every rule is namespaced under .gtx-fb-* / #gtx-fb-* so this can be
   dropped into any existing page without colliding with your own CSS.

   DESIGN TOKENS
   Color   --gtx-fb-bg-deep   #0b1a14  board backdrop (deep PCB green)
           --gtx-fb-bg-panel  #10241c  panel surface (PCB solder-mask green)
           --gtx-fb-bg-raise  #16301f  input / card surface, one step up
           --gtx-fb-silk      #eef4ee  primary text (silkscreen ink)
           --gtx-fb-silk-dim  #93a89b  secondary text / meta
           --gtx-fb-copper    #c68a3d  borders, traces, focus rings
           --gtx-fb-led       #ff6a48  live indicator, primary CTA
           --gtx-fb-trace     #4fae7c  success / lit-trace accent
   Type    display/meta: ui-monospace stack (silkscreen stencil feel)
           body: system-ui sans stack
   Layout  fixed vertical edge tab -> slide-in panel (right, 380px desktop;
           bottom sheet under 640px)
   Signature: a submitted message travels a copper trace and "lights up"
           the feed entry it lands in.
   ========================================================================= */

.gtx-feedback-widget,
.gtx-feedback-embed {
  --gtx-fb-bg-deep: #080a0e;
  --gtx-fb-bg-panel: #0f1218;
  --gtx-fb-bg-raise: #161b24;
  --gtx-fb-silk: #f8fafc;
  --gtx-fb-silk-dim: #94a3b8;
  --gtx-fb-copper: #00d4aa;
  --gtx-fb-copper-dim: #1e293b;
  --gtx-fb-led: #00d4aa;
  --gtx-fb-trace: #00d4aa;
  --gtx-fb-font-mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --gtx-fb-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}

.gtx-feedback-widget *,
.gtx-feedback-embed * {
  box-sizing: border-box;
}

/* ---------- edge tab ---------- */

.gtx-fb-tab {
  position: fixed;
  top: 50%;
  right: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  background: var(--gtx-fb-bg-panel);
  border: 1px solid var(--gtx-fb-copper-dim);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: var(--gtx-fb-silk);
  font-family: var(--gtx-fb-font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  cursor: pointer;
  transform: translate(0, -50%);
  transition: background-color 0.15s ease, padding-right 0.15s ease, transform 0.15s ease;
  box-shadow: -2px 2px 10px rgba(0, 0, 0, 0.35);
}

.gtx-fb-tab:hover {
  background: var(--gtx-fb-bg-raise);
  padding-right: 14px;
}

.gtx-fb-tab:focus-visible {
  outline: 2px solid var(--gtx-fb-copper);
  outline-offset: 2px;
}

.gtx-fb-tab-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gtx-fb-trace);
  box-shadow: 0 0 6px var(--gtx-fb-trace);
  flex-shrink: 0;
  animation: gtx-fb-pulse 2.4s ease-in-out infinite;
}

.gtx-feedback-widget[data-open="true"] .gtx-fb-tab {
  transform: translate(100%, -50%);
}

/* ---------- overlay (mobile focus) ---------- */

.gtx-fb-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147482998;
  background: rgba(4, 10, 7, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.gtx-feedback-widget[data-open="true"] .gtx-fb-overlay {
  opacity: 1;
  pointer-events: auto;
}

/* ---------- chat window ---------- */

.gtx-chat-window {
  display: flex;
  flex-direction: column;
  background: rgba(15, 18, 24, 0.7);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  color: var(--gtx-fb-silk);
  font-family: var(--gtx-fb-font-sans) !important;
  border-radius: 16px;
  border: 1px solid rgba(0, 212, 170, 0.15);
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.05);
  position: relative;
}

.gtx-chat-window::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 212, 170, 0.6), transparent);
}

.gtx-chat-window-floating {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2147482999;
  width: min(380px, calc(100vw - 48px));
  height: 600px;
  max-height: calc(100vh - 48px);
  transform: translateY(120%) scale(0.95);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.gtx-feedback-widget[data-open="true"] .gtx-chat-window-floating {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Embed specifically */
.gtx-feedback-embed .gtx-chat-window {
  width: 100%;
  max-width: 600px;
  height: 600px;
  margin: 40px auto;
}

/* ---------- chat header ---------- */

.gtx-chat-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: rgba(22, 27, 36, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  flex-shrink: 0;
  cursor: default;
  position: relative;
  overflow: hidden;
}

.gtx-chat-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.02), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.gtx-chat-header:hover::after {
  transform: translateX(100%);
}

.gtx-chat-avatar {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(0, 212, 170, 0.15), rgba(0, 212, 170, 0.05));
  border: 1px solid rgba(0, 212, 170, 0.2);
  color: #00d4aa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-right: 14px;
  box-shadow: 0 0 15px rgba(0, 212, 170, 0.15), inset 0 2px 4px rgba(255,255,255,0.1);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.gtx-chat-header:hover .gtx-chat-avatar {
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(0, 212, 170, 0.3), inset 0 2px 4px rgba(255,255,255,0.2);
}

.status-dot {
  position: absolute;
  bottom: 0px;
  right: 0px;
  width: 12px;
  height: 12px;
  background: #00d4aa;
  border-radius: 50%;
  border: 2px solid var(--gtx-fb-bg-panel);
  animation: gtx-fb-pulse 2s infinite ease-in-out;
  box-shadow: 0 0 8px #00d4aa;
}

.gtx-chat-info h3 {
  margin: 0 0 2px 0;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--gtx-fb-font-sans) !important;
  letter-spacing: normal !important;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.gtx-chat-info p {
  margin: 0;
  font-size: 13px;
  color: var(--gtx-fb-silk-dim);
}

.gtx-chat-close {
  background: none;
  border: none;
  color: var(--gtx-fb-silk-dim);
  font-size: 18px;
  margin-left: auto;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.gtx-chat-close:hover {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
}
.gtx-chat-close:active {
  transform: scale(0.9);
}

/* ---------- chat feed ---------- */

.gtx-chat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: 
    radial-gradient(circle at 10% 20%, rgba(0, 212, 170, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(140, 120, 240, 0.03) 0%, transparent 40%),
    transparent;
}

.gtx-chat-feed::-webkit-scrollbar {
  width: 6px;
}
.gtx-chat-feed::-webkit-scrollbar-track {
  background: transparent;
}
.gtx-chat-feed::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

.gtx-fb-empty, .gtx-fb-status {
  text-align: center;
  color: var(--gtx-fb-silk-dim);
  font-family: var(--gtx-fb-font-mono);
  font-size: 13px;
  margin: auto 0;
}

/* chat bubbles */
.gtx-chat-bubble-left,
.gtx-chat-bubble-right {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: gtx-chat-slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
  transform: translateY(10px);
}

@keyframes gtx-chat-slide-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gtx-chat-bubble-left {
  align-self: flex-start;
}
.gtx-chat-bubble-right {
  align-self: flex-end;
  align-items: flex-end;
}

.gtx-chat-bubble-inner {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
  position: relative;
}

.gtx-chat-bubble-left .gtx-chat-bubble-inner {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.8) 100%);
  color: var(--gtx-fb-silk);
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.05);
}

.gtx-chat-bubble-right .gtx-chat-bubble-inner {
  background: linear-gradient(135deg, #00d4aa 0%, #00a887 100%);
  color: #04100d;
  font-weight: 500;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 212, 170, 0.25), inset 0 1px 1px rgba(255,255,255,0.4);
}

.gtx-chat-name-lbl {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #00d4aa;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gtx-chat-bubble-right .gtx-chat-name-lbl {
  display: none;
}

.gtx-chat-msg-text {
  margin: 0;
  white-space: pre-wrap;
}

.gtx-chat-time {
  font-size: 10px;
  color: var(--gtx-fb-silk-dim);
  margin-top: 6px;
  padding: 0 4px;
  opacity: 0.7;
}

/* ---------- chat input ---------- */

.gtx-chat-input-bar {
  padding: 16px 20px;
  background: rgba(22, 27, 36, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.gtx-chat-name {
  background: none;
  border: none;
  color: var(--gtx-fb-silk-dim);
  font-family: var(--gtx-fb-font-sans) !important;
  font-size: 12px;
  padding: 0 4px;
  transition: color 0.2s;
}

.gtx-chat-name:focus {
  outline: none;
  color: var(--gtx-fb-silk);
}

.gtx-chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  background: rgba(15, 18, 24, 0.6);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 24px;
  padding: 6px 6px 6px 16px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.2);
}

.gtx-chat-input-wrapper:focus-within {
  background: rgba(15, 18, 24, 0.9);
  border-color: #00d4aa;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.2), 0 0 0 3px rgba(0, 212, 170, 0.15);
}

.gtx-chat-textarea {
  flex: 1;
  background: none;
  border: none;
  color: var(--gtx-fb-silk);
  font-family: var(--gtx-fb-font-sans) !important;
  font-size: 15px;
  resize: none;
  padding: 10px 0;
  margin: 0;
  max-height: 120px;
  outline: none;
}

.gtx-chat-textarea::placeholder {
  color: var(--gtx-fb-silk-dim);
}

.gtx-chat-send {
  background: linear-gradient(135deg, #00d4aa 0%, #00a887 100%);
  color: #0b1a14;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-bottom: 2px;
  margin-left: 8px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 212, 170, 0.3);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s;
}

.gtx-chat-send:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 212, 170, 0.4);
}

.gtx-chat-send:active {
  transform: scale(0.9);
}

.gtx-chat-send:disabled {
  background: var(--gtx-fb-copper-dim);
  color: var(--gtx-fb-silk-dim);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.gtx-fb-hp {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.gtx-fb-form-msg {
  font-size: 12px;
  margin: 4px 0 0 4px;
}
.gtx-fb-form-msg[data-kind="error"] { color: var(--gtx-fb-led); }
.gtx-fb-form-msg[data-kind="ok"] { color: var(--gtx-fb-trace); }

@media (max-width: 640px) {
  .gtx-chat-window-floating {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 85vh;
    border-radius: 16px 16px 0 0;
  }
}
