/* ============================================================
   Avaya CC AI Dashboard v2 — styling only
   No logic here. Edit freely without touching JS files.
   ============================================================ */

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

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
}

/* ── TOP BAR ─────────────────────────────────────────────── */
.topbar {
  background: #1a1a2e;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #1D9E75, #534AB7);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-sub { font-size: 11px; color: #9ca3af; margin-top: 1px; }
.status-dot {
  width: 7px; height: 7px; background: #22c55e;
  border-radius: 50%; display: inline-block; margin-right: 4px;
}

/* ── SITE SWITCHER ──────────────────────────────────────────── */
.site-switcher {
  display: flex; align-items: center; gap: 8px;
}
.site-switcher select {
  background: #2d2d44;
  color: #fff;
  border: 1px solid #4b5563;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.site-switcher select:focus { outline: 2px solid #534AB7; }
.site-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: #534AB7;
  color: #fff;
}

/* ── LAYOUT ──────────────────────────────────────────────── */
.wrap { max-width: 1400px; margin: 0 auto; padding: 20px; }

/* ── KPI ROW ─────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-left: 4px solid transparent;
}
.kpi.k-blue   { border-left-color: #185FA5; }
.kpi.k-green  { border-left-color: #1D9E75; }
.kpi.k-amber  { border-left-color: #EF9F27; }
.kpi.k-red    { border-left-color: #E24B4A; }
.kpi.k-purple { border-left-color: #534AB7; }
.kpi.k-teal   { border-left-color: #0F6E56; }
.kpi-label {
  font-size: 10px; color: #6b7280; text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 5px;
}
.kpi-value { font-size: 22px; font-weight: 700; color: #1a1a2e; }
.kpi-sub { font-size: 11px; color: #9ca3af; margin-top: 2px; }

/* ── GRID LAYOUTS ────────────────────────────────────────── */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.g2-wide { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .g2, .g2-wide { grid-template-columns: 1fr; } }

/* ── PANEL ───────────────────────────────────────────────── */
.panel {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  padding: 16px;
  overflow: hidden;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 1px solid #f3f4f6;
}
.panel-title {
  font-size: 12px; font-weight: 600; color: #374151;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.panel-badge {
  font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: #f3f4f6; color: #6b7280;
}
.panel-badge.live { background: #dcfce7; color: #166534; }

/* ── TABLE ───────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  background: #f9fafb; padding: 8px 10px; text-align: left;
  font-weight: 600; color: #9ca3af; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap;
}
td { padding: 8px 10px; border-bottom: 1px solid #f3f4f6; color: #374151; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

/* ── BADGE ───────────────────────────────────────────────── */
.bdg { font-size: 10px; padding: 2px 7px; border-radius: 12px; font-weight: 600; white-space: nowrap; }
.bdg-green  { background: #dcfce7; color: #166534; }
.bdg-red    { background: #fee2e2; color: #991b1b; }
.bdg-amber  { background: #fef3c7; color: #92400e; }
.bdg-gray   { background: #f3f4f6; color: #6b7280; }

/* ── PROGRESS BAR ────────────────────────────────────────── */
.bar-wrap {
  width: 60px; height: 5px; background: #f3f4f6;
  border-radius: 3px; overflow: hidden;
  display: inline-block; vertical-align: middle; margin-right: 5px;
}
.bar-fill { height: 100%; border-radius: 3px; }

/* ── RECENT CALLS LIST ──────────────────────────────────────── */
.call-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #f3f4f6;
}
.call-item:last-child { border-bottom: none; }
.call-icon {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.ci-in   { background: #dcfce7; color: #166534; }
.ci-out  { background: #e0f2fe; color: #0369a1; }
.ci-miss { background: #fee2e2; color: #991b1b; }
.call-body { flex: 1; min-width: 0; }
.call-agent {
  font-size: 13px; font-weight: 600; color: #1a1a2e;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.call-meta {
  font-size: 11px; color: #9ca3af; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.call-right { text-align: right; flex-shrink: 0; }
.call-dur { font-size: 12px; font-weight: 600; color: #374151; }
.call-time { font-size: 10px; color: #9ca3af; margin-top: 2px; }

/* ── LOADING / ERROR / EMPTY STATES ─────────────────────────── */
.state-msg { text-align: center; color: #9ca3af; padding: 24px; font-size: 12.5px; }
.state-msg.error { color: #991b1b; }
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid #e5e7eb; border-top-color: #534AB7;
  border-radius: 50%; animation: spin 0.7s linear infinite;
  margin-right: 6px; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Sidebar — gentle page switcher (Dashboard / Recordings / Reports)
   Sits below the topbar, doesn't touch the topbar's own layout.
   ============================================================ */
.layout { display: flex; align-items: flex-start; }
.sidebar {
  width: 176px;
  flex-shrink: 0;
  background: #1a1a2e;
  border-right: 1px solid #2d2d44;
  min-height: calc(100vh - 53px);
  padding: 16px 0;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: #9ca3af;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
}
.sidebar-link:hover {
  background: #2d2d44;
  color: #fff;
  transform: translateX(4px);
}
.sidebar-link:active {
  transform: translateX(2px) scale(0.97);
}
.sidebar-link.active {
  background: linear-gradient(135deg, #1D9E75, #534AB7);
  color: #fff;
  border-left-color: #fff;
  font-weight: 600;
}
.sidebar-link.active:hover {
  transform: translateX(4px);
  filter: brightness(1.08);
}
.sidebar-icon { font-size: 15px; width: 18px; text-align: center; }
.layout > .wrap { flex: 1; min-width: 0; }

/* ============================================================
   RTL support -- applied when <html dir="rtl"> (Arabic).
   Flips sidebar border, active-link accent, and text alignment.
   ============================================================ */
[dir="rtl"] body { text-align: right; }
[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid #2d2d44;
}
[dir="rtl"] .sidebar-link {
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
}
[dir="rtl"] .sidebar-link:hover {
  transform: translateX(-4px);
}
[dir="rtl"] .sidebar-link.active {
  border-left-color: transparent;
  border-right-color: #fff;
}
[dir="rtl"] th,
[dir="rtl"] td {
  text-align: right;
}
[dir="rtl"] .topbar-right {
  flex-direction: row-reverse;
}
[dir="rtl"] .lang-toggle-btn {
  font-family: sans-serif;
}

.lang-toggle-btn {
  background: #2d2d44;
  color: #fff;
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.lang-toggle-btn:hover { background: #3d3d5c; }
