/* MLabs Telefonanlage — Glassmorphism Design System
   Palette: deep-space gradient, frosted panels, aurora accents (violet/cyan) */

:root {
  --bg-0: #06070f;
  --bg-1: #0b0e1d;
  --bg-2: #10142b;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-border-strong: rgba(255, 255, 255, 0.2);
  --txt: #eef0fa;
  --txt-dim: #9aa3c7;
  --txt-faint: #6b7399;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-3: #f472b6;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #fb7185;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, monospace;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--txt);
  background: var(--bg-0);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* animated aurora backdrop */
.aurora {
  position: fixed;
  inset: -20%;
  z-index: 0;
  background:
    radial-gradient(38% 45% at 12% 18%, rgba(124, 92, 255, 0.22), transparent 60%),
    radial-gradient(32% 40% at 85% 12%, rgba(34, 211, 238, 0.16), transparent 60%),
    radial-gradient(40% 50% at 70% 85%, rgba(244, 114, 182, 0.12), transparent 60%),
    radial-gradient(30% 35% at 25% 90%, rgba(52, 211, 153, 0.08), transparent 60%);
  filter: blur(20px);
  animation: drift 26s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(-2.5%, 2%) scale(1.04); }
  100% { transform: translate(2%, -1.5%) scale(1); }
}

#app {
  position: relative;
  z-index: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- glass panels */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: var(--shadow);
}

.glass-strong {
  background: var(--glass-strong);
  border-color: var(--glass-border-strong);
}

.glass:hover { border-color: var(--glass-border-strong); }

/* ---------------------------------------------------------------- topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 22px;
  margin: 14px 18px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.2px;
}

.brand .logo {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 18px rgba(124, 92, 255, 0.45);
  font-size: 19px;
}

.brand small { color: var(--txt-dim); font-weight: 500; }

.topbar .spacer { flex: 1; }

.conn-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--err);
  box-shadow: 0 0 12px var(--err);
  transition: background 0.3s, box-shadow 0.3s;
}
.conn-dot.up { background: var(--ok); box-shadow: 0 0 12px var(--ok); }

/* ---------------------------------------------------------------- layout */
.main {
  flex: 1;
  display: flex;
  gap: 18px;
  padding: 14px 18px 18px;
  min-height: 0;
}

.sidebar {
  width: 218px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  color: var(--txt-dim);
  cursor: pointer;
  font-size: 14.5px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.18s;
  user-select: none;
}
.nav-item:hover { color: var(--txt); background: var(--glass); }
.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.28), rgba(34, 211, 238, 0.16));
  border-color: var(--glass-border-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.nav-icon { width: 21px; text-align: center; font-size: 16px; }

.content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.view { display: flex; flex-direction: column; gap: 16px; padding: 14px 18px 18px; min-height: 100%; }

.view-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
}
.view-head h1 { font-size: 21px; font-weight: 700; letter-spacing: 0.2px; }
.view-head .sub { color: var(--txt-dim); font-size: 13.5px; }
.view-head .actions { margin-left: auto; display: flex; gap: 10px; }

