/* BlackSheep Waiting Calls — PWA styles
   Adapted from chat-queue-pwa/frontend/style.css.
   Palette: Inter + black/white (matches booking module).
   Removed: settings modal, leaderboard, chart, Zendesk department colours.
   Added: entry card states (waiting / in_progress / mine / completed),
          contact reveal panel, Complete/Release buttons, header stats strip. */

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

:root {
  --theme-primary: #1a1a1a;
  --theme-text:    #1a1a1a;
  --theme-bg:      #f5f5f3;
  --theme-font:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --black:      var(--theme-text);
  --white:      #ffffff;
  --off-white:  var(--theme-bg);
  --light-grey: #e8e8e6;
  --mid-grey:   #b0b0ad;
  --dark-grey:  #6b6b68;

  --green:      #2d8a4e;
  --yellow:     #c49a1a;
  --red:        #c43333;
  --indigo:     #5b5fc7;

  --green-bg:   #edf7f0;
  --yellow-bg:  #fdf6e3;
  --red-bg:     #fdf0f0;
  --indigo-bg:  #eeeffe;

  --font: var(--theme-font);
}

body {
  font-family: var(--font);
  background: var(--off-white);
  color: var(--black);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}

/* ─── Loading / error screens ─────────────────────────────────────────────── */

.loading-screen,
.error-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 24px;
  gap: 20px;
  text-align: center;
}

.loading-logo {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border: 1.5px solid var(--black);
  padding: 8px 18px;
}

.loading-spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--light-grey);
  border-top-color: var(--black);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.loading-screen p,
.error-screen p {
  font-size: 15px;
  color: var(--dark-grey);
  max-width: 280px;
  line-height: 1.5;
}

.error-screen h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.error-screen button {
  padding: 12px 28px;
  background: var(--black);
  color: var(--white);
  border: none;
  font-size: 14px;
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 6px;
  transition: opacity 0.15s;
}

.error-screen button:hover { opacity: 0.8; }

/* ─── Header ──────────────────────────────────────────────────────────────── */

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--theme-primary);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 16px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.status-dot.disconnected {
  background: var(--red);
  animation: pulse 2s infinite;
}

.header-brand {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.header-title {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
}

/* ─── Header stats strip ──────────────────────────────────────────────────── */

.header-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-width: 48px;
}

.header-stat-value {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

.header-stat-label {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.55);
  white-space: nowrap;
}

.header-stat-sep {
  color: rgba(255,255,255,0.3);
  font-size: 16px;
  padding-bottom: 6px;
}

/* ─── Agent avatars ───────────────────────────────────────────────────────── */

.agent-avatars {
  display: flex;
  align-items: center;
}

.agent-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255,255,255,0.4);
  margin-left: -6px;
  cursor: default;
  text-transform: uppercase;
}

.agent-avatar:first-child { margin-left: 0; }

.agent-avatar:hover {
  z-index: 2;
  transform: scale(1.1);
  transition: transform 0.15s;
}

/* ─── Connection banner ───────────────────────────────────────────────────── */

.connection-banner {
  background: var(--yellow-bg);
  color: var(--yellow);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 10px 20px;
  border-bottom: 1px solid #e8d9a8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.connection-banner.error {
  background: var(--red-bg);
  color: var(--red);
  border-bottom-color: #e8b8b8;
}

.connection-banner::before {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.connection-banner.error::before {
  content: "!";
  border: none;
  animation: none;
  font-weight: 700;
  width: auto;
  height: auto;
}

/* ─── Notification banner ─────────────────────────────────────────────────── */

.notif-banner {
  background: #fff8f0;
  border-bottom: 1px solid #ffe4c0;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.notif-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.notif-banner-icon { color: #b75e00; flex-shrink: 0; display: inline-flex; }
.notif-banner.denied .notif-banner-icon { color: var(--red); }

.notif-banner-text { display: flex; flex-direction: column; gap: 2px; }
.notif-banner-text strong { font-size: 13px; }
.notif-banner-text span  { font-size: 12px; color: var(--dark-grey); }

.notif-banner-btn {
  background: var(--black);
  color: var(--white);
  border: none;
  padding: 7px 16px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
  transition: opacity 0.15s;
}

.notif-banner-btn:hover { opacity: 0.8; }

.notif-banner-dismiss {
  background: none; border: none;
  font-size: 18px; color: var(--mid-grey);
  cursor: pointer; padding: 0 4px; line-height: 1;
}
.notif-banner-dismiss:hover { color: var(--black); }

.notif-banner.denied { background: var(--red-bg); border-bottom-color: #e8b8b8; }
.notif-banner.denied .notif-banner-btn { display: none; }

/* ─── Agent bar ───────────────────────────────────────────────────────────── */

.agent-bar {
  background: var(--white);
  border-bottom: 1px solid var(--light-grey);
  padding: 10px 24px;
  font-size: 13px;
  color: var(--dark-grey);
}

.agent-bar-label strong { color: var(--black); font-weight: 600; }

/* ─── Queue section ───────────────────────────────────────────────────────── */

.queue-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}

.queue-header {
  padding: 20px 24px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.queue-header-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dark-grey);
}

.queue-header-count {
  font-size: 12px;
  color: var(--dark-grey);
}

/* ─── Queue list ──────────────────────────────────────────────────────────── */

.queue-list {
  flex: 1;
  padding: 0 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 16px;
  padding: 80px 24px;
  color: var(--mid-grey);
}

.empty-state .icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--light-grey);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--dark-grey);
}

