/* =====================================================================
   SOFTPHONE UI — style.css
   Light, professional, minimal desktop-first RTL interface.
===================================================================== */

:root {
  --bg: #f2f3f6;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e5e7ec;
  --border-strong: #d9dbe3;

  --text-primary: #1a1d29;
  --text-secondary: #6b7280;
  --text-tertiary: #9aa0ab;

  --accent: #4a4ee0;
  --accent-hover: #3d40c9;
  --accent-soft: #eef0fd;

  --success: #1fa971;
  --success-hover: #188a5c;
  --success-soft: #e6f7ef;

  --danger: #e5484d;
  --danger-hover: #cf3c41;
  --danger-soft: #fdeced;

  --warning: #d98a1a;
  --warning-soft: #fbf1e0;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-round: 999px;

  --shadow-sm: 0 1px 2px rgba(20, 20, 40, 0.04), 0 1px 1px rgba(20,20,40,0.03);
  --shadow-md: 0 4px 16px rgba(20, 20, 40, 0.07);
  --shadow-lg: 0 16px 48px rgba(20, 20, 40, 0.16);

  --sidebar-w: 84px;
  --topbar-h: 56px;

  --ease: cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  position: relative;
  font-family: "Segoe UI", "Heebo", "Arial Hebrew", Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Subtle ambient color behind the whole app — none of the app's own
   panels/cards are transparent, so this only ever peeks through in open
   areas (behind the dial pad, list backgrounds, etc). Same accent/success
   colors as the call-screen blobs, just far more muted. */
body::before {
  content: "";
  position: fixed;
  inset: -10%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38% 32% at 12% 18%, rgba(74, 78, 224, 0.14), transparent 70%),
    radial-gradient(34% 30% at 88% 14%, rgba(31, 169, 113, 0.12), transparent 70%),
    radial-gradient(40% 36% at 50% 100%, rgba(74, 78, 224, 0.09), transparent 70%);
  filter: blur(50px);
}

/* Several components below (.incoming-overlay, .call-overlay,
   .modal-overlay, .view, ...) set their own `display` (flex/etc) so
   they can be toggled on/off from JS by setting the `hidden` attribute.
   The `hidden` attribute only wins when nothing else sets `display`,
   so we force it here — this must stay ahead of every rule that sets
   `display` on those elements. */
[hidden] {
  display: none !important;
}

button, input, select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

::selection { background: var(--accent-soft); color: var(--accent); }

/* =====================================================================
   APP SHELL
===================================================================== */

.app-shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Top bar ---------- */

.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-round);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.status-pill:hover { background: #eef0f3; }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-tertiary);
  flex-shrink: 0;
}

