/**
 * OmniCRM Core Theme & Design Tokens
 * Pure CSS with zero external dependencies.
 */

:root {
  --bg: #080c14;
  --card-bg: #0f172a;
  --card-border: #1e293b;
  --card-border-hover: #334155;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #8b5cf6;
  --accent-glow: rgba(139, 92, 246, 0.25);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-bright: #ffffff;
  --tag-bg: #1e293b;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 20px;
}

/* Universal Box-Sizing & Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
}

/* Body & Base Typography */
body {
  background-color: var(--bg);
  color: var(--text);
  padding: 24px 20px;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout Containers */
.container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Brand Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--card-border);
  flex-wrap: wrap;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.brand h1 {
  font-size: 22px;
  color: var(--text-bright);
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand span {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: normal;
  margin-left: 8px;
}

/* Status Badges */
.status-badge {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-connected {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-local {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.status-error {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 8px;
  overflow-x: auto;
}

.nav-tab {
  cursor: pointer;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  user-select: none;
}

.nav-tab:hover {
  color: var(--text-bright);
  background: rgba(255, 255, 255, 0.03);
}

.nav-tab.active {
  background: #1e293b;
  color: var(--text-bright);
  font-weight: 600;
  border-bottom: 2px solid var(--primary);
}

.badge-count {
  background: #334155;
  color: #93c5fd;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

/* AI Natural Prompt Banner */
.ai-banner {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.12));
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.ai-banner strong {
  color: #a78bfa;
}

/* General Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 22px;
}

.card h2 {
  font-size: 17px;
  color: var(--text-bright);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Form Inputs & Field Groups */
.field-group {
  margin-bottom: 16px;
}

.field-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.field-input {
  width: 100%;
  background: #080c14;
  border: 1px solid var(--card-border);
  color: var(--text-bright);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-family: var(--font-mono);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field-input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  font-family: inherit;
}

/* Buttons */
button {
  cursor: pointer;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  border: none;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.2;
}

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

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

.btn-secondary {
  background: #1e293b;
  color: var(--text);
  border: 1px solid var(--card-border);
}

.btn-secondary:hover {
  background: #334155;
  color: var(--text-bright);
}

.btn-success {
  background: #059669;
  color: #fff;
}

.btn-success:hover {
  background: #047857;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* Button Loading State */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  top: calc(50% - 7px);
  left: calc(50% - 7px);
  border: 2px solid #ffffff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Code Snippet Box & Copy Button */
.code-box {
  background: #080c14;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #60a5fa;
  overflow-x: auto;
  position: relative;
  margin-top: 8px;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #1e293b;
  border: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.copy-btn:hover {
  color: var(--text-bright);
  background: #334155;
}

/* Subtabs */
.subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 10px;
}

.subtab {
  cursor: pointer;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.subtab.active {
  background: #1e293b;
  color: var(--text-bright);
  font-weight: 600;
}

.subtab-content {
  display: none;
}

.subtab-content.active {
  display: block;
}

/* Shimmer Skeleton Loaders */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.skeleton-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  flex-shrink: 0;
}

.skeleton-line {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