/* ---------------------------------------------------------------- cards & stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.stat-card { padding: 18px 20px; position: relative; overflow: hidden; }
.stat-card .lbl { color: var(--txt-dim); font-size: 12.5px; text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.stat-card .val { font-size: 30px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-card .trend { font-size: 12px; color: var(--txt-faint); margin-top: 4px; }
.stat-card::after {
  content: "";
  position: absolute;
  right: -30px; top: -30px;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow, rgba(124,92,255,0.25)), transparent 70%);
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--txt);
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s;
  backdrop-filter: blur(10px);
}
.btn:hover { background: var(--glass-strong); border-color: var(--glass-border-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5b8cff);
  border-color: transparent;
  box-shadow: 0 4px 20px rgba(124, 92, 255, 0.4);
}
.btn-primary:hover { box-shadow: 0 6px 26px rgba(124, 92, 255, 0.55); }

.btn-danger { background: rgba(251, 113, 133, 0.14); border-color: rgba(251, 113, 133, 0.35); color: #fda4b3; }
.btn-danger:hover { background: rgba(251, 113, 133, 0.22); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--txt-dim); }
.btn-ghost:hover { color: var(--txt); background: var(--glass); }

.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 9px; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  text-align: left;
  padding: 12px 16px;
  color: var(--txt-faint);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  background: rgba(11, 14, 29, 0.85);
  backdrop-filter: blur(12px);
  z-index: 2;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.035); }
tbody tr:last-child td { border-bottom: none; }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.badge.ok     { background: rgba(52, 211, 153, 0.14); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.3); }
.badge.err    { background: rgba(251, 113, 133, 0.14); color: #fda4b3; border: 1px solid rgba(251, 113, 133, 0.3); }
.badge.warn   { background: rgba(251, 191, 36, 0.13); color: #fcd34d; border: 1px solid rgba(251, 191, 36, 0.3); }
.badge.info   { background: rgba(34, 211, 238, 0.13); color: #67e8f9; border: 1px solid rgba(34, 211, 238, 0.3); }
.badge.violet { background: rgba(124, 92, 255, 0.15); color: #b4a5ff; border: 1px solid rgba(124, 92, 255, 0.32); }
.badge.pink   { background: rgba(244, 114, 182, 0.14); color: #f9a8d4; border: 1px solid rgba(244, 114, 182, 0.3); }
.badge.dim    { background: rgba(255, 255, 255, 0.06); color: var(--txt-dim); border: 1px solid var(--glass-border); }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; color: var(--txt-dim); font-weight: 600; }
.field input, .field select, .field textarea {
  padding: 10px 13px;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--txt);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .span2 { grid-column: span 2; }

/* ---------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 14, 0.6);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 50;
  animation: fadeIn 0.16s ease;
}
.modal {
  width: min(620px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  padding: 24px;
  animation: pop 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal h2 { font-size: 17px; margin-bottom: 18px; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0.94); opacity: 0; } }

/* ---------------------------------------------------------------- login */
.login-wrap {
  height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
}
.login-card { width: min(400px, 92vw); padding: 34px 32px; text-align: center; }
.login-card .logo-lg {
  width: 64px; height: 64px; margin: 0 auto 18px;
  border-radius: 20px;
  display: grid; place-items: center;
  font-size: 30px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 40px rgba(124, 92, 255, 0.5);
}
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card .sub { color: var(--txt-dim); font-size: 13px; margin-bottom: 24px; }
.login-card .field { text-align: left; margin-bottom: 12px; }
.login-error { color: var(--err); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------------------------------------------------------------- softphone */
.phone-panel {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

.phone-display {
  text-align: center;
  padding: 18px 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
}
.phone-display .number {
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 2px;
  min-height: 30px;
}
.phone-display .status { color: var(--txt-dim); font-size: 12.5px; margin-top: 6px; }

.dialpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.dial-key {
  padding: 13px 0;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--txt);
  font-size: 18px;
  font-family: var(--mono);
  cursor: pointer;
  transition: all 0.12s;
  user-select: none;
}
.dial-key small { display: block; font-size: 9px; color: var(--txt-faint); letter-spacing: 1px; font-family: var(--font); }
.dial-key:hover { background: var(--glass-strong); border-color: var(--glass-border-strong); transform: scale(1.04); }
.dial-key:active { transform: scale(0.96); }

.call-controls { display: flex; gap: 10px; }
.call-btn {
  flex: 1;
  padding: 13px;
  border-radius: 13px;
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
  color: #fff;
}
.call-btn.answer { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 4px 18px rgba(16, 185, 129, 0.4); }
.call-btn.hangup { background: linear-gradient(135deg, #f43f5e, #e11d48); box-shadow: 0 4px 18px rgba(244, 63, 94, 0.4); }
.call-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.call-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.pulse-ring { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.45); }
  50% { box-shadow: 0 0 0 12px rgba(244, 63, 94, 0); }
}

.timer { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- misc */
.empty-state { text-align: center; padding: 46px 20px; color: var(--txt-faint); }
.empty-state .icon { font-size: 34px; margin-bottom: 10px; opacity: 0.6; }

.toast-stack {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}
.toast {
  padding: 13px 18px;
  border-radius: 13px;
  font-size: 13.5px;
  animation: slideIn 0.25s ease;
  max-width: 360px;
}
.toast.ok { border-left: 3px solid var(--ok); }
.toast.err { border-left: 3px solid var(--err); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }

.divider { height: 1px; background: var(--glass-border); margin: 14px 0; }

.muted { color: var(--txt-dim); }
.faint { color: var(--txt-faint); }
.small { font-size: 12.5px; }

.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }

/* language switch */
.lang-switch { display: flex; gap: 4px; }
.lang-btn {
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  background: transparent;
  color: var(--txt-dim);
  cursor: pointer;
}
.lang-btn.active { background: var(--glass-strong); color: var(--txt); border-color: var(--glass-border); }

/* ---------- provider quick-start (1-click trunks) ---------- */
.provider-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.provider-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  color: var(--txt);
  font: inherit;
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.provider-card:hover {
  border-color: var(--glass-border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.provider-logo {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #e20074, #ff5ea8);
}
.provider-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.provider-name { font-weight: 600; font-size: 14px; }
.provider-hint {
  font-size: 12px;
  color: var(--txt-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.provider-cta {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-2);
  white-space: nowrap;
}

/* wizard modal tweaks */
.wizard-sub { color: var(--txt-dim); font-size: 13px; margin: -8px 0 16px; }
.wizard-grid { grid-template-columns: 1fr; }
.wizard-note { display: block; margin-top: 4px; color: var(--txt-faint); font-size: 11px; }

/* responsive */
@media (max-width: 900px) {
  .sidebar { width: 64px; }
  .nav-item span.nav-label { display: none; }
  .phone-panel { width: 100%; }
  .main { flex-direction: column; }
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
