/* GreenTech Dialer web app — plain CSS, no build step (see docs/PRD.md §12:
   this whole app is deliberately zero-dependency, same rationale as the
   backend). Colors match the Android app (android-app/.../colors.xml) so the
   two feel like one product. */

:root {
  --brand-green: #1DA24A;
  --brand-green-dark: #137A36;
  --surface-muted: #F5F6F8;
  --text: #1A1A1A;
  --text-muted: #666666;
  --danger: #D32F2F;
  --border: #E0E0E0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--surface-muted);
  color: var(--text);
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---- Top bar ---- */

.topbar {
  background: var(--brand-green);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; }
.topbar .who { font-size: 13px; opacity: 0.9; }
.topbar nav { display: flex; gap: 6px; flex-wrap: wrap; }
.topbar nav button {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.topbar nav button.active { background: #fff; color: var(--brand-green-dark); font-weight: 600; }
.topbar .logout { background: rgba(0,0,0,0.15); }

/* ---- Softphone status pill ---- */

.phone-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
}
.phone-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #FFC107; }
.phone-status.ready .dot { background: #7CFFA0; }
.phone-status.error .dot { background: #FF8A80; }

/* ---- Generic layout ---- */

main { flex: 1; padding: 20px; max-width: 720px; width: 100%; margin: 0 auto; }
.card {
  background: #fff;
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
h2 { font-size: 16px; margin: 0 0 4px; }
p.hint { color: var(--text-muted); font-size: 13px; margin: 4px 0 0; }

/* ---- Login ---- */

.login-shell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.login-card h1 { text-align: center; color: var(--brand-green-dark); margin: 0 0 24px; }

label { display: block; font-size: 13px; color: var(--text-muted); margin: 12px 0 4px; }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 60px; }

button {
  font-family: inherit;
  cursor: pointer;
}
.btn-primary {
  background: var(--brand-green);
  color: #fff;
  border: none;
  padding: 11px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  width: 100%;
  margin-top: 18px;
}
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-secondary {
  background: #fff;
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
}
.btn-danger { background: var(--danger); color: #fff; border: none; padding: 10px 16px; border-radius: 6px; font-weight: 600; }

.error-text { color: var(--danger); font-size: 13px; margin-top: 10px; }

/* ---- Dashboard stats ---- */

.stats-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-box { flex: 1; min-width: 110px; background: #fff; border-radius: 10px; padding: 14px; text-align: center; }
.stat-box .n { font-size: 24px; font-weight: 700; color: var(--brand-green-dark); }
.stat-box .l { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ---- Queue ---- */

.queue-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; flex-wrap: wrap; }
.auto-dial-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.contact-row {
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.contact-row .info { min-width: 0; }
.contact-row .name { font-weight: 700; font-size: 15px; }
.contact-row .phone { color: var(--text-muted); font-size: 13px; }
.contact-row .disp { font-size: 12px; color: var(--brand-green-dark); margin-top: 2px; }
.call-btn {
  background: var(--brand-green);
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 18px;
  flex-shrink: 0;
}
.call-btn:disabled { opacity: 0.5; }
.empty-state { text-align: center; color: var(--text-muted); padding: 40px 20px; }

/* ---- In-call overlay ---- */

.call-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,20,20,0.92);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  text-align: center;
  padding: 20px;
}
.call-overlay .call-name { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.call-overlay .call-phone { color: #ccc; margin-bottom: 20px; }
.call-overlay .call-timer { font-size: 32px; font-variant-numeric: tabular-nums; margin-bottom: 30px; }
.call-overlay .call-state { color: #aaa; margin-bottom: 30px; }

/* ---- Disposition modal ---- */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center; z-index: 60; padding: 20px;
}
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 420px; }

/* ---- Per-agent settings rows ---- */

.agent-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.agent-row:last-child { border-bottom: none; }
.agent-row .info .name { font-weight: 600; font-size: 14px; }
.agent-row .info .phone { color: var(--text-muted); font-size: 12px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.toggle {
  position: relative; width: 46px; height: 26px; flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track {
  position: absolute; inset: 0; background: #ccc; border-radius: 999px; transition: 0.15s; cursor: pointer;
}
.toggle .track::before {
  content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: 0.15s;
}
.toggle input:checked + .track { background: var(--brand-green); }
.toggle input:checked + .track::before { transform: translateX(20px); }

@media (max-width: 480px) {
  main { padding: 12px; }
  .login-card { padding: 24px; }
}
