/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --blue: #1a56db;
  --blue-light: #e8f0fe;
  --blue-dark: #1e3a5f;
  --green: #16a34a;
  --orange: #ea580c;
  --red: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
  padding-bottom: 60px;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('../images/bg.png') center/cover no-repeat;
  opacity: 0.5;
  z-index: -1;
  pointer-events: none;
}

/* ===== Header ===== */
.header {
  background: linear-gradient(135deg, var(--blue-dark), var(--blue));
  color: white;
  padding: 16px 20px;
  text-align: center;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.brand-icon { font-size: 24px; }
.brand h1 { font-size: 18px; font-weight: 600; letter-spacing: 0.5px; }

/* ===== Tabs ===== */
.tabs {
  display: flex;
  background: white;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--gray-500);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.tab.active {
  color: var(--blue);
  font-weight: 600;
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: var(--blue);
  border-radius: 3px 3px 0 0;
}

.tab-icon { font-size: 18px; }

.lock-badge {
  font-size: 10px;
  position: absolute;
  top: 6px;
  right: 16px;
}

/* ===== Content ===== */
.content { padding: 16px; max-width: 600px; margin: 0 auto; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== Cards ===== */
.card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card h2 { font-size: 20px; color: var(--gray-900); margin-bottom: 4px; }
.card h3 { font-size: 17px; color: var(--gray-900); margin-bottom: 12px; }
.card h4 { font-size: 15px; color: var(--gray-700); margin-bottom: 8px; }
.subtitle { font-size: 14px; color: var(--gray-500); margin-bottom: 16px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}

select, input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 14px;
  color: var(--gray-900);
  background: white;
  appearance: auto;
  transition: border-color 0.2s;
}

select:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

/* Checkboxes */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--gray-700);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
  flex-shrink: 0;
}

