/*
 * TekComputer — Quick chat-style intake widget.
 * All rules scoped under #tci-root to avoid affecting the rest of the site.
 */
/*
 * Root is a fixed, full-viewport layer with explicit z-index so the FAB stays
 * above .header (z-index: 100). Using isolation: isolate + z-index: auto placed
 * the whole widget *under* the header stacking context, hiding the button.
 */
#tci-root {
  --tci-fab-size: 3.35rem;
  --tci-fab-gap: 1.15rem;
  --tci-accent: #4d9fff;
  --tci-accent-dark: #0a3d8a;
  --tci-surface: rgba(18, 24, 42, 0.82);
  --tci-surface-2: rgba(26, 34, 56, 0.78);
  --tci-border: rgba(255, 255, 255, 0.1);
  --tci-text: #f0f4fc;
  --tci-muted: #9aa8c4;
  --tci-radius: 14px;
  --tci-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  position: fixed;
  inset: 0;
  /* Below .sr-submit-overlay (10050) on Service Request page */
  z-index: 10045;
  pointer-events: none;
}

/*
 * Home / contact / demo: higher z-index so the FAB stays above page chrome/overlays.
 * Service request page keeps 10045 so the submit success overlay (10050) stays on top.
 */
body:not(.service-request-page) #tci-root {
  z-index: 999999;
}

/* Preloader (.site-preloader) is z-index 99990; chat uses 999999 on most pages — hide FAB until load overlay dismisses */
html.preloader-lock #tci-root,
body.preloader-lock #tci-root {
  visibility: hidden !important;
  pointer-events: none !important;
}

#tci-root,
#tci-root * {
  box-sizing: border-box;
}

#tci-root .tci-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Floating action: fixed to viewport (stays bottom-right while scrolling) */
#tci-root .tci-fab {
  position: fixed;
  z-index: 2;
  pointer-events: auto;
  bottom: var(--tci-fab-gap);
  right: var(--tci-fab-gap);
  width: var(--tci-fab-size);
  height: var(--tci-fab-size);
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  cursor: pointer;
  background: linear-gradient(145deg, var(--tci-accent) 0%, var(--tci-accent-dark) 100%);
  color: #fff;
  box-shadow: var(--tci-shadow), 0 0 0 1px rgba(0, 0, 0, 0.2);
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease,
    border-color 0.22s ease;
}

#tci-root .tci-fab:hover {
  filter: brightness(1.14) saturate(1.08);
  transform: translateY(-6px);
  border-color: rgba(180, 220, 255, 0.55);
  box-shadow: var(--tci-shadow), 0 0 0 1px rgba(0, 0, 0, 0.15),
    0 10px 28px rgba(77, 159, 255, 0.4), 0 0 32px rgba(100, 180, 255, 0.45);
}

#tci-root .tci-fab:focus-visible {
  outline: 2px solid var(--tci-accent);
  outline-offset: 3px;
}

#tci-root .tci-fab:active {
  transform: translateY(-2px);
  filter: brightness(1.08);
  box-shadow: var(--tci-shadow), 0 0 0 1px rgba(0, 0, 0, 0.2);
}

#tci-root .tci-fab-icon {
  width: 1.55rem;
  height: 1.55rem;
  flex-shrink: 0;
}

#tci-root .tci-backdrop {
  position: fixed;
  z-index: 3;
  pointer-events: auto;
  inset: 0;
  background: rgba(6, 10, 20, 0.55);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

#tci-root .tci-backdrop[hidden] {
  display: none !important;
}

body.tci-intake-open {
  overflow: hidden;
}

#tci-root .tci-dialog {
  position: fixed;
  z-index: 4;
  pointer-events: auto;
  right: var(--tci-fab-gap);
  bottom: calc(var(--tci-fab-gap) + var(--tci-fab-size) + 0.65rem);
  width: min(21.5rem, calc(100vw - 2 * var(--tci-fab-gap)));
  max-height: min(28rem, calc(100vh - var(--tci-fab-size) - 3.25rem));
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--tci-radius);
  background: var(--tci-surface);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--tci-text);
  box-shadow: var(--tci-shadow);
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.38;
}

#tci-root .tci-dialog[hidden] {
  display: none !important;
}

@media (max-width: 520px) {
  #tci-root .tci-dialog {
    right: 0.65rem;
    left: 0.65rem;
    width: auto;
    bottom: calc(var(--tci-fab-gap) + var(--tci-fab-size) + 0.35rem);
    max-height: min(62vh, 26rem);
  }
}

#tci-root .tci-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem 0.45rem;
  border-bottom: 1px solid var(--tci-border);
  flex-shrink: 0;
}

#tci-root .tci-dialog-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--tci-text);
}

#tci-root .tci-close {
  flex-shrink: 0;
  width: 1.85rem;
  height: 1.85rem;
  margin: 0 -0.1rem 0 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--tci-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

#tci-root .tci-close:hover {
  color: var(--tci-text);
  background: rgba(255, 255, 255, 0.06);
}

#tci-root .tci-dialog-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0.5rem 0.65rem 0.55rem;
  -webkit-overflow-scrolling: touch;
}