.empty-state p {
  font-size: 17px;
  font-weight: 500;
  color: var(--dark-grey);
}

.empty-state .subtext {
  font-size: 14px;
  color: var(--mid-grey);
  margin-top: -8px;
  text-align: center;
}

/* ─── Entry card (base) ───────────────────────────────────────────────────── */

.entry-card {
  background: var(--white);
  border: 1px solid #d8d8d5;
  padding: 14px 16px;
  position: relative;
  transition: box-shadow 0.15s, transform 0.15s;
  animation: slideIn 0.2s ease-out;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.entry-card:first-child { border-radius: 10px 10px 0 0; }
.entry-card:last-of-type { border-radius: 0 0 10px 10px; }
.entry-card:only-of-type { border-radius: 10px; }
.entry-card + .entry-card { border-top: none; }

.entry-card:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,0.07);
  transform: translateY(-1px);
}

/* ─── Waiting states (urgency) ────────────────────────────────────────────── */

.entry-card.warning {
  border-left: 3px solid var(--yellow);
}

.entry-card.urgent {
  border-left: 3px solid var(--red);
  background: var(--red-bg);
}

.entry-card.urgent:hover {
  background: #fbe8e8;
}

/* ─── In-progress state ───────────────────────────────────────────────────── */

.entry-card.in-progress {
  border-left: 3px solid var(--indigo);
  background: #fafafe;
}

.entry-card.in-progress:hover {
  background: #f5f5fd;
}

/* My own claimed entry — slightly more prominent */
.entry-card.in-progress.mine {
  background: var(--indigo-bg);
  border-left-width: 4px;
}

/* ─── Completed state ─────────────────────────────────────────────────────── */

.entry-card.completed {
  opacity: 0.55;
  border-left: 3px solid var(--green);
  pointer-events: none;
}

/* ─── Remove animation ────────────────────────────────────────────────────── */

.entry-card.removing {
  animation: fadeOut 0.25s ease-out forwards;
}

/* ─── Entry card header ───────────────────────────────────────────────────── */

.entry-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.entry-card-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.entry-card-time {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.entry-card-time.green  { color: var(--green);  background: var(--green-bg);  }
.entry-card-time.yellow { color: var(--yellow); background: var(--yellow-bg); }
.entry-card-time.red    { color: var(--red);    background: var(--red-bg);    }

/* ─── Entry card meta row ─────────────────────────────────────────────────── */

.entry-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--dark-grey);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.entry-card-topic {
  font-weight: 500;
  color: var(--black);
}

.entry-card-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--mid-grey);
  flex-shrink: 0;
}

.entry-card-lang {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--light-grey);
  color: var(--dark-grey);
}

.entry-card-phone {
  font-size: 13px;
  color: var(--mid-grey);
  font-variant-numeric: tabular-nums;
}

/* ─── Status badge (in-progress / completed) ──────────────────────────────── */

.entry-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: 4px;
}

.entry-status-badge.in-progress {
  color: var(--indigo);
  background: var(--indigo-bg);
}

.entry-status-badge.completed {
  color: var(--green);
  background: var(--green-bg);
}

/* ─── Contact reveal panel (shown when agent has claimed this entry) ──────── */

.entry-contact {
  background: var(--off-white);
  border: 1px solid var(--light-grey);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
}

.entry-contact-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.entry-contact-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--mid-grey);
}

.entry-contact-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--black);
  word-break: break-all;
}

.entry-contact-value a {
  color: var(--indigo);
  text-decoration: none;
  font-weight: 600;
}

.entry-contact-value a:hover {
  text-decoration: underline;
}

/* ─── Entry card actions ──────────────────────────────────────────────────── */

.entry-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.entry-card-actions-right {
  display: flex;
  gap: 8px;
}

/* Claim button */
.claim-btn {
  font-size: 12px;
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--black);
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.claim-btn:hover:not(:disabled) { opacity: 0.8; }
.claim-btn:disabled { opacity: 0.4; cursor: default; }

.claim-btn.claimed {
  background: var(--green);
  pointer-events: none;
}

/* Complete button */
.complete-btn {
  font-size: 12px;
  font-family: var(--font);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--white);
  background: var(--green);
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.complete-btn:hover:not(:disabled) { opacity: 0.8; }
.complete-btn:disabled { opacity: 0.4; cursor: default; }

/* Release button */
.release-btn {
  font-size: 12px;
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dark-grey);
  background: none;
  border: 1px solid var(--light-grey);
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.release-btn:hover:not(:disabled) {
  border-color: var(--mid-grey);
  color: var(--black);
}