/* ===== Score Result ===== */
.result-card { background: linear-gradient(135deg, #f0f7ff, #e8f0fe); }

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.score-item {
  text-align: center;
  padding: 12px 8px;
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.score-visa {
  font-size: 12px;
  font-weight: 700;
  color: white;
  background: var(--blue);
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  margin-bottom: 6px;
}

.score-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--blue-dark);
  line-height: 1.2;
}

.score-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

.score-breakdown {
  font-size: 13px;
  color: var(--gray-700);
  line-height: 1.8;
  padding: 12px;
  background: white;
  border-radius: 8px;
}

.score-breakdown .item {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.score-breakdown .item .pts { font-weight: 600; color: var(--blue); }
.score-breakdown .total {
  display: flex;
  justify-content: space-between;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 2px solid var(--blue);
  font-weight: 700;
  font-size: 15px;
}

.disclaimer { font-size: 12px; color: var(--gray-500); margin-top: 12px; }

/* ===== Search Box ===== */
.search-box {
  display: flex;
  gap: 8px;
}

.search-box input { flex: 1; }

.search-box button, .btn-primary {
  padding: 10px 20px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.search-box button:active, .btn-primary:active { background: var(--blue-dark); }

.btn-primary { width: 100%; margin-top: 8px; padding: 12px; font-size: 16px; }

/* ===== Occupation Results ===== */
.occ-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}

.occ-item:last-child { border-bottom: none; }

.occ-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.occ-name { font-weight: 600; font-size: 15px; }
.occ-name-cn { font-size: 13px; color: var(--gray-500); margin-top: 2px; }
.occ-code { font-size: 12px; color: var(--gray-500); font-family: monospace; white-space: nowrap; }

.occ-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.occ-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 500;
}

.occ-tag.mltssl { background: #dcfce7; color: #166534; }
.occ-tag.stsol { background: #fef3c7; color: #92400e; }
.occ-tag.rol { background: #e0e7ff; color: #3730a3; }
.occ-tag.visa { background: var(--gray-100); color: var(--gray-700); }

.occ-assessor { font-size: 12px; color: var(--gray-500); margin-top: 6px; }

.empty-text { text-align: center; color: var(--gray-500); padding: 20px 0; }

/* ===== Lock Overlay ===== */
.lock-overlay {
  text-align: center;
  padding: 40px 20px;
}

.lock-content {
  background: white;
  border-radius: var(--radius);
  padding: 32px 20px;
  box-shadow: var(--shadow-md);
}

.lock-icon { font-size: 48px; margin-bottom: 12px; }
.lock-content h3 { font-size: 22px; margin-bottom: 12px; color: var(--blue-dark); }
.lock-content > p { font-size: 14px; color: var(--gray-500); margin-bottom: 16px; }

.lock-features {
  text-align: left;
  margin: 16px auto;
  max-width: 280px;
}

.lock-feature-item {
  font-size: 14px;
  color: var(--gray-700);
  padding: 6px 0;
  line-height: 1.5;
}

.lock-cta {
  font-size: 15px;
  color: var(--blue);
  margin: 16px 0 12px;
  line-height: 1.6;
}

.qr-container { margin: 16px auto; }
.qr-image { width: 180px; height: 180px; border-radius: 8px; border: 1px solid var(--gray-200); }

.verify-input {
  display: flex;
  gap: 8px;
  max-width: 280px;
  margin: 20px auto 0;
}

.verify-input input {
  flex: 1;
  text-align: center;
  font-size: 16px;
  letter-spacing: 2px;
}

.verify-input button {
  padding: 10px 20px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.wechat-id { font-size: 14px; color: var(--gray-700); font-weight: 500; margin-top: 8px; }
.wechat-id-modal { font-size: 14px; color: var(--gray-700); margin-top: 12px; font-weight: 500; }

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

/* ===== Autocomplete ===== */
.autocomplete-wrapper {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--gray-300);
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  box-shadow: var(--shadow-md);
}

.autocomplete-item {
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
}

.autocomplete-item:last-child { border-bottom: none; }

.autocomplete-item:hover, .autocomplete-item.active {
  background: var(--blue-light);
}

.autocomplete-item .occ-title { font-weight: 500; }
.autocomplete-item .occ-sub { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ===== Trend Table ===== */
.trend-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0;
}

.trend-table th {
  background: var(--blue-light);
  color: var(--blue-dark);
  font-weight: 600;
  padding: 10px 8px;
  text-align: center;
  font-size: 12px;
}

.trend-table td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid var(--gray-100);
}

.trend-table tr:last-child td { border-bottom: none; }

.trend-summary {
  font-size: 13px;
  color: var(--gray-700);
  margin-top: 12px;
  text-align: center;
  line-height: 1.6;
}

/* ===== Charts ===== */
.chart-section { margin: 20px 0; }
.chart-section canvas { width: 100% !important; min-height: 200px; }

/* ===== Probability Card ===== */
.probability-card {
  text-align: center;
  padding: 24px;
  border-radius: var(--radius);
  margin: 16px 0;
}

.probability-card.high { background: linear-gradient(135deg, #dcfce7, #bbf7d0); }
.probability-card.medium { background: linear-gradient(135deg, #fef3c7, #fde68a); }
.probability-card.low { background: linear-gradient(135deg, #fee2e2, #fecaca); }

.prob-header { font-size: 14px; color: var(--gray-700); margin-bottom: 8px; }
.prob-value { font-size: 48px; font-weight: 800; line-height: 1.2; }
.probability-card.high .prob-value { color: #166534; }
.probability-card.medium .prob-value { color: #92400e; }
.probability-card.low .prob-value { color: #991b1b; }
.prob-detail { font-size: 13px; color: var(--gray-700); margin-top: 8px; line-height: 1.6; }

.est-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-700);
  background: rgba(0,0,0,0.07);
  border-radius: 3px;
  vertical-align: 1px;
}

.est-note { display: block; margin-top: 6px; font-size: 12px; opacity: 0.75; }

/* ===== Bottom WeChat Bar ===== */
.wechat-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--gray-200);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 200;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.wechat-bar span { font-size: 13px; color: var(--gray-700); }

.wechat-bar button {
  padding: 8px 16px;
  background: #07c160;
  color: white;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: white;
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  max-width: 340px;
  width: 100%;
  position: relative;
}

.modal h3 { margin-bottom: 8px; }
.modal p { font-size: 14px; color: var(--gray-500); margin-bottom: 16px; }

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--gray-500);
  cursor: pointer;
}

.qr-image-large { width: 220px; height: 220px; border-radius: 8px; border: 1px solid var(--gray-200); }

/* ===== Update Info ===== */
.update-info {
  text-align: center;
  font-size: 12px;
  color: var(--gray-500);
  padding: 16px 0;
}

/* ===== Responsive ===== */
@media (min-width: 768px) {
  .content { padding: 24px; }
  .brand h1 { font-size: 22px; }
  .tabs { max-width: 600px; margin: 0 auto; }
}

/* --- Rounds where an occupation drew no invitations --- */
.no-invite {
  display: inline-block;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  background: rgba(0, 0, 0, 0.06);
  border-radius: 3px;
}

.trend-table tr.row-no-invite td { opacity: 0.72; }

.trend-note {
  font-size: 12px;
  color: var(--gray-500);
}

.shutout-note {
  margin: 0 0 10px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #b91c1c;
  background: rgba(220, 38, 38, 0.08);
  border-left: 3px solid #dc2626;
  border-radius: 3px;
}