.status-pill[data-state="connected"] .status-dot { background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.status-pill[data-state="connected"] .status-text { color: var(--success); }

.status-pill[data-state="connecting"] .status-dot { background: var(--warning); animation: pulse-dot 1s infinite; }
.status-pill[data-state="connecting"] .status-text { color: var(--warning); }

.status-pill[data-state="error"] .status-dot { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.status-pill[data-state="error"] .status-text { color: var(--danger); }

.status-pill[data-state="disconnected"] .status-dot { background: var(--text-tertiary); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

.topbar-ext {
  margin-inline-start: auto;
  font-size: 13px;
  color: var(--text-secondary);
}
.topbar-ext strong { color: var(--text-primary); }

/* ---------- Body layout ---------- */

.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ---------- Sidebar ---------- */

.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-inline-start: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 8px;
  gap: 4px;
}

.nav-spacer { flex: 1; }

.nav-btn {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px 4px;
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: 11px;
  font-weight: 600;
  transition: background .15s var(--ease), color .15s var(--ease);
}

.nav-btn svg { transition: transform .15s var(--ease); }

.nav-btn:hover {
  background: var(--surface-2);
  color: var(--text-secondary);
}

.nav-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-btn:active svg { transform: scale(0.9); }

.nav-icon-wrap { position: relative; display: inline-flex; }

/* Missed-call count — stays lit until the user opens the history view
   (unlike a toast, it does not disappear on its own). */
.nav-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- Main content ---------- */

.main-content {
  flex: 1;
  position: relative;
  min-width: 0;
  overflow: hidden;
  display: flex;
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 28px 32px;
  overflow-y: auto;
  animation: fade-in .18s var(--ease);
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =====================================================================
   DIAL VIEW
===================================================================== */

.view-dial {
  align-items: center;
  justify-content: center;
}

.dial-panel {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.dial-display-wrap {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
}

.dial-display {
  width: 100%;
  border: none;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  text-align: center;
  direction: ltr;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--text-primary);
  padding: 8px 40px;
  border-radius: var(--radius-md);
  transition: background .15s var(--ease);
}
.dial-display::placeholder { color: var(--text-tertiary); font-weight: 400; font-size: 20px; }
.dial-display:focus { background: var(--surface-2); outline: none; }

.dial-backspace {
  position: absolute;
  inset-inline-end: 4px;
  color: var(--text-tertiary);
}
.dial-backspace:hover { color: var(--text-secondary); }

/* Live contact matches while dialing — tap one to call immediately. */
.dial-suggestions {
  width: 100%;
  max-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: var(--shadow-sm);
  margin-top: -10px;
}
.dial-suggestion-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  text-align: right;
}
.dial-suggestion-row:hover { background: var(--accent-soft); }
.dial-suggestion-row .avatar { width: 32px; height: 32px; font-size: 12px; flex-shrink: 0; }
.dial-suggestion-row .row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dial-suggestion-row .row-title { font-size: 13px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dial-suggestion-row .row-sub { font-size: 11.5px; color: var(--text-secondary); direction: ltr; text-align: right; }

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
}

.key {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: transform .08s var(--ease), background .12s var(--ease), box-shadow .12s var(--ease);
}

.key:hover { background: var(--surface-2); box-shadow: var(--shadow-md); }
.key:active { transform: scale(0.94); background: var(--accent-soft); }

.key-num {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
}
.key-sub {
  font-size: 9.5px;
  letter-spacing: 1.5px;
  color: var(--text-tertiary);
  font-weight: 600;
}

.dial-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  width: 100%;
  margin-top: 4px;
}

.round-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.round-btn.ghost:hover { background: var(--surface-2); color: var(--text-primary); }

.call-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(31, 169, 113, 0.35);
  transition: transform .12s var(--ease), background .12s var(--ease), box-shadow .12s var(--ease);
}
.call-btn:hover { background: var(--success-hover); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(31,169,113,.4); }
.call-btn:active { transform: scale(0.95); }

/* =====================================================================
   LIST VIEWS (contacts / history / favorites)
===================================================================== */

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.view-header h1 {
  font-size: 21px;
  font-weight: 700;
  margin: 0;
}

.view-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-round);
  padding: 8px 14px;
  min-width: 220px;
  color: var(--text-tertiary);
}
.search-box input {
  border: none;
  background: transparent;
  flex: 1;
  font-size: 13.5px;
  color: var(--text-primary);
}
.search-box input:focus { outline: none; }

.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-round);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled { background: var(--border-strong); color: var(--text-tertiary); cursor: not-allowed; }

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-2); color: var(--text-primary); }

.segmented {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-round);
  padding: 3px;
  gap: 2px;
}
.segmented-btn {
  padding: 6px 13px;
  border-radius: var(--radius-round);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.segmented-btn.active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 60px 20px;
  color: var(--text-tertiary);
  text-align: center;
  grid-column: 1 / -1; /* stay full-width if the parent happens to be a grid (favorites) */
}
.empty-state svg { opacity: .5; margin-bottom: 6px; }
.empty-state strong { color: var(--text-secondary); font-size: 14px; }
.empty-state span { font-size: 12.5px; }

/* --- favorites: speed-dial grid instead of a list (tap a tile to call
       straight away, like a real phone's favorites screen) --- */

#favoritesList.favorites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 18px;
  align-content: start;
}

.favorite-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 6px;
  border-radius: var(--radius-md);
  text-align: center;
  transition: background .15s var(--ease), transform .1s var(--ease);
}
.favorite-tile:hover { background: var(--surface); box-shadow: var(--shadow-sm); }
.favorite-tile:active { transform: scale(0.96); }

