/**
 * ROOM 36 — Operator Web Admin (V1-PRIVATE)
 * Surface-specific overrides only. Common patterns live in /shared/room36-common.css.
 */

/* ===== OPERATOR-SPECIFIC TWEAKS ===== */

/* Navbar brand over Tabler dark */
.navbar-overlap .navbar-brand {
  font-weight: 600;
}

/* Table row hover cursor */
.cursor-pointer { cursor: pointer; }

/* Focus-visible outlines for keyboard navigation */
.provider-card:focus-visible {
  outline: 2px solid var(--room36-primary, #206bc4);
  outline-offset: 2px;
}

tr.cursor-pointer:focus-visible {
  outline: 2px solid var(--room36-primary, #206bc4);
  outline-offset: -2px;
}

/* Detail view code blocks */
.detail-value code {
  background: var(--room36-bg-surface-secondary, #f0f2f5);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.9rem;
  word-break: break-all;
}

/* Form hint text */
.form-hint {
  display: block;
  margin-top: 0.25rem;
  color: var(--room36-secondary, #626976);
  font-size: 0.8rem;
}

/* Form controls — constrain width */
.form-control,
textarea.form-control {
  max-width: 100%;
  width: 100%;
}

/* Defense in depth — no horizontal escape from card bodies */
.card-body {
  overflow-x: hidden;
}

/* Customer table endpoint column */
.table td code {
  word-break: break-all;
}

/* Form action buttons */
.d-flex.gap-2 {
  flex-wrap: wrap;
}
.d-flex.gap-2 .btn {
  flex: 1 1 auto;
  min-width: 120px;
}

/* Create-form columns on larger screens */
@media (min-width: 992px) {
  .form-section .row.g-3 { margin-left: -0.5rem; margin-right: -0.5rem; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .page-wrapper .container-xl {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .navbar-brand {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .footer .row {
    flex-direction: column !important;
    gap: 0.5rem;
    text-align: center;
  }

  /* Stack provider cards on mobile */
  .provider-card {
    margin-bottom: 0.5rem;
  }

  /* Table adjustments */
  .table-responsive {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .navbar-brand {
    max-width: 140px;
  }

  .btn-list .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
  }

  .btn-group .btn,
  .d-flex.gap-2 .btn {
    min-width: unset;
    width: 100%;
  }
}

@media (max-width: 380px) {
  .navbar-brand {
    max-width: 120px;
  }
}

/* ===================================================================
   Phase 1b — Status badges, relative timestamps, quick actions
   =================================================================== */

.status-active { background-color: #2fb344 !important; }
.status-suspended { background-color: #d63939 !important; }
.status-trial { background-color: #4299e1 !important; }
.status-provisioning { background-color: #9aa0a6 !important; }

.relative-time {
  font-size: 0.8rem;
  color: var(--room36-secondary, #626976);
  white-space: nowrap;
}

/* Quick actions dropdown in table rows */
.quick-actions-dropdown .dropdown-item i {
  margin-right: 0.5rem;
  width: 1rem;
  text-align: center;
}

.quick-actions-dropdown .dropdown-item.disabled-item {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: auto;
}

.quick-actions-dropdown .dropdown-item.disabled-item:hover {
  background: transparent;
  color: inherit;
}

.coming-soon-badge {
  font-size: 0.65rem;
  background: #e9ecef;
  color: #6c757d;
  border-radius: 3px;
  padding: 0.1rem 0.3rem;
  margin-left: 0.35rem;
  vertical-align: middle;
}

/* ===================================================================
   Phase 1c — Customer detail tabs
   =================================================================== */

.detail-tabs {
  margin-bottom: 0;
  border-bottom: 1px solid var(--tblr-border-color, #e6e7e9);
}

.detail-tabs .nav-link {
  cursor: pointer;
  padding: 0.75rem 1rem;
  color: var(--room36-secondary, #626976);
  border: none;
  border-bottom: 2px solid transparent;
  font-weight: 500;
  transition: color 0.15s, border-color 0.15s;
  background: none;
  margin-bottom: -1px;
}

.detail-tabs .nav-link:hover {
  color: var(--room36-primary, #206bc4);
  border-bottom-color: #d0d4d9;
}

.detail-tabs .nav-link.active {
  color: var(--room36-primary, #206bc4);
  border-bottom-color: var(--room36-primary, #206bc4);
}

.tab-content-pane {
  display: none;
}

.tab-content-pane.active {
  display: block;
}

/* Configuration sub-sections */
.config-section {
  margin-bottom: 1.5rem;
}

.config-section:last-child {
  margin-bottom: 0;
}

.config-section-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--tblr-border-color, #e6e7e9);
}

/* Field data key-value editor */
.field-data-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.field-data-row .field-key {
  flex: 0 0 35%;
}

.field-data-row .field-value {
  flex: 1;
}

.field-data-row .field-remove-btn {
  flex: 0 0 auto;
}

/* Activity log */
.activity-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--room36-secondary, #626976);
}

.activity-empty-state i {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.5;
  display: block;
}

/* ===================================================================
   Phase 1d — Onboarding wizard
   =================================================================== */

.wizard-container {
  max-width: 800px;
  margin: 0 auto;
}

/* Progress bar */
.wizard-progress-track {
  background: #e9ecef;
  border-radius: 0.25rem;
  height: 0.5rem;
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.wizard-progress-fill {
  background: var(--tblr-primary, #206bc4);
  height: 100%;
  border-radius: 0.25rem;
  transition: width 0.3s ease;
}

/* Step indicator circles */
.wizard-steps {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 0;
}

.wizard-step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}

.wizard-step-item:last-child {
  flex: 0 0 auto;
}

.wizard-step-circle {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
  transition: background 0.3s, color 0.3s;
}

.wizard-step-circle.active {
  background: var(--tblr-primary, #206bc4);
  color: #fff;
}

.wizard-step-circle.completed {
  background: #2fb344;
  color: #fff;
}

.wizard-step-circle.inactive {
  background: #e9ecef;
  color: #6c757d;
}

.wizard-step-label {
  font-size: 0.7rem;
  color: var(--room36-secondary, #626976);
  text-align: center;
  margin-top: 0.35rem;
  max-width: 80px;
  line-height: 1.2;
}

/* Connector line between step circles */
.wizard-connector-wrapper {
  display: flex;
  align-items: center;
  width: 100%;
  position: absolute;
  top: 1rem;
  left: 50%;
  z-index: -1;
}

.wizard-step-connector {
  flex: 1;
  height: 2px;
  background: #e9ecef;
  min-width: 1rem;
  transition: background 0.3s;
}

.wizard-step-connector.completed {
  background: #2fb344;
}

/* Wizard navigation buttons */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--tblr-border-color, #e6e7e9);
}

.wizard-nav-left {
  display: flex;
  gap: 0.5rem;
}

.wizard-nav-right {
  display: flex;
  gap: 0.5rem;
}

/* Wizard step content */
.wizard-step-content {
  min-height: 200px;
}

/* Review section */
.wizard-review-section {
  margin-bottom: 1.5rem;
}

.wizard-review-section h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--tblr-border-color, #e6e7e9);
}

.wizard-review-row {
  display: flex;
  padding: 0.35rem 0;
  font-size: 0.9rem;
}

.wizard-review-label {
  flex: 0 0 200px;
  color: var(--room36-secondary, #626976);
  font-weight: 500;
}

.wizard-review-value {
  flex: 1;
  word-break: break-word;
}

/* Provider selection cards in wizard */
.wizard-provider-option {
  border: 2px solid var(--tblr-border-color, #e6e7e9);
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  height: 100%;
}

.wizard-provider-option:hover {
  border-color: #b0b4ba;
}

.wizard-provider-option.selected {
  border-color: var(--tblr-primary, #206bc4);
  background: rgba(32, 107, 196, 0.04);
}

.wizard-provider-option .provider-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.wizard-provider-option .provider-desc {
  font-size: 0.8rem;
  color: var(--room36-secondary, #626976);
}

/* API key success display after wizard */
.wizard-success {
  text-align: center;
  padding: 2rem 1rem;
}

.wizard-success h4 {
  color: #2fb344;
  margin-bottom: 1.5rem;
}

.wizard-success .api-key-box {
  background: #f8fafc;
  border: 1px solid var(--tblr-border-color, #e6e7e9);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1rem auto;
  max-width: 500px;
}

.wizard-success .api-key-box code {
  font-size: 0.95rem;
  word-break: break-all;
  display: block;
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background: #fff;
  border: 1px solid var(--tblr-border-color, #e6e7e9);
  border-radius: 4px;
}

/* Inject warning */
.inject-warning {
  font-size: 0.8rem;
  color: #d63939;
  margin-top: 0.25rem;
}

/* Tab activity table */
.activity-timeline {
  border-left: 2px solid var(--tblr-border-color, #e6e7e9);
  padding-left: 1rem;
}

.activity-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item .activity-action {
  font-weight: 500;
}

.activity-item .activity-meta {
  font-size: 0.8rem;
  color: var(--room36-secondary, #626976);
}

.activity-item .activity-field {
  font-size: 0.85rem;
  color: var(--room36-secondary, #626976);
}

.activity-item .activity-diff {
  display: flex;
  gap: 0.5rem;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.activity-item .activity-diff .old-value {
  background: #fef2f2;
  color: #b91c1c;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  text-decoration: line-through;
}

.activity-item .activity-diff .new-value {
  background: #f0fdf4;
  color: #15803d;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
}


/* ===================================================================
   ONBOARDING WIZARD (U3) — stepper, archetypes, voice preview, sandbox,
   and the sentence-builder playbook cards (U1 pattern, re-implemented).
   =================================================================== */

/* Horizontal stepper (distinct from the create-form's .wizard-steps) */
.wizard-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem 0;
}
.wizard-step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  color: #626976;
  background: #f5f7fb;
}
.wizard-step--current {
  background: #206bc4;
  color: #fff;
  font-weight: 600;
}
.wizard-step--done { color: #12692a; background: #e8f6ee; }
.wizard-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  font-size: 0.75rem;
  font-weight: 700;
}
.wizard-step--current .wizard-step-num { background: rgba(255,255,255,0.25); }
.wizard-step--done .wizard-step-num { background: #2fb344; color: #fff; }

.wizard-step-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.5rem; }
.wizard-step-title:focus { outline: 2px solid #206bc4; outline-offset: 3px; }

/* Archetype picker */
.wizard-archetypes { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.wizard-archetype {
  cursor: pointer;
  border: 1.5px solid #d9e0e8;
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font-size: 0.875rem;
  transition: border-color 0.15s, background 0.15s;
}
.wizard-archetype:hover { border-color: #206bc4; }
.wizard-archetype--on { border-color: #206bc4; background: #eaf3fb; font-weight: 600; }
.wizard-archetype:focus-within { outline: 2px solid #206bc4; outline-offset: 2px; }

/* Voice preview */
.wizard-voice-preview {
  background: #f5f7fb;
  border: 1px solid #e6eaef;
  border-radius: 8px;
  padding: 0.75rem 1rem;
}
.wizard-voice-line {
  font-style: italic;
  color: #33415c;
  padding: 0.15rem 0;
  font-size: 0.9rem;
}

/* Go-live sandbox log */
.wizard-sandbox-log {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem;
  background: #f8fafc;
  border: 1px solid #e6eaef;
  border-radius: 8px;
  min-height: 60px;
}
.wizard-sbx-line { display: flex; flex-direction: column; max-width: 90%; }
.sbx-you { align-self: flex-end; align-items: flex-end; }
.sbx-agent { align-self: flex-start; }
.sbx-system { align-self: center; }
.wizard-sbx-bubble {
  padding: 0.4rem 0.7rem;
  border-radius: 10px;
  font-size: 0.875rem;
}
.sbx-you .wizard-sbx-bubble { background: #206bc4; color: #fff; }
.sbx-agent .wizard-sbx-bubble { background: #eef2f7; color: #1a2233; }
.sbx-system .wizard-sbx-bubble { background: #f6f2fb; color: #54327f; font-size: 0.8125rem; }
.wizard-sbx-narration { font-size: 0.75rem; color: #4a5568; margin-top: 0.15rem; }

/* Sentence-builder playbook cards (re-implemented from U1 in this repo) */
.playbook-card { border-left: 4px solid #d9e0e8; }
.playbook-card--green { border-left-color: #2fb344; }
.playbook-card--red { border-left-color: #d63939; }
.playbook-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  margin-bottom: 0.5rem;
}
.playbook-line .form-control-sm,
.playbook-line .form-select-sm { flex: 1 1 200px; min-width: 140px; }
.playbook-kw {
  display: inline-block;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: #fff;
  background: #206bc4;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}
.playbook-kw--sub { background: #495057; font-weight: 600; letter-spacing: 0; }
.playbook-chips { display: flex; flex-wrap: wrap; align-items: center; }

@media (max-width: 576px) {
  .wizard-step-label { display: none; }
  .wizard-review-label { flex-basis: 120px; }
}