#tci-root .tci-step-hint {
  margin: 0 0 0.45rem;
  font-size: 0.76rem;
  color: var(--tci-muted);
  line-height: 1.4;
}

#tci-root .tci-field {
  margin-bottom: 0.45rem;
}

#tci-root .tci-field:last-child {
  margin-bottom: 0;
}

/* Contact step: equal vertical rhythm between name / phone / email */
#tci-root .tci-contact-stack {
  display: flex;
  flex-direction: column;
  gap: 0.62rem;
}

#tci-root .tci-contact-stack .tci-field {
  margin-bottom: 0;
}

#tci-root .tci-contact-stack .tci-field:last-child {
  margin-bottom: 0.35rem;
}

#tci-root .tci-label {
  display: block;
  margin-bottom: 0.22rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--tci-muted);
}

#tci-root .tci-label .tci-hint {
  font-weight: 400;
  opacity: 0.85;
}

#tci-root .tci-input,
#tci-root .tci-textarea,
#tci-root .tci-select {
  width: 100%;
  margin: 0;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--tci-border);
  border-radius: 7px;
  background: var(--tci-surface-2);
  color: var(--tci-text);
  font: inherit;
  font-size: 0.8rem;
}

#tci-root .tci-textarea {
  min-height: 2.65rem;
  resize: vertical;
}

#tci-root .tci-input:focus,
#tci-root .tci-textarea:focus,
#tci-root .tci-select:focus {
  outline: none;
  border-color: rgba(77, 159, 255, 0.55);
  box-shadow: 0 0 0 2px rgba(77, 159, 255, 0.2);
}

#tci-root .tci-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.32rem;
}

#tci-root .tci-choice {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.38rem 0.35rem;
  border: 1px solid var(--tci-border);
  border-radius: 8px;
  background: var(--tci-surface-2);
  color: var(--tci-text);
  font: inherit;
  font-size: 0.74rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

#tci-root .tci-choice:hover {
  border-color: rgba(77, 159, 255, 0.45);
}

#tci-root .tci-choice.is-selected {
  border-color: var(--tci-accent);
  background: rgba(77, 159, 255, 0.14);
}

#tci-root .tci-choice:focus-visible {
  outline: 2px solid var(--tci-accent);
  outline-offset: 2px;
}

#tci-root .tci-check {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
  font-size: 0.76rem;
  color: var(--tci-text);
  cursor: pointer;
}

#tci-root .tci-check input {
  margin: 0.2rem 0 0;
  flex-shrink: 0;
  accent-color: var(--tci-accent);
}

#tci-root .tci-legal-note {
  margin: 0.35rem 0 0;
  font-size: 0.68rem;
  line-height: 1.5;
  color: var(--tci-muted);
}

#tci-root .tci-legal-note a {
  color: var(--tci-accent);
}

#tci-root .tci-error {
  flex-shrink: 0;
  margin: 0 0.65rem 0.28rem;
  padding: 0.32rem 0.45rem;
  border-radius: 6px;
  background: rgba(220, 80, 80, 0.12);
  border: 1px solid rgba(220, 80, 80, 0.35);
  color: #ffb4b4;
  font-size: 0.74rem;
}

#tci-root .tci-error[hidden] {
  display: none !important;
}

#tci-root .tci-summary {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.76rem;
}

#tci-root .tci-summary li {
  margin-bottom: 0.32rem;
  padding-bottom: 0.32rem;
  border-bottom: 1px solid var(--tci-border);
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
  align-items: baseline;
}

#tci-root .tci-summary li:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

#tci-root .tci-summary .tci-sum-k {
  margin: 0;
  color: var(--tci-muted);
  font-weight: 500;
}

#tci-root .tci-summary .tci-sum-v {
  margin: 0;
  text-align: right;
  color: var(--tci-text);
  max-width: 60%;
}

#tci-root .tci-dialog-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
  padding: 0.45rem 0.65rem 0.6rem;
  border-top: 1px solid var(--tci-border);
  flex-shrink: 0;
}

#tci-root .tci-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0 0.65rem;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease;
}

#tci-root .tci-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#tci-root .tci-btn--primary {
  background: linear-gradient(145deg, var(--tci-accent) 0%, var(--tci-accent-dark) 100%);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
}

#tci-root .tci-btn--primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

#tci-root .tci-btn--ghost {
  background: transparent;
  color: var(--tci-muted);
  border-color: var(--tci-border);
}

#tci-root .tci-btn--ghost:hover:not(:disabled) {
  color: var(--tci-text);
  background: rgba(255, 255, 255, 0.06);
}

#tci-root .tci-btn:focus-visible {
  outline: 2px solid var(--tci-accent);
  outline-offset: 2px;
}

#tci-root .tci-success {
  text-align: center;
  padding: 0.35rem 0.15rem 0.15rem;
}

#tci-root .tci-success-title {
  margin: 0 0 0.35rem;
  font-size: 0.88rem;
  font-weight: 700;
}

#tci-root .tci-success-body {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  color: var(--tci-muted);
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  #tci-root .tci-fab,
  #tci-root .tci-btn,
  #tci-root .tci-choice {
    transition: none;
  }
}