.tile-avatar {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 21px;
  flex-shrink: 0;
}
.tile-star {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--warning);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--surface);
}

.tile-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* --- list row / card --- */

.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  transition: box-shadow .15s var(--ease), border-color .15s var(--ease);
}
.list-row:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

.row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.row-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-sub {
  font-size: 12.5px;
  color: var(--text-secondary);
  direction: ltr;
  text-align: right;
}

.row-count {
  color: var(--text-tertiary);
  font-weight: 600;
  margin-inline-start: 4px;
}

.row-note-icon {
  color: var(--text-tertiary);
  margin-inline-start: 4px;
  vertical-align: -2px;
}

.row-meta {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: left;
  min-width: 100px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text-primary); }

.icon-btn.call { color: var(--success); }
.icon-btn.call:hover { background: var(--success-soft); }

.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.icon-btn.star.active { color: #d9a621; }

/* direction icon coloring for history */
.dir-icon { display: flex; align-items: center; justify-content: center; width: 34px; flex-shrink: 0; }
.dir-icon.incoming { color: var(--success); }
.dir-icon.outgoing { color: var(--accent); }
.dir-icon.missed { color: var(--danger); }

/* =====================================================================
   SETTINGS VIEW
===================================================================== */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  max-width: 980px;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}

.settings-card h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
}

.settings-hint {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 0 0 16px;
  line-height: 1.6;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.form-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.form-row input, .form-row select, .form-row textarea {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--text-primary);
  direction: ltr;
  text-align: right;
}
.form-row textarea {
  direction: rtl;
  text-align: right;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}
.form-row input:disabled, .form-row select:disabled {
  color: var(--text-tertiary);
  cursor: not-allowed;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: 2px solid var(--accent); background: var(--surface); }

.demo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.blacklist-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.blacklist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.blacklist-row .row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.blacklist-row .row-title { font-size: 13px; font-weight: 600; color: var(--text-primary); direction: ltr; text-align: right; }
.blacklist-row .row-sub { font-size: 11.5px; color: var(--text-secondary); }
.blacklist-empty { font-size: 12.5px; color: var(--text-tertiary); padding: 6px 2px; }

/* =====================================================================
   ACTIVE CALL OVERLAY
===================================================================== */

.call-overlay {
  position: absolute;
  inset: 0;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
  animation: fade-in .2s var(--ease);
  overflow: hidden;
}

/* Soft, colorful blurred blobs behind the call card — the "like a real
   phone call screen" background. Pure CSS (no photo needed): a few large,
   heavily-blurred radial gradients in the app's own accent/success colors. */
.call-overlay::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(42% 36% at 22% 24%, rgba(74, 78, 224, 0.55), transparent 70%),
    radial-gradient(40% 34% at 82% 20%, rgba(31, 169, 113, 0.45), transparent 70%),
    radial-gradient(46% 40% at 50% 94%, rgba(74, 78, 224, 0.35), transparent 70%),
    var(--bg);
  filter: blur(70px);
}

.call-card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(22px) saturate(150%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 340px;
  padding: 28px 24px;
}

.call-avatar {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 32px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}
.call-avatar.big { width: 110px; height: 110px; font-size: 38px; }

.call-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.call-number {
  font-size: 14px;
  color: var(--text-secondary);
  direction: ltr;
}

.call-status {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  padding: 5px 14px;
  background: var(--accent-soft);
  border-radius: var(--radius-round);
}

.call-status.status-connected { color: var(--success); background: var(--success-soft); }
.call-status.status-ended { color: var(--danger); background: var(--danger-soft); }

.call-timer {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

.held-call-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--warning-soft);
  color: var(--warning);
  border-radius: var(--radius-round);
  font-size: 12.5px;
  font-weight: 600;
  transition: background .15s var(--ease);
}
.held-call-bar:hover { background: rgba(217, 138, 26, 0.2); }
.held-call-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.held-call-bar strong { color: var(--text-primary); }

.call-volume {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 220px;
  color: var(--text-tertiary);
  margin: 6px 0;
}
.call-volume input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.call-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 4px;
}