.release-btn:disabled { opacity: 0.4; cursor: default; }

/* ─── Footer ──────────────────────────────────────────────────────────────── */

footer {
  display: flex;
  align-items: center;
  padding: 14px 24px;
  background: var(--white);
  border-top: 1px solid var(--light-grey);
}

footer button {
  background: none;
  border: none;
  font-size: 14px;
  font-family: var(--font);
  color: var(--dark-grey);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
  letter-spacing: 0.02em;
}

.sound-icon { display: inline-flex; align-items: center; }

footer button:hover  { background: var(--off-white); color: var(--black); }
footer button.active { color: var(--black); }
footer button.snoozed { color: var(--yellow); }

/* ─── Modal ───────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal {
  background: var(--white);
  border-radius: 12px;
  padding: 24px;
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.modal-option {
  width: 100%;
  padding: 14px;
  background: var(--off-white);
  border: 1px solid var(--light-grey);
  border-radius: 8px;
  font-size: 15px;
  font-family: var(--font);
  font-weight: 500;
  color: var(--black);
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}

.modal-option:hover { background: var(--light-grey); }

.modal-cancel {
  width: 100%;
  padding: 14px;
  background: none;
  border: none;
  font-size: 15px;
  font-family: var(--font);
  color: var(--dark-grey);
  cursor: pointer;
  margin-top: 4px;
}

.modal-cancel:hover { color: var(--black); }

/* ─── Utility ─────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }

/* ─── Animations ──────────────────────────────────────────────────────────── */

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.98); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  header { padding: 14px 16px; flex-wrap: wrap; gap: 12px; }
  .header-title { display: none; }
  .header-stats { gap: 6px; }
  .header-stat-value { font-size: 16px; }
  .queue-list { padding: 0 12px 16px; }
  .entry-card { padding: 12px 14px; }
  .entry-contact { grid-template-columns: 1fr; }
}

/* ─── View tabs (File / Stats) ──────────────────────────────────────────────── */
.view-tabs { display: inline-flex; gap: 2px; margin-left: 14px; }
.view-tab {
  background: none; border: none; cursor: pointer;
  font: inherit; font-size: 13px; color: #8a8a8a;
  padding: 4px 10px; border-radius: 6px;
}
.view-tab:hover { color: #1a1a1a; }
.view-tab.active { color: #fff; background: #1a1a1a; }

/* ─── Stats section ─────────────────────────────────────────────────────────── */
.stats-section { max-width: 920px; margin: 0 auto; padding: 20px 16px 40px; }
.stats-block-title {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  font-weight: 600; color: #8a8a8a; margin: 22px 4px 10px;
}
.stats-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-card {
  background: #fff; border: 1px solid #e7e7e7; border-radius: 10px;
  padding: 14px 16px; min-height: 78px;
}
.stat-card-label { font-size: 12px; color: #8a8a8a; }
.stat-card-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; }
.stat-card-sub { font-size: 12px; color: #aaa; margin-top: 2px; }
.stat-card-delta { font-size: 12px; margin-top: 2px; }
.delta.good { color: #1a7f37; }
.delta.bad  { color: #c0392b; }
.delta.flat { color: #aaa; }

/* ─── 7-day chart ───────────────────────────────────────────────────────────── */
.stats-chart {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px;
  align-items: end; height: 130px;
  background: #fff; border: 1px solid #e7e7e7; border-radius: 10px; padding: 14px;
}
.chart-col { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.chart-bar-wrap { flex: 1; width: 60%; display: flex; align-items: flex-end; }
.chart-bar { width: 100%; min-height: 2px; background: #1a1a1a; border-radius: 3px 3px 0 0; }
.chart-count { font-size: 12px; font-weight: 600; margin-top: 4px; }
.chart-date { font-size: 10px; color: #aaa; }

/* ─── Leaderboard ───────────────────────────────────────────────────────────── */
.leaderboard-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.leaderboard-tabs { display: inline-flex; gap: 2px; }
.lb-tab {
  background: none; border: 1px solid #e7e7e7; cursor: pointer; font: inherit; font-size: 12px;
  color: #8a8a8a; padding: 4px 10px; border-radius: 6px;
}
.lb-tab.active { color: #fff; background: #1a1a1a; border-color: #1a1a1a; }
.leaderboard-list { background: #fff; border: 1px solid #e7e7e7; border-radius: 10px; overflow: hidden; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #f1f1f1; }
.lb-row:last-child { border-bottom: none; }
.lb-rank { font-size: 18px; width: 22px; text-align: center; }
.lb-name { flex: 1; font-weight: 600; text-transform: capitalize; }
.lb-metric { text-align: right; font-weight: 600; display: flex; flex-direction: column; }
.lb-sub { font-size: 11px; font-weight: 400; color: #aaa; }
.leaderboard-empty { padding: 24px 16px; text-align: center; color: #aaa; font-size: 13px; }

@media (max-width: 640px) {
  .stats-cards { grid-template-columns: 1fr; }
  .stat-card { min-height: 0; }
}
