/* ChatRoute — shared app styles */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600&display=swap');

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

:root {
  --bg-deep:       #0a0e1a;
  --bg-card:       #111827;
  --bg-elevated:   #1a2236;
  --bg-hover:      #1e2a40;
  --accent:        #f97316;
  --accent-soft:   rgba(249,115,22,0.12);
  --accent-border: rgba(249,115,22,0.25);
  --blue:          #6366f1;
  --blue-soft:     rgba(99,102,241,0.12);
  --green:         #10b981;
  --green-soft:    rgba(16,185,129,0.12);
  --red:           #ef4444;
  --red-soft:      rgba(239,68,68,0.12);
  --yellow:        #f59e0b;
  --yellow-soft:   rgba(245,158,11,0.12);
  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;
  --border:        rgba(148,163,184,0.08);
  --border-strong: rgba(148,163,184,0.15);
  --glow:          rgba(249,115,22,0.15);
  --nav-height:    64px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

h1,h2,h3,h4 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  line-height: 1.2;
}

/* ── NAV ─────────────────────────────────────────────────────── */
.app-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  backdrop-filter: blur(20px);
  background: rgba(10,14,26,0.8);
  border-bottom: 1px solid var(--border);
}

.nav-left  { display: flex; align-items: center; gap: 2rem; }
.nav-right { display: flex; align-items: center; gap: 1rem; }

.logo {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  text-decoration: none;
}
.logo span { color: var(--accent); }

.nav-links { display: flex; gap: 0.25rem; }
.nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  transition: all 0.15s;
}
.nav-link:hover   { color: var(--text-primary); background: var(--bg-elevated); }
.nav-link.active  { color: var(--text-primary); background: var(--bg-elevated); }

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.nav-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  font-family: 'Plus Jakarta Sans', sans-serif;
}

/* ── PAGE WRAPPER ─────────────────────────────────────────────── */
.page-wrap {
  position: relative;
  z-index: 1;
  padding-top: var(--nav-height);
  min-height: 100vh;
}

.page-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── BUTTONS ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: #ea6c0a; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(249,115,22,0.3); }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-elevated); }

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; border-radius: 8px; }

/* ── FORMS ────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.form-input, .form-textarea, .form-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  outline: none;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus, .form-textarea:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-textarea { resize: vertical; min-height: 100px; }
.form-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 0.9rem center; padding-right: 2.5rem; }

.form-hint { font-size: 0.78rem; color: var(--text-muted); }
.form-error { font-size: 0.82rem; color: var(--red); }

/* ── CARDS ────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
}
.card-sm { padding: 1.25rem; border-radius: 12px; }

/* ── STAT CARD ─────────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
}
.stat-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.35rem; }
.stat-delta { font-size: 0.78rem; font-weight: 600; margin-top: 0.5rem; }
.stat-delta.up   { color: var(--green); }
.stat-delta.down { color: var(--red); }

/* ── BADGES ───────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-open       { background: var(--accent-soft);  color: var(--accent); border: 1px solid var(--accent-border); }
.badge-in_progress{ background: var(--blue-soft);    color: var(--blue);   border: 1px solid rgba(99,102,241,0.25); }
.badge-resolved   { background: var(--green-soft);   color: var(--green);  border: 1px solid rgba(16,185,129,0.25); }
.badge-closed     { background: rgba(100,116,139,0.12); color: var(--text-muted); border: 1px solid rgba(100,116,139,0.2); }

.priority-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.priority-urgent { background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.priority-high   { background: var(--accent); }
.priority-normal { background: var(--text-muted); }
.priority-low    { background: var(--text-muted); opacity: 0.5; }

/* ── CHANNEL BADGE ────────────────────────────────────────────── */
.channel-badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ── EMPTY / LOADING ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state h3 { font-size: 1rem; color: var(--text-secondary); margin-bottom: 0.5rem; }
.empty-state p  { font-size: 0.85rem; }

.loading-row {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem; color: var(--text-muted); font-size: 0.875rem; gap: 0.75rem;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ALERT ────────────────────────────────────────────────────── */
.alert {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  font-size: 0.875rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.alert-error   { background: var(--red-soft);    color: var(--red);    border: 1px solid rgba(239,68,68,0.2); }
.alert-success { background: var(--green-soft);  color: var(--green);  border: 1px solid rgba(16,185,129,0.2); }

/* ── DIVIDER ──────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ── RESPONSIVE GRID ──────────────────────────────────────────── */
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 1rem; }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-3 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .page-inner { padding: 1.25rem 1rem; }
}
