/* ============================================================
   WWFL — Dashboard UI  |  app.css
   Industrial dark theme — job site control panel
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --black:  #0e0e0e;
  --panel:  #212121;
  --border: #333;
  --yellow: #f5c400;
  --white:  #f2f0eb;
  --muted:  #888;
  --red:    #d93f2e;
  --green:  #2ecc71;

  --sidebar-w: 220px;
  --nav-h:     56px;
  --radius:    4px;
  --gap:       16px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; }

body {
  background: var(--black);
  color: var(--white);
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--yellow); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.2;
}

/* ── Layout: auth pages ────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  display: block;
  width: 130px;
  margin-bottom: 24px;
  border-radius: var(--radius);
}

.auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--white);
}

/* ── Layout: app shell ─────────────────────────────────────── */
.app-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  z-index: 100;
}

.nav-logo {
  height: 38px;
  width: auto;
  display: block;
  flex-shrink: 0;
  border-radius: var(--radius);
}

.nav-biz {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.app-sidebar {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 90;
  padding: 12px 0;
  transition: transform .2s ease;
}

.sidebar-nav { list-style: none; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
  transition: color .15s, background .15s;
  text-decoration: none;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: var(--white);
  background: rgba(245,196,0,.07);
}

.sidebar-nav a.active {
  border-left: 3px solid var(--yellow);
  padding-left: 17px;
}

.sidebar-icon { width: 18px; text-align: center; font-size: .95rem; flex-shrink: 0; }

.app-main {
  margin-top: var(--nav-h);
  margin-left: var(--sidebar-w);
  padding: 24px;
  min-height: calc(100vh - var(--nav-h));
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
}

/* ── Page header ───────────────────────────────────────────── */
.page-header {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.page-title {
  font-size: 1.8rem;
  color: var(--white);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.page-sub {
  font-size: .85rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 10px;
}

.card-value {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1;
  color: var(--white);
}

.card-sub {
  font-size: .8rem;
  color: var(--muted);
  margin-top: 4px;
}

/* AI insight card */
.card-insight {
  border-left: 3px solid var(--yellow);
  padding: 16px 20px;
  background: var(--panel);
  border-radius: 0 var(--radius) var(--radius) 0;
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.insight-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--yellow);
  margin-bottom: 6px;
}

.insight-text {
  font-size: .9rem;
  color: var(--white);
  line-height: 1.55;
}

/* Metric grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--gap);
  margin-bottom: var(--gap);
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: 2px 7px;
  border-radius: 2px;
  vertical-align: middle;
}

.badge-yellow { background: var(--yellow); color: var(--black); }
.badge-green  { background: var(--green);  color: var(--black); }
.badge-red    { background: var(--red);    color: var(--white); }
.badge-muted  { background: var(--border); color: var(--muted); }
.badge-pro    { background: var(--yellow); color: var(--black); }
.badge-trial  { background: var(--border); color: var(--white); }
.badge-core   { background: #2d3a3a; color: var(--green); border: 1px solid var(--green); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  transition: opacity .15s, background .15s;
  text-decoration: none;
  line-height: 1;
}

.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:hover:not(:disabled) { opacity: .85; }

.btn-primary  { background: var(--yellow); color: var(--black); }
.btn-danger   { background: var(--red);    color: var(--white); }
.btn-ghost    { background: transparent;   color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { color: var(--white); border-color: var(--white); opacity: 1; }
.btn-sm { padding: 5px 12px; font-size: .8rem; }
.btn-full { width: 100%; }

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

.form-label {
  display: block;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--black);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--white);
  padding: 9px 12px;
  font-size: .9rem;
  font-family: system-ui, sans-serif;
  transition: border-color .15s;
  appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--yellow);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--muted); }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-select option { background: var(--panel); }

.form-textarea { resize: vertical; min-height: 90px; }

.form-hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Alert / notice ────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: .88rem;
  margin-bottom: 16px;
}

.alert-error   { background: rgba(217,63,46,.15); border: 1px solid var(--red);   color: #f28a80; }
.alert-success { background: rgba(46,204,113,.12); border: 1px solid var(--green); color: var(--green); }
.alert-info    { background: rgba(245,196,0,.1);   border: 1px solid var(--yellow);color: var(--yellow); }

/* ── Tables ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

thead th {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid rgba(51,51,51,.6);
  transition: background .1s;
}

tbody tr:hover { background: rgba(255,255,255,.03); }
tbody tr:last-child { border-bottom: none; }

tbody td {
  padding: 11px 12px;
  color: var(--white);
  vertical-align: middle;
}

.td-muted { color: var(--muted); font-size: .82rem; }

/* ── Filter tabs ───────────────────────────────────────────── */
.filter-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-tab {
  padding: 5px 14px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  cursor: pointer;
  transition: all .15s;
}

.filter-tab:hover { color: var(--white); border-color: var(--muted); }
.filter-tab.active { background: var(--yellow); color: var(--black); border-color: var(--yellow); }

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  justify-content: flex-end;
}

.pagination-info { font-size: .82rem; color: var(--muted); margin-right: auto; }

/* ── Status dots ───────────────────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.dot-sent     { background: var(--yellow); }
.dot-clicked  { background: var(--green); }
.dot-reviewed { background: #5bc5e0; }
.dot-pending  { background: var(--muted); }
.dot-failed   { background: var(--red); }

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Section label ─────────────────────────────────────────── */
.section-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ── Review response card ──────────────────────────────────── */
.review-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
}

