:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --safe: #10b981;
  --mod: #f59e0b;
  --dream: #3b82f6;
  --pro: #f59e0b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 75px;
}
h1, h2, h3, .brand-name { font-family: 'Plus Jakarta Sans', sans-serif; }
.hidden { display: none !important; }

/* ==================== AUTH GATE ==================== */
.auth-gate {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: #fff;
  max-width: 460px;
  width: 100%;
  border-radius: 20px;
  padding: 36px 28px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}
.brand-pill {
  display: inline-block;
  background: #eef2ff;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 99px;
  margin-bottom: 16px;
}
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; }
.logo-icon { font-size: 32px; }
.auth-logo h1 { font-size: 28px; font-weight: 800; color: #0f172a; }
.auth-logo h1 span { color: var(--primary); }
.auth-subtitle { color: var(--muted); font-size: 14px; line-height: 1.5; margin-bottom: 22px; }
.auth-features {
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 24px;
}
.af-item { font-size: 13px; color: #334155; margin-bottom: 8px; font-weight: 500; }
.af-item:last-child { margin-bottom: 0; }
.google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #fff;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.2s;
}
.google-btn:hover { border-color: var(--primary); background: #f8fafc; transform: translateY(-1px); }
.google-btn img { width: 20px; height: 20px; }
.auth-error { margin-top: 12px; color: #dc2626; font-size: 13px; background: #fef2f2; padding: 8px; border-radius: 8px; }
.auth-note { margin-top: 16px; font-size: 12px; color: var(--muted); }

/* ==================== TOPBAR ==================== */
.topbar {
  background: #1e1b4b;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-name { font-size: 20px; font-weight: 700; }
.brand-name b { color: #818cf8; }
.plan-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}
.plan-badge.free { background: rgba(255,255,255,0.15); color: #cbd5e1; }
.plan-badge.pro { background: linear-gradient(90deg, #f59e0b, #fbbf24); color: #0f172a; }

.desktop-nav { display: flex; gap: 6px; }
.nav-tab {
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.nav-tab.active, .nav-tab:hover { background: rgba(255,255,255,0.12); color: #fff; }
.count-pill { background: var(--primary); color: #fff; padding: 1px 6px; border-radius: 99px; font-size: 11px; }

.user-actions { display: flex; align-items: center; gap: 10px; }
.upgrade-cta {
  background: linear-gradient(90deg, #f59e0b, #eab308);
  color: #0f172a;
  border: none;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.user-profile { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.1); padding: 4px 10px; border-radius: 99px; }
.user-profile img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.user-profile span { font-size: 12px; font-weight: 500; }
.logout-icon { background: none; border: none; cursor: pointer; font-size: 14px; }

/* ==================== MAIN LAYOUT ==================== */
.main-container { max-width: 1280px; margin: 18px auto; padding: 0 16px; }
.tab-view { display: none; }
.tab-view.active { display: block; }

.loading-bar {
  background: #eef2ff;
  color: var(--primary-dark);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--primary);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hero-card, .filter-panel {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 16px;
}
.hero-card h2 { font-size: 20px; margin-bottom: 6px; }
.hero-card p { font-size: 13px; color: var(--muted); }

.predictor-grid, .filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.form-group input, .form-group select, .search-input, .sort-select {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
  outline: none;
}
.form-group input:focus, .form-group select:focus, .search-input:focus { border-color: var(--primary); }

.predictor-actions { margin-top: 16px; display: flex; justify-content: flex-end; }
.primary-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.primary-btn:hover { background: var(--primary-dark); }
.secondary-btn {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.danger-btn {
  background: #fee2e2;
  color: #b91c1c;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* Sector & Chance Pills */
.sector-bar, .pred-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.sector-pill, .chance-pill {
  background: #fff;
  border: 1px solid #cbd5e1;
  padding: 8px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.sector-pill.active, .chance-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.search-sort-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.search-input { flex: 1; min-width: 240px; }

.results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.pagination { display: flex; gap: 6px; }
.page-btn {
  padding: 6px 12px;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ==================== DATA CARDS / TABLE ==================== */
.result-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.rc-left { flex: 1; min-width: 260px; }
.rc-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
}
.badge.yr { background: #eef2ff; color: var(--primary); }
.badge.cat { background: #fef3c7; color: #92400e; }
.badge.safe { background: #d1fae5; color: #065f46; }
.badge.moderate { background: #fef3c7; color: #92400e; }
.badge.dream { background: #dbeafe; color: #1e40af; }

.rc-title { font-size: 15px; font-weight: 700; color: #0f172a; margin-bottom: 3px; }
.rc-sub { font-size: 12px; color: var(--muted); }

.rc-right { display: flex; align-items: center; gap: 16px; }
.rank-box { text-align: right; }
.rank-box small { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; font-weight: 700; }
.rank-box strong { font-size: 16px; color: #0f172a; }
.star-btn {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.star-btn.saved { background: #fef3c7; border-color: #f59e0b; color: #92400e; }

/* PRO Lock Banner */
.pro-lock-banner {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  color: #fff;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  margin: 16px 0;
}
.pro-lock-banner h3 { font-size: 18px; margin-bottom: 6px; }
.pro-lock-banner p { font-size: 13px; color: #cbd5e1; margin-bottom: 14px; }

/* Trends Table */
.trend-table-wrap { overflow-x: auto; background: #fff; border-radius: 14px; border: 1px solid var(--border); }
.trend-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.trend-table th, .trend-table td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; }
.trend-table th { background: #f8fafc; font-size: 11px; text-transform: uppercase; color: var(--muted); }

/* ==================== PRO MODAL ==================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.7);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 100;
}
.modal-card {
  background: #fff;
  max-width: 680px;
  width: 100%;
  border-radius: 20px;
  padding: 28px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: #f1f5f9; border: none; width: 32px; height: 32px;
  border-radius: 50%; cursor: pointer; font-weight: 700;
}
.pro-badge-top { display: inline-block; background: #fef3c7; color: #b45309; font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 99px; margin-bottom: 8px; }
.modal-desc { font-size: 13px; color: var(--muted); margin: 6px 0 18px; }
.plan-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.plan-col { border: 1px solid var(--border); border-radius: 14px; padding: 18px; position: relative; }
.pro-col { border: 2px solid #f59e0b; background: #fffbeb; }
.popular-tag { position: absolute; top: -10px; right: 14px; background: #f59e0b; color: #0f172a; font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 6px; }
.price-tag { font-size: 26px; font-weight: 800; margin: 8px 0 12px; }
.price-tag span { font-size: 13px; font-weight: 500; color: var(--muted); }
.plan-col ul { list-style: none; font-size: 13px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.pay-btn {
  width: 100%; background: #0f172a; color: #fff; border: none;
  padding: 12px; border-radius: 10px; font-weight: 700; font-size: 14px; cursor: pointer;
}
.secure-note { text-align: center; font-size: 12px; color: var(--muted); margin-top: 14px; }

.shortlist-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.shortlist-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* Mobile Nav */
.mobile-bottom-nav { display: none; }

@media (max-width: 768px) {
  .desktop-nav, .hide-mobile { display: none; }
  .plan-compare { grid-template-columns: 1fr; }
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    z-index: 60;
  }
  .m-nav-btn {
    flex: 1; background: none; border: none; padding: 8px 4px;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    color: var(--muted); font-size: 11px; font-weight: 600;
  }
  .m-nav-btn.active { color: var(--primary); }
}
