/* AI Admissions Counselor — Swiss Hospitality Edition */

:root {
  --bg: #f8f9fb;
  --card: #ffffff;
  --border: #e2e6ed;
  --text: #1a1d23;
  --text-secondary: #6b7280;
  --accent: #1e3a5f;
  --accent-light: #2d5a8e;
  --hot: #dc2626;
  --warm: #f59e0b;
  --cool: #3b82f6;
  --cold: #9ca3af;
  --enrolled: #16a34a;
  --lost: #9ca3af;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Nav */
.nav {
  background: var(--accent);
  color: white;
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 32px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.nav-brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.3px;
}
.nav-links { display: flex; gap: 4px; }
.nav-links a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.15s;
}
.nav-links a:hover, .nav-links a.active {
  color: white;
  background: rgba(255,255,255,0.12);
}
.nav-school-select {
  margin-left: auto;
}
.nav-school-select select {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 13px;
  cursor: pointer;
}
.nav-school-select select option { color: var(--text); }

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

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* Summary Cards */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.summary-card .value {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}
.summary-card .label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Score distribution bar */
.score-bar {
  display: flex;
  height: 32px;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 8px;
}
.score-bar div {
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 600;
  transition: width 0.3s;
}
.score-bar .hot { background: var(--hot); }
.score-bar .warm { background: var(--warm); }
.score-bar .cool { background: var(--cool); }
.score-bar .cold { background: var(--cold); }

.score-legend {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}
.score-legend span { display: flex; align-items: center; gap: 4px; }
.score-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Two-column */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 768px) { .two-col { grid-template-columns: 1fr; } }

/* Table */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th {
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th:hover { color: var(--text); }
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
tr:hover { background: #f3f4f6; }

/* Score badge */
.score-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}
.score-badge.hot { background: var(--hot); }
.score-badge.warm { background: var(--warm); }
.score-badge.cool { background: var(--cool); }
.score-badge.cold { background: var(--cold); }

/* Status badge */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.status-badge.enrolled { background: #dcfce7; color: var(--enrolled); }
.status-badge.new { background: #f0f4ff; color: var(--cool); }
.status-badge.engaged, .status-badge.qualified { background: #fef3c7; color: #b45309; }
.status-badge.application_sent, .status-badge.documents_submitted,
.status-badge.offer_made, .status-badge.visa_pending { background: #dbeafe; color: #1e40af; }
.status-badge.lost { background: #f3f4f6; color: var(--lost); }

/* Funnel */
.funnel { display: flex; flex-direction: column; gap: 4px; }
.funnel-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.funnel-label {
  width: 100px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: right;
}
.funnel-bar-wrap {
  flex: 1;
  background: #f3f4f6;
  border-radius: 4px;
  height: 24px;
  overflow: hidden;
}
.funnel-bar {
  height: 100%;
  background: var(--accent-light);
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding-left: 8px;
  font-size: 12px;
  color: white;
  font-weight: 600;
  min-width: 28px;
  transition: width 0.5s;
}
.funnel-count {
  width: 40px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* Funnel table variant (used in leads page) */
.funnel-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.funnel-table td {
  padding: 6px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.funnel-table td:first-child {
  color: var(--text-secondary);
  width: 120px;
}
.funnel-table td:last-child {
  font-weight: 600;
  text-align: right;
}

/* Chat */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 80px);
  max-width: 800px;
  margin: 0 auto;
}
.chat-header {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.chat-header h2 { font-size: 18px; }
.chat-header .lead-info { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-msg {
  max-width: 75%;
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: fadeIn 0.2s;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-msg.system {
  align-self: center;
  background: #f3f4f6;
  color: var(--text-secondary);
  font-size: 12px;
  border-radius: 8px;
  padding: 4px 12px;
}

.chat-input-wrap {
  display: flex;
  gap: 8px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}
.chat-input-wrap textarea {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
  min-height: 44px;
  max-height: 120px;
}
.chat-input-wrap textarea:focus { border-color: var(--accent); }
.chat-send {
  padding: 10px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.chat-send:hover { background: var(--accent-light); }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* New lead form */
.lead-form-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.lead-form {
  background: var(--card);
  border-radius: 12px;
  padding: 32px;
  width: 440px;
  max-width: 90vw;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.lead-form h3 { margin-bottom: 16px; font-size: 18px; }
.lead-form label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  margin-top: 12px;
}
.lead-form input, .lead-form select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
}
.lead-form input:focus, .lead-form select:focus { border-color: var(--accent); }
.lead-form .btn-row {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  justify-content: flex-end;
}
.btn {
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-light); }
.btn-secondary {
  background: #f3f4f6;
  color: var(--text);
}
.btn-secondary:hover { background: var(--border); }

/* Schools list */
.school-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.school-card { position: relative; }
.school-card h3 { font-size: 16px; color: var(--text); text-transform: none; letter-spacing: 0; }
.school-card .short { color: var(--text-secondary); font-size: 13px; margin-bottom: 8px; }
.school-card .programs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.tag {
  display: inline-block;
  padding: 2px 8px;
  background: #f0f4ff;
  color: var(--accent-light);
  border-radius: 10px;
  font-size: 12px;
}

/* Pagination */
.pagination {
  display: flex; gap: 8px; justify-content: center; margin-top: 16px;
}
.pagination button {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--card); cursor: pointer; font-size: 13px;
}
.pagination button.active { background: var(--accent); color: white; border-color: var(--accent); }
.pagination button:hover:not(.active) { background: #f3f4f6; }

/* Utility */
.muted { color: var(--text-secondary); font-size: 13px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { display: flex; gap: 12px; align-items: center; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* People list */
.people-list { max-height: calc(100vh - 200px); overflow-y: auto; }
.people-list-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.1s;
}
.people-list-item:hover { background: #f3f4f6; }
.people-list-item .name { font-weight: 500; }
.people-list-item .detail { font-size: 12px; color: var(--text-secondary); }