.ctrl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 74px;
  padding: 12px 6px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid transparent;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.ctrl-btn:hover { background: #eef0f3; }
.ctrl-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(74, 78, 224, 0.25);
}

.hangup-btn {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  box-shadow: 0 8px 20px rgba(229, 72, 77, 0.35);
  transition: transform .12s var(--ease), background .12s var(--ease);
}
.hangup-btn:hover { background: var(--danger-hover); transform: translateY(-1px); }
.hangup-btn:active { transform: scale(0.95); }

.call-dtmf {
  width: 100%;
  max-width: 280px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 14px;
  margin: 4px 0;
  animation: fade-in .15s var(--ease);
}
.call-dtmf-log {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 3px;
  color: var(--text-secondary);
  min-height: 20px;
  margin-bottom: 10px;
  direction: ltr;
}
.keypad-compact { gap: 8px; }
.keypad-compact .key { box-shadow: none; }
.keypad-compact .key-num { font-size: 16px; }

/* =====================================================================
   INCOMING CALL MODAL
===================================================================== */

.incoming-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 34, 0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fade-in .18s var(--ease);
  overflow: hidden;
}

/* Same colorful blurred-blob treatment as the active-call screen, so the
   "ringing" screen and the "connected" screen feel like one consistent,
   good-looking call experience rather than a plain dialog box. */
.incoming-overlay::before {
  content: "";
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(42% 36% at 20% 22%, rgba(74, 78, 224, 0.55), transparent 70%),
    radial-gradient(40% 34% at 84% 18%, rgba(31, 169, 113, 0.4), transparent 70%),
    radial-gradient(46% 40% at 50% 94%, rgba(74, 78, 224, 0.3), transparent 70%);
  filter: blur(70px);
}

.incoming-card {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px) saturate(150%);
  border-radius: var(--radius-lg);
  padding: 36px 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 320px;
  box-shadow: var(--shadow-lg);
}

.incoming-ring {
  position: absolute;
  top: 30px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 2px solid var(--success);
  opacity: 0;
  animation: ring-pulse 1.6s infinite var(--ease);
}
@keyframes ring-pulse {
  0% { transform: scale(0.85); opacity: .8; }
  100% { transform: scale(1.35); opacity: 0; }
}

.incoming-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--success);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 4px;
}

.incoming-actions {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-top: 18px;
}

.round-action {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: transform .12s var(--ease);
  box-shadow: var(--shadow-md);
}
.round-action:hover { transform: translateY(-2px); }
.round-action:active { transform: scale(0.94); }
.round-action.answer { background: var(--success); }
.round-action.decline { background: var(--danger); }

/* =====================================================================
   ADD CONTACT MODAL
===================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 34, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  animation: fade-in .15s var(--ease);
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 26px 26px 20px;
  width: 340px;
  box-shadow: var(--shadow-lg);
}

.modal-card h2 {
  font-size: 16px;
  margin: 0 0 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* ---------- Call / number details modal ---------- */

.details-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.details-avatar { width: 48px; height: 48px; font-size: 17px; }
.details-id { min-width: 0; }
.details-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.details-number {
  font-size: 13px;
  color: var(--text-secondary);
  direction: ltr;
  text-align: right;
}

.details-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.details-actions .btn-secondary { justify-content: center; width: 100%; }
.btn-secondary.danger { color: var(--danger); border-color: var(--danger-soft); }
.btn-secondary.danger:hover { background: var(--danger-soft); color: var(--danger-hover); }

/* =====================================================================
   TOASTS
===================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  align-items: center;
}

.toast {
  background: var(--text-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--radius-round);
  box-shadow: var(--shadow-md);
  animation: toast-in .2s var(--ease);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =====================================================================
   RESPONSIVE
===================================================================== */

@media (max-width: 860px) {
  :root { --sidebar-w: 68px; }
  /* Only the text label collapses to icon-only — .nav-icon-wrap (the
     history button's icon+badge wrapper) is also a <span> and must stay
     visible, or that button renders completely empty. */
  .nav-btn .nav-label { display: none; }
  .view { padding: 20px 16px; }
  .view-header { flex-direction: column; align-items: stretch; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .topbar-ext { display: none; }
  .search-box { min-width: 0; flex: 1; }
}
