/* Support Department Dashboard — Base Styles */

:root {
  --color-bg: #0f1117;
  --color-surface: #1a1d27;
  --color-surface-hover: #22263a;
  --color-border: #2a2e3e;
  --color-text: #e4e4e7;
  --color-text-muted: #71717a;
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-success: #22c55e;
  --color-warning: #eab308;
  --color-danger: #ef4444;
  --color-accent: #8b5cf6;
  --radius: 8px;
  --sidebar-width: 220px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

/* Layout */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: 24px 0;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-brand h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sidebar-nav {
  list-style: none;
  padding: 12px 0;
}

.sidebar-nav li a {
  display: block;
  padding: 8px 20px;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s, background 0.15s;
}

.sidebar-nav li a:hover {
  color: var(--color-text);
  background: var(--color-surface-hover);
}

.sidebar-nav li a.active {
  color: var(--color-primary);
  background: rgba(59, 130, 246, 0.08);
  border-right: 2px solid var(--color-primary);
}

.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
}

/* Pages */
.page {
  max-width: 1200px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 8px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.stat-subtitle {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* Sections */
.section {
  margin-bottom: 32px;
}

.section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

.muted {
  color: var(--color-text-muted);
  font-size: 14px;
}

/* Tables */
.table-container {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.02);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--color-surface-hover);
}

.empty-state {
  text-align: center;
  color: var(--color-text-muted);
  padding: 40px 16px !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

/* Selects */
.filter-select {
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 14px;
}

.filters {
  display: flex;
  gap: 8px;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.badge-active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
}

/* Product Cards */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
}

.product-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.product-card-header h3 {
  font-size: 16px;
}

.product-card-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.detail-label {
  color: var(--color-text-muted);
}

.detail-value {
  font-weight: 500;
}

/* Config Checklist */
.config-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.checklist-item {
  font-size: 14px;
  padding: 8px 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

/* Playbook Tree */
.playbook-view {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.playbook-tree,
.playbook-stats {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
}

.tree-placeholder {
  margin-top: 16px;
}

.tree-node {
  padding: 12px 16px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  margin-bottom: 8px;
}

.tree-node-condition {
  border-left: 3px solid var(--color-warning);
}

.tree-node-response {
  border-left: 3px solid var(--color-success);
}

.tree-node-escalation {
  border-left: 3px solid var(--color-danger);
}

.node-type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.node-label {
  font-size: 14px;
  font-weight: 500;
  margin-top: 4px;
}

.node-detail,
.node-stats {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.tree-branches {
  display: flex;
  gap: 16px;
  padding-left: 24px;
  margin-bottom: 8px;
}

.tree-branch {
  flex: 1;
}

.branch-label {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.tree-branch-true .branch-label {
  color: var(--color-success);
}

.tree-branch-false .branch-label {
  color: var(--color-danger);
}

/* Analytics Grid */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 16px;
}

.analytics-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 200px;
}

.analytics-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px 20px;
  margin-top: auto;
  border-top: 1px solid var(--color-border);
}

.btn-sidebar {
  display: block;
  text-align: center;
  width: 100%;
  text-decoration: none;
  font-size: 13px;
}

/* Setup Wizard */
.setup-wizard {
  max-width: 800px;
}

.setup-step {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}

.setup-step-active {
  border-color: var(--color-primary);
}

.setup-step-completed {
  border-color: var(--color-success);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  background: var(--color-surface-hover);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.step-number-active {
  background: var(--color-primary);
  color: white;
}

.step-number-completed,
.step-number-auto {
  background: var(--color-success);
  color: white;
}

.step-header h3 {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

.step-content {
  padding: 20px;
}

.step-description {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.badge-optional {
  background: rgba(139, 92, 246, 0.15);
  color: var(--color-accent);
}

.badge-time {
  background: rgba(59, 130, 246, 0.15);
  color: var(--color-primary);
}

.badge-recommended {
  background: rgba(34, 197, 94, 0.15);
  color: var(--color-success);
  font-size: 11px;
}

/* Form */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 13px;
  font-weight: 500;
}

.form-input {
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 14px;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-hint {
  font-size: 12px;
  color: var(--color-text-muted);
}

/* Connection Options */
.connection-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.connection-option {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
}

.connection-recommended {
  border-color: var(--color-success);
  background: rgba(34, 197, 94, 0.03);
}

.connection-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.connection-header h4 {
  font-size: 15px;
}

.connection-body {
  margin-top: 16px;
}

.intake-address {
  margin-bottom: 12px;
}

.intake-address label {
  font-size: 13px;
  color: var(--color-text-muted);
  display: block;
  margin-bottom: 6px;
}

.address-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.address-box code {
  flex: 1;
  padding: 8px 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
  font-family: "JetBrains Mono", monospace;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.provider-instructions {
  margin: 12px 0;
}

.provider-instructions details {
  margin-bottom: 4px;
}

.provider-instructions summary {
  font-size: 13px;
  color: var(--color-primary);
  cursor: pointer;
  padding: 6px 0;
}

.provider-instructions ol {
  font-size: 13px;
  padding-left: 20px;
  color: var(--color-text-muted);
  line-height: 1.8;
}

.test-status {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-left: 12px;
}

.oauth-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-oauth {
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: var(--color-surface-hover);
  color: var(--color-text);
  cursor: pointer;
}

.btn-oauth:hover {
  border-color: var(--color-primary);
}

.oauth-note {
  font-size: 12px;
  margin-top: 12px;
}

/* Context options */
.context-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.context-option {
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
}

.context-option h4 {
  font-size: 14px;
  margin-bottom: 4px;
}

.action-links {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Profiles preview */
.profiles-preview {
  margin-bottom: 12px;
}

.profile-card-mini {
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 13px;
}

/* Playbook preview */
.playbook-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.node-tag {
  padding: 4px 10px;
  background: var(--color-surface-hover);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 12px;
}

/* Setup footer */
.setup-footer {
  margin-top: 24px;
  padding: 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.go-live-requirements {
  font-size: 14px;
  color: var(--color-text-muted);
}

.btn-large {
  padding: 12px 32px;
  font-size: 15px;
}
