/* PIER 7 Admin shared styles */
:root {
  --pier-color: #00b4d8;
  --pier-color-dark: #0096b7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
  background: #f0f4f8;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  background: linear-gradient(135deg, var(--pier-color) 0%, color-mix(in srgb, var(--pier-color) 90%, white) 100%);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.topbar img { height: 30px; filter: brightness(0) invert(1); object-fit: contain; }
.topbar h1 { color: #fff; font-size: 18px; font-weight: 700; flex: 1; }
.topbar a { color: rgba(255, 255, 255, 0.8); text-decoration: none; font-size: 13px; margin-left: 16px; }
.topbar a:hover { color: #fff; }

/* Layout */
.wrap { padding: 24px; max-width: 1200px; margin: 0 auto; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: #fff;
  padding: 6px;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  overflow-x: auto;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  letter-spacing: 0.3px;
  white-space: nowrap;
  transition: background 150ms, color 150ms;
}
.tab { text-decoration: none; }
.tab:hover { background: #f3f4f6; color: #1a1a2e; }
/* Active tab is set server-side via body[data-active-tab="X"]. Tab buttons
   are real anchor links — clicking them navigates to a new route. */
body[data-active-tab="reservations"] .tab[data-tab="reservations"],
body[data-active-tab="voice"]        .tab[data-tab="voice"],
body[data-active-tab="texts"]        .tab[data-tab="texts"],
body[data-active-tab="chats"]        .tab[data-tab="chats"],
body[data-active-tab="activity"]     .tab[data-tab="activity"] {
  background: var(--pier-color);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 180, 216, 0.25);
}
body[data-active-tab="reservations"] .tab[data-tab="reservations"] .tab-count,
body[data-active-tab="voice"]        .tab[data-tab="voice"]        .tab-count,
body[data-active-tab="texts"]        .tab[data-tab="texts"]        .tab-count,
body[data-active-tab="chats"]        .tab[data-tab="chats"]        .tab-count,
body[data-active-tab="activity"]     .tab[data-tab="activity"]     .tab-count {
  background: rgba(255, 255, 255, 0.25); color: #fff;
}
.tab-emoji { font-size: 16px; line-height: 1; }
.tab-label { font-size: 13px; }
.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  background: #e5e7eb;
  color: #6b7280;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
}
@media (max-width: 740px) {
  .tab { padding: 9px 12px; }
  .tab-label { display: none; }
  .tab-emoji { font-size: 18px; }
  .tab-count { min-width: 20px; height: 16px; font-size: 10px; }
}

/* Tab panels — only the panel matching body[data-active-tab] is visible. */
.tab-panel { display: none; }
body[data-active-tab="reservations"] .tab-panel[data-panel="reservations"],
body[data-active-tab="voice"]        .tab-panel[data-panel="voice"],
body[data-active-tab="texts"]        .tab-panel[data-panel="texts"],
body[data-active-tab="chats"]        .tab-panel[data-panel="chats"],
body[data-active-tab="activity"]     .tab-panel[data-panel="activity"] {
  display: block;
}

/* Cards */
.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  margin-bottom: 20px;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e8ecf0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h2 { font-size: 15px; color: #1a1a2e; }

/* Badges, tags, stats */
.badge { background: var(--pier-color); color: #fff; border-radius: 20px; padding: 2px 10px; font-size: 12px; }
.tag { background: #e0f7fa; color: var(--pier-color); border-radius: 6px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; margin-bottom: 20px; }
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(3, 1fr); } }
.stat { background: #fff; border-radius: 12px; padding: 16px 20px; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08); }
.stat .num { font-size: 28px; font-weight: 700; color: var(--pier-color); }
.stat .lbl { font-size: 12px; color: #888; margin-top: 2px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  color: #888;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #f9fafb;
  border-bottom: 1px solid #e8ecf0;
}
td { padding: 11px 16px; font-size: 13px; color: #333; border-bottom: 1px solid #f0f4f8; }
tbody tr:nth-child(even) td { background: #fafbfc; }
tr:hover td { background: #f5fbfd; }
.scroll-table { max-height: 400px; overflow-y: auto; overflow-x: hidden; }
/* Truncate the rightmost cell (typically page URL or "ended reason") with an
   ellipsis instead of forcing the table to overflow horizontally. */
.scroll-table td:last-child { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll-table td:last-child a { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }

/* Buttons */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
  margin-bottom: 16px;
  transition: all 0.2s;
}
.back-btn:hover { border-color: var(--pier-color); color: var(--pier-color); }

.add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--pier-color);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.add-btn:hover { background: var(--pier-color-dark); }

.btn { padding: 10px 24px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all 0.2s; }
.btn-primary { background: var(--pier-color); color: #fff; }
.btn-primary:hover { background: var(--pier-color-dark); }
.btn-outline { background: #fff; color: #555; border: 1px solid #dde3ea; text-decoration: none; display: inline-flex; align-items: center; }
.btn-outline:hover { border-color: var(--pier-color); color: var(--pier-color); }
.btn-danger { background: #fff; color: #e53e3e; border: 1px solid #fed7d7; }
.btn-danger:hover { background: #fff5f5; }
.btn-send { background: #38a169; color: #fff; }
.btn-send:hover { background: #2f855a; }

/* Info bar (session/voice/sms detail) */
.info-bar {
  background: #e0f7fa;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 12px;
  color: #333;
  line-height: 1.8;
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
}
.info-bar .label { font-weight: 700; color: #555; }

/* Conversation bubbles */
.convo { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.bubble-row { display: flex; flex-direction: column; max-width: 82%; align-self: flex-start; align-items: flex-start; }
.bubble-role { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; padding-left: 4px; }
.bubble-role.user { color: var(--pier-color); }
.bubble-role.bot { color: #888; }
.bubble { padding: 12px 16px; border-radius: 16px; font-size: 14px; line-height: 1.65; word-wrap: break-word; }
.bubble.user { background: var(--pier-color); color: #fff; border-bottom-left-radius: 4px; }
.bubble.bot { background: #f0f4f8; color: #1a1a2e; border-bottom-left-radius: 4px; }
.bubble strong { font-weight: 700; }
.bubble ul, .bubble ol { margin: 6px 0 6px 20px; }
.bubble li { margin-bottom: 3px; }
.bubble p { margin-bottom: 6px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble-time { font-size: 10px; color: #999; margin-top: 3px; }

/* Menu / onboarding tabs */
.menu-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.menu-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  background: #fff;
  text-decoration: none;
  border: 1px solid #dde3ea;
  transition: all 0.2s;
}
.menu-tab:hover { border-color: var(--pier-color); color: var(--pier-color); }
.menu-tab.active { background: var(--pier-color); color: #fff; border-color: var(--pier-color); }
.menu-tab-count { font-size: 11px; opacity: 0.7; }

/* Form grid */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 20px; }
.form-grid.full { grid-template-columns: 1fr; }
label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
input[type=text], input[type=email], input[type=tel], input[type=date], input[type=number], input[type=password], select, textarea {
  width: 100%;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border 0.2s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--pier-color); }
textarea { resize: vertical; min-height: 80px; }
.form-actions { padding: 20px; border-top: 1px solid #e8ecf0; display: flex; gap: 12px; justify-content: flex-end; }
.checkbox-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; }
.checkbox-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--pier-color); }
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a2e;
  padding: 16px 20px 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  grid-column: 1/-1;
  border-top: 1px solid #e8ecf0;
  margin-top: 4px;
  padding-top: 16px;
}

/* Login */
.login-body { background: #0a1628; display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4); }
.login-card .logo { text-align: center; margin-bottom: 28px; }
.login-card .logo img { height: 40px; object-fit: contain; }
.login-card h2 { text-align: center; color: #1a1a2e; font-size: 18px; margin-bottom: 6px; }
.login-card p { text-align: center; color: #888; font-size: 13px; margin-bottom: 24px; }
.login-card input { width: 100%; margin-bottom: 14px; }
.login-card button { width: 100%; background: var(--pier-color); color: #fff; border: none; border-radius: 8px; padding: 12px; font-size: 15px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.login-card button:hover { background: var(--pier-color-dark); }
.login-card .err { color: #e53e3e; font-size: 13px; text-align: center; margin-bottom: 12px; }

/* Employee send summary */
.emp-summary { background: #f0f9fc; border-radius: 10px; padding: 16px 20px; margin-bottom: 20px; display: flex; gap: 24px; flex-wrap: wrap; }
.emp-summary .field { font-size: 13px; color: #555; }
.emp-summary .field strong { color: #1a1a2e; }

/* Dashboard quick-link cards */
.quick-links { display: flex; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.quick-link {
  flex: 1;
  min-width: 200px;
  text-decoration: none;
  background: #fff;
  border-radius: 10px;
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid #e2e8f0;
  transition: box-shadow 0.15s;
}
.quick-link:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); }
.quick-link .emoji { font-size: 24px; }
.quick-link .title { color: #1a1a2e; font-size: 15px; font-weight: 700; }
.quick-link .sub { color: #888; font-size: 11px; margin-top: 2px; }

/* Menu list drag handle */
.drag-handle { cursor: grab; color: #ccc; font-size: 16px; padding-right: 0; }
.menu-item-row { cursor: pointer; transition: opacity 0.2s; }
.cat-header td { background: #f0f9fc; font-weight: 700; color: var(--pier-color); padding: 10px 16px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }

.topbar-tel {
  margin-left: 16px;
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 20px;
  white-space: nowrap;
}
.topbar-tel:hover { background: rgba(255,255,255,0.1); }

/* ===================== Mobile responsive ===================== */
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; padding: 10px 14px; gap: 8px 12px; }
  .topbar h1 { font-size: 16px; flex: 1 1 100%; order: -1; }
  .topbar a { font-size: 12px; margin-left: 0; }
  .topbar-tel { font-size: 12px; margin-left: 0; padding: 3px 8px; }
  .wrap { padding: 14px; }
  .card-header { padding: 12px 14px; flex-wrap: wrap; gap: 6px; }
  .card-header h2 { font-size: 14px; }
  .info-bar { grid-template-columns: 1fr; padding: 12px 14px; gap: 6px; line-height: 1.5; }
  .scroll-table { max-height: none; overflow-x: auto; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .scroll-table table { min-width: 560px; }
  .scroll-table td:last-child { max-width: 220px; }
  th, td { padding: 8px 10px; font-size: 12px; }
  .form-grid { grid-template-columns: 1fr; padding: 14px; gap: 12px; }
  .form-grid.full { padding: 14px; }
  .form-actions { padding: 14px; flex-wrap: wrap; gap: 8px; }
  .form-actions .btn { flex: 1 1 auto; }
  .convo { padding: 14px; }
  .bubble-row { max-width: 92%; }
  .bubble { font-size: 13px; padding: 10px 14px; }
  .stats { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .num { font-size: 22px; }
  .quick-links { gap: 10px; }
  .quick-link { padding: 14px 16px; min-width: 0; flex: 1 1 100%; }
  .menu-tabs { gap: 6px; }
  .menu-tab { font-size: 12px; padding: 6px 12px; }
  .back-btn { padding: 6px 12px; font-size: 12px; }
  .login-card { padding: 28px 22px; }
  .emp-summary { padding: 12px 14px; gap: 12px; }
  .bubble-role { font-size: 9px; }
  .bubble-time { font-size: 9px; }
}