.review-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.review-meta { flex: 1; min-width: 0; }
.reviewer-name { font-weight: 600; font-size: .95rem; }
.review-date { font-size: .78rem; color: var(--muted); }

.stars { color: var(--yellow); letter-spacing: 2px; font-size: .9rem; }

.review-text { font-size: .88rem; color: var(--white); line-height: 1.55; margin-bottom: 12px; }

.draft-wrap {
  background: var(--black);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 10px;
}

.draft-label {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--yellow);
  margin-bottom: 6px;
}

.draft-text {
  font-size: .88rem;
  line-height: 1.6;
  color: var(--white);
  width: 100%;
  background: transparent;
  border: none;
  resize: vertical;
  min-height: 80px;
  font-family: system-ui, sans-serif;
}

.draft-text:focus { outline: none; }

.draft-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ── Settings sections ─────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--gap);
}

.plan-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  position: relative;
}

.plan-card.featured {
  border-color: var(--yellow);
  box-shadow: 0 0 0 1px var(--yellow);
}

.plan-name {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 4px;
}

.plan-price {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--yellow);
  margin: 12px 0 4px;
}

.plan-period { font-size: .8rem; color: var(--muted); margin-bottom: 16px; }

.plan-features {
  list-style: none;
  font-size: .85rem;
  color: var(--muted);
  text-align: left;
  margin-bottom: 20px;
}

.plan-features li {
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-features li::before { content: '—'; color: var(--border); }
.plan-features li.yes::before { content: '✓'; color: var(--green); }

/* ── Place search results ──────────────────────────────────── */
.place-result {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.place-result:hover, .place-result.selected {
  border-color: var(--yellow);
  background: rgba(245,196,0,.06);
}

.place-result-name { font-weight: 600; font-size: .9rem; }
.place-result-addr { font-size: .8rem; color: var(--muted); }
.place-result-rating { font-size: .8rem; color: var(--yellow); }

/* ── Loading spinner ───────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  vertical-align: middle;
}

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

.loading-row td {
  text-align: center;
  padding: 32px;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty-state h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
  color: var(--white);
}

/* ── Success card ──────────────────────────────────────────── */
.success-card {
  text-align: center;
  padding: 40px 24px;
}

.success-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}

/* ── Intelligence digest ───────────────────────────────────── */
.digest-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  white-space: pre-line;
  font-size: .9rem;
  line-height: 1.65;
}

/* ── Utility ───────────────────────────────────────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.text-muted { color: var(--muted); }
.text-yellow { color: var(--yellow); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-sm { font-size: .82rem; }
.text-center { text-align: center; }
.d-none { display: none !important; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar-toggle { display: block; }

  .app-sidebar {
    width: 240px;
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,.6);
  }

  .app-main { margin-left: 0; padding: 16px; }

  .settings-grid { grid-template-columns: 1fr; }

  .form-row { grid-template-columns: 1fr; }

  .metrics-grid { grid-template-columns: repeat(2, 1fr); }

  .plan-grid { grid-template-columns: 1fr; }

  .auth-card { padding: 28px 20px; }
}

@media (max-width: 420px) {
  .metrics-grid { grid-template-columns: 1fr 1fr; }
}
