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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0f0f0f;
  color: #f0f0f0;
}

a { color: #60a5fa; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Call app layout ─────────────────────────────────────────────────────────
   Applies when body does NOT have .landing or .auth-page class */

body:not(.landing):not(.auth-page) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────────────────────────*/

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #1e1e1e;
  background: #0f0f0f;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f0f0f0;
  text-decoration: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-user {
  font-size: 0.9rem;
  color: #888;
}

.btn-ghost {
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid #333;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: #aaa;
  transition: all 0.15s;
}
.btn-ghost:hover { border-color: #555; color: #f0f0f0; }

/* ── Dashboard layout (sidebar + main) ───────────────────────────────────────*/

body.dash-body { background: #0c0c10; }

.dash-layout {
  display: flex;
  min-height: 100vh;
  flex: 1;
}

.sidebar {
  width: 232px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: #101014;
  border-right: 1px solid #1d1d24;
  padding: 1.25rem 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-logo {
  font-size: 1.2rem;
  font-weight: 800;
  color: #f0f0f0;
  text-decoration: none;
  padding: 0.25rem 0.9rem;
}
.sidebar-logo:hover { text-decoration: none; }

.side-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 1.75rem;
}

.dash-tab {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.9rem;
  font-size: 0.92rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: transparent;
  color: #84848f;
  text-align: left;
  transition: all 0.15s;
}
.dash-tab svg { width: 18px; height: 18px; flex-shrink: 0; }
.dash-tab:hover { color: #f0f0f0; opacity: 1; background: #16161c; }
.dash-tab.active {
  background: #1b1b22;
  color: #f0f0f0;
  box-shadow: inset 0 0 0 1px #26262f;
}

.sidebar-footer {
  border-top: 1px solid #1d1d24;
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.sidebar-user { display: flex; align-items: center; gap: 0.6rem; padding: 0 0.25rem; }

.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #3b82f6);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
}

.dash-main {
  flex: 1;
  min-width: 0;
  padding: 2rem;
}

.dash-panel.hidden { display: none; }

.panel-inner {
  width: 100%;
  max-width: 700px;
  margin: 1rem auto;
  padding: 0 1rem 3rem;
}

.panel-inner h1 { font-size: 2rem; font-weight: 800; margin-bottom: 1rem; }
.panel-inner .lead { font-size: 1.05rem; color: #bbb; line-height: 1.7; margin-bottom: 2rem; }
.panel-inner h2 { font-size: 1.1rem; font-weight: 700; margin: 2rem 0 0.6rem; color: #ddd; }
.panel-inner p { color: #999; line-height: 1.75; margin-bottom: 0.75rem; }
.panel-inner ul { list-style: none; margin-bottom: 0.75rem; }
.panel-inner ul li { color: #999; line-height: 1.75; padding-left: 1rem; position: relative; }
.panel-inner ul li::before { content: '–'; position: absolute; left: 0; color: #555; }

/* ── Call panel: call card + history ─────────────────────────────────────────*/

.call-grid {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
  align-items: start;
}

#app { width: 100%; }
#app > .screen { width: 100%; }

.history-card {
  background: #131318;
  border: 1px solid #20202a;
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.history-head h3 { font-size: 1rem; font-weight: 700; }

.btn-small { padding: 0.3rem 0.7rem; font-size: 0.75rem; }

.history-list { list-style: none; }

.history-list li {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.25rem;
  border-bottom: 1px solid #1b1b22;
}
.history-list li:last-child { border-bottom: none; }

.history-empty { color: #666; font-size: 0.9rem; justify-content: center; padding: 1.5rem 0 !important; }

.hist-dir {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  background: #1b1b22;
}
.hist-dir.outgoing { color: #60a5fa; }
.hist-dir.incoming { color: #4ade80; }
.hist-dir.bad      { color: #f87171; }

.hist-info { flex: 1; min-width: 0; text-align: left; }
.hist-peer { font-size: 0.92rem; font-weight: 600; color: #e8e8ee; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-meta { font-size: 0.78rem; color: #71717c; margin-top: 0.1rem; }
.hist-when { font-size: 0.78rem; color: #5c5c66; flex-shrink: 0; }

/* ── Dashboard responsive ────────────────────────────────────────────────────*/

@media (max-width: 960px) {
  .call-grid { grid-template-columns: 1fr; max-width: 480px; }
}

@media (max-width: 720px) {
  .dash-layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-right: none;
    border-bottom: 1px solid #1d1d24;
  }
  .side-nav { flex-direction: row; margin-top: 0; }
  .dash-tab { padding: 0.5rem 0.7rem; }
  .dash-tab span { display: none; }
  .sidebar-footer { border-top: none; padding-top: 0; flex-direction: row; align-items: center; margin-left: auto; }
  .dash-main { padding: 1.25rem 1rem; }
}

/* ── Call app main area ──────────────────────────────────────────────────────*/

.screen {
  padding: 2rem;
  text-align: center;
  background: #131318;
  border: 1px solid #20202a;
  border-radius: 16px;
}
.hidden { display: none; }

h1 { font-size: 2.2rem; font-weight: 700; margin-bottom: 1.5rem; }
h2 { font-size: 1.6rem; font-weight: 600; margin-bottom: 1.5rem; }

.label { font-size: 0.85rem; color: #888; margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 1px; }
.optional { text-transform: none; letter-spacing: 0; }

.call-id {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 3px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 0.75rem;
}

.id-actions { display: flex; gap: 0.5rem; justify-content: center; margin-bottom: 0; }
.id-actions button { flex: 1; font-size: 0.85rem; }

.invite-fallback { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.invite-fallback.hidden { display: none; }
.invite-fallback input { flex: 1; margin-bottom: 0; font-size: 0.8rem; text-align: left; }
.invite-fallback button { font-size: 0.85rem; }

.display-name { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.25rem; }
.remote-id    { font-size: 1.1rem; font-weight: 500; color: #aaa; margin-bottom: 0.5rem; }
.status       { font-size: 0.9rem; color: #888; margin-bottom: 1.5rem; }
.divider      { border-top: 1px solid #222; margin: 1.5rem 0; }
.name-row     { margin-top: 1rem; }
.name-row .label { margin-bottom: 0.4rem; }

input {
  width: 100%;
  padding: 0.8rem;
  font-size: 1rem;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  background: #1a1a1a;
  color: #f0f0f0;
  text-align: center;
  margin-bottom: 0.75rem;
  outline: none;
}
input:focus { border-color: #3b82f6; }

#target-input { letter-spacing: 2px; text-transform: uppercase; }
#name-input   { margin-bottom: 0; }

button {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #2a2a2a;
  color: #f0f0f0;
  transition: opacity 0.15s;
}
button:hover { opacity: 0.85; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

#call-btn   { width: 100%; background: #22c55e; color: #fff; }
#copy-btn   { background: #3b82f6; color: #fff; }
#invite-btn { background: #7c3aed; color: #fff; }

.btn-blue   { background: #3b82f6; color: #fff; }
.btn-purple { background: #7c3aed; color: #fff; }
.green      { background: #22c55e; color: #fff; }
.red        { background: #ef4444; color: #fff; }

.actions { display: flex; gap: 0.75rem; justify-content: center; margin-top: 1.5rem; }
.actions button { flex: 1; }

.error-msg {
  font-size: 0.85rem;
  color: #f87171;
  margin-top: 1rem;
  line-height: 1.5;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60%  { transform: translateX(-5px); }
  40%, 80%  { transform: translateX(5px); }
}
.shake { animation: shake 0.3s ease; }

/* ── Landing page ────────────────────────────────────────────────────────────*/

body.landing {
  display: block;
  min-height: 100vh;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid #1a1a1a;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: #f0f0f0;
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.95rem;
}

.nav-links a { color: #aaa; transition: color 0.15s; }
.nav-links a:hover,
.nav-links a.active { color: #f0f0f0; text-decoration: none; }

.nav-cta {
  background: #3b82f6;
  color: #fff !important;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  font-weight: 600;
  transition: opacity 0.15s !important;
}
.nav-cta:hover { opacity: 0.85; text-decoration: none !important; }

.hero {
  padding: 5rem 2rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

.hero-inner { max-width: 640px; }

.hero-badge {
  display: inline-block;
  font-size: 0.8rem;
  color: #60a5fa;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 20px;
  padding: 0.3rem 0.9rem;
  margin-bottom: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  letter-spacing: -0.5px;
}

.hero-sub {
  font-size: 1.1rem;
  color: #999;
  line-height: 1.7;
  margin-bottom: 2rem;
  max-width: 520px;
}

.hero-actions { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

.btn-primary {
  display: inline-block;
  background: #3b82f6;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.85rem 1.8rem;
  border-radius: 10px;
  text-decoration: none;
  transition: opacity 0.15s;
  border: none;
  cursor: pointer;
}
.btn-primary:hover { opacity: 0.85; text-decoration: none; }
.btn-primary.full-width { display: block; width: 100%; text-align: center; }

.btn-ghost-link {
  color: #aaa;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}
.btn-ghost-link:hover { color: #f0f0f0; }

.features {
  padding: 3rem 2rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  background: #141414;
  border: 1px solid #1e1e1e;
  border-radius: 12px;
  padding: 1.5rem;
}

.feature-icon { font-size: 1.8rem; margin-bottom: 0.75rem; }

.feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.feature-card p { font-size: 0.9rem; color: #888; line-height: 1.6; }

.cta-section {
  text-align: center;
  padding: 4rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.cta-section h2 { font-size: 2rem; font-weight: 800; margin-bottom: 0.75rem; }
.cta-section p  { color: #888; margin-bottom: 1.75rem; font-size: 1rem; }

.footer {
  border-top: 1px solid #1a1a1a;
  padding: 1.5rem 2rem;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-logo { font-weight: 800; font-size: 1rem; color: #555; }
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { color: #666; font-size: 0.9rem; }
.footer-links a:hover { color: #aaa; }
.footer-copy { font-size: 0.8rem; color: #444; }

/* ── Content pages (about, contact) ─────────────────────────────────────────*/

.content-page {
  max-width: 700px;
  margin: 3rem auto;
  padding: 0 2rem 4rem;
}

.content-page h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.content-page .lead {
  font-size: 1.1rem;
  color: #bbb;
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

.content-page h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 2rem 0 0.6rem;
  color: #ddd;
}

.content-page p {
  color: #999;
  line-height: 1.75;
  margin-bottom: 0.75rem;
}

.content-page ul {
  list-style: none;
  margin-bottom: 0.75rem;
}

.content-page ul li {
  color: #999;
  line-height: 1.75;
  padding-left: 1rem;
  position: relative;
}

.content-page ul li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: #555;
}

.content-page code {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 4px;
  padding: 0.1em 0.4em;
  font-family: monospace;
  font-size: 0.9em;
  color: #60a5fa;
}

.contact-form {
  margin-top: 2rem;
  max-width: 560px;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
}

.contact-form input,
.contact-form textarea {
  text-align: left;
  margin-bottom: 0;
  width: 100%;
}

.contact-form textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.6;
  font-family: inherit;
  background: #1a1a1a;
  color: #f0f0f0;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 0.8rem;
  font-size: 1rem;
  outline: none;
  box-sizing: border-box;
}

.contact-form textarea:focus {
  border-color: #3b82f6;
}

.cf-error {
  font-size: 0.85rem;
  color: #f87171;
  margin-top: 0.75rem;
  line-height: 1.5;
}

.cf-success {
  font-size: 0.9rem;
  color: #4ade80;
  margin-top: 0.75rem;
  line-height: 1.5;
}

/* ── Auth / Login page ───────────────────────────────────────────────────────*/

body.auth-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: #141414;
  border: 1px solid #1e1e1e;
  border-radius: 16px;
  padding: 2rem;
}

.auth-logo {
  display: block;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: #f0f0f0;
  text-decoration: none;
  margin-bottom: 1.75rem;
}

.auth-tabs {
  display: flex;
  background: #0f0f0f;
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 1.5rem;
  gap: 3px;
}

.auth-tab {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: #666;
  transition: all 0.15s;
}

.auth-tab.active {
  background: #1e1e1e;
  color: #f0f0f0;
}

.auth-form label {
  display: block;
  font-size: 0.8rem;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.35rem;
}

.auth-form input {
  text-align: left;
  margin-bottom: 1rem;
}

.auth-error {
  font-size: 0.85rem;
  color: #f87171;
  margin-top: 0.75rem;
  line-height: 1.5;
}

/* ── Invite page ─────────────────────────────────────────────────────────────*/

.invite-status {
  text-align: center;
  color: #888;
  font-size: 0.95rem;
  padding: 1rem 0;
}

#invite-content { text-align: center; }

#invite-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.invite-sub {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

#invite-error { text-align: center; }
#invite-error a { display: inline-block; margin-top: 1rem; }
