/* ============================================================
   lawdbl design-system layer
   Load this AFTER css/styles.css so it overrides the Tailwind build.
   Restyles the app into the lawdbl brand: cream paper, one amber,
   Gotham + Georgia, left sidebar + conversation layout.
   No build step, no JS changes — every id/class app.js touches
   is preserved.
   ============================================================ */

/* ---------- Webfonts ---------- */
@font-face { font-family:"Gotham"; src:url("../fonts/Gotham-Light.otf")  format("opentype"); font-weight:300; font-display:swap; }
@font-face { font-family:"Gotham"; src:url("../fonts/Gotham-Book.otf")   format("opentype"); font-weight:400; font-display:swap; }
@font-face { font-family:"Gotham"; src:url("../fonts/Gotham-Medium.otf") format("opentype"); font-weight:500; font-display:swap; }
@font-face { font-family:"Gotham"; src:url("../fonts/Gotham-Bold.otf")   format("opentype"); font-weight:700; font-display:swap; }
@font-face { font-family:"Georgia Brand"; src:url("../fonts/Georgia.ttf")            format("truetype"); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:"Georgia Brand"; src:url("../fonts/Georgia-Bold.ttf")       format("truetype"); font-weight:700; font-style:normal; font-display:swap; }
@font-face { font-family:"Georgia Brand"; src:url("../fonts/Georgia-Italic.ttf")     format("truetype"); font-weight:400; font-style:italic; font-display:swap; }
@font-face { font-family:"Georgia Brand"; src:url("../fonts/Georgia-BoldItalic.ttf") format("truetype"); font-weight:700; font-style:italic; font-display:swap; }

/* ---------- Design tokens ---------- */
:root {
  --lb-amber:       #faa334;
  --lb-amber-hover: #e0851d;
  --lb-amber-soft:  #fdecd3;
  --lb-amber-ink:   #b76d12;

  --lb-paper:   #fbf7f0;  /* main canvas   */
  --lb-sand:    #f5eee2;  /* sidebar / wells */
  --lb-sand-2:  #ece2d3;  /* hover fill    */
  --lb-line:    #e0d4c1;  /* hairlines     */

  --lb-ink:     #1c1917;  /* headings      */
  --lb-body:    #2b2622;  /* body copy     */
  --lb-muted:   #6b625a;  /* secondary     */
  --lb-faint:   #8f857b;  /* tertiary      */

  --font-ui:   "Gotham","Montserrat","Helvetica Neue",Arial,sans-serif;
  --font-body: "Georgia Brand",Georgia,"Times New Roman",serif;

  --lb-radius: 12px;
  --lb-shadow: 0 1px 2px rgba(28,25,23,.06), 0 8px 24px rgba(28,25,23,.06);
  --lb-sidebar-w: 264px;
}

/* ---------- Global reset of the old shell ---------- */
* { font-family: var(--font-ui); }

body {
  background: var(--lb-paper) !important;
  color: var(--lb-body);
  display: block !important;
  overflow-x: hidden;
}

/* Retire the fixed orange header/footer and decorative lawyer image */
body > header,
body > footer,
.lawyer-image { display: none !important; }

/* The app becomes a two-column shell */
body > main {
  position: static !important;
  z-index: auto !important;
  display: block !important;
  padding: 0 !important;
  margin: 0 !important;
  min-height: 100vh;
}

/* ---------- App shell ---------- */
.lb-shell { display: flex; min-height: 100vh; }

/* ----- Sidebar ----- */
.lb-sidebar {
  width: var(--lb-sidebar-w);
  flex-shrink: 0;
  background: var(--lb-sand);
  border-right: 1px solid var(--lb-line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.lb-brand {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 18px 16px 14px;
}
.lb-brand-lockup { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.lb-brand-lockup img { height: 28px; width: auto; display: block; }
.lb-beta {
  font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #000; background: var(--lb-amber); padding: 2px 6px; border-radius: 5px;
}
.lb-newchat { padding: 6px 14px 12px; }
.lb-nav { padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }
.lb-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; font-size: 14px; color: var(--lb-body);
  text-decoration: none; transition: background .12s;
}
.lb-nav a:hover { background: var(--lb-sand-2); color: var(--lb-ink); text-decoration: none; }
.lb-nav a.is-active { background: var(--lb-amber-soft); font-weight: 600; color: var(--lb-ink); }
.lb-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.lb-nav-section {
  padding: 18px 20px 8px; font-size: 11px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase; color: var(--lb-faint);
}
.lb-sidebar-footer { margin-top: auto; border-top: 1px solid var(--lb-line); }
.lb-sidebar-links {
  display: flex; gap: 16px; padding: 12px 18px 4px;
  font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.lb-sidebar-links a { color: var(--lb-faint); text-decoration: none; }
.lb-sidebar-links a:hover,
.lb-sidebar-links a.is-active { color: var(--lb-amber-ink); }
.lb-copyright { padding: 4px 18px 14px; font-size: 11px; color: var(--lb-faint); }

/* Auth block lives in the sidebar footer now */
.lb-sidebar #user-info { display: none; align-items: center; gap: 8px; padding: 10px 18px; font-size: 13px; color: var(--lb-body); }
.lb-sidebar #user-info:not(.hidden) { display: flex; }
.lb-sidebar #user-email { font-weight: 600; max-width: 150px; }
.lb-sidebar #logout-btn {
  background: transparent; border: 1px solid var(--lb-line); color: var(--lb-muted);
  padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
}
.lb-sidebar #logout-btn:hover { background: var(--lb-sand-2); }
.lb-sidebar #google-login {
  display: none; align-items: center; justify-content: center; gap: 8px;
  margin: 8px 14px 14px; padding: 10px 14px; width: calc(100% - 28px);
  background: #fff; border: 1px solid var(--lb-line); border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--lb-body); box-shadow: var(--lb-shadow);
}
.lb-sidebar #google-login:not(.hidden) { display: flex; }
.lb-sidebar #google-login img { width: 18px; height: 18px; }

/* ----- Main column ----- */
.lb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lb-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; border-bottom: 1px solid var(--lb-line);
}
.lb-topbar-title {
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--lb-muted);
}
.lb-loc {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px;
  border: 1px solid var(--lb-line); border-radius: 8px; background: #fff;
  font-size: 13px; color: var(--lb-body);
}
.lb-loc svg { width: 15px; height: 15px; }

/* The scrolling content region */
.lb-content { flex: 1; overflow-y: auto; }
.lb-col { max-width: 760px; margin: 0 auto; padding: 28px 28px 40px; }

/* ---------- Buttons ---------- */
.lb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
  font-family: var(--font-ui); font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.lb-btn-primary { background: var(--lb-amber); color: #1c1917; }
.lb-btn-primary:hover { background: var(--lb-amber-hover); }
.lb-btn-secondary { background: #fff; color: var(--lb-ink); border-color: var(--lb-line); }
.lb-btn-secondary:hover { background: var(--lb-sand); }
.lb-btn-block { width: 100%; }

/* ---------- Empty / hero state ---------- */
.lb-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 28px; }
.lb-hero-mark { width: 56px; height: 56px; margin-bottom: 18px; }
.lb-hero h1 { font-family: var(--font-ui); font-size: 40px; font-weight: 700; letter-spacing: -.02em; color: var(--lb-ink); margin: 0 0 12px; }
.lb-hero p  { font-family: var(--font-body); font-size: 18px; line-height: 1.6; color: var(--lb-muted); margin: 0 0 28px; max-width: 560px; }

/* ---------- Suggestion chips ---------- */
.lb-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.lb-chip {
  display: inline-flex; align-items: center; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--lb-line); background: #fff; color: var(--lb-body);
  font-size: 13px; cursor: pointer; transition: background .12s, border-color .12s;
}
.lb-chip:hover { background: var(--lb-amber-soft); border-color: var(--lb-amber); }

/* ============================================================
   Overriding the existing components (styles.css) in place
   ============================================================ */

/* ----- Composer (textarea + submit) ----- */
#chat-form-container { width: 100%; padding: 16px 28px !important; border-top: 1px solid var(--lb-line); background: var(--lb-paper); }
#chat-form { max-width: 760px; margin: 0 auto; gap: 10px; }
#user-input {
  min-height: 56px !important; border: 1px solid var(--lb-line) !important; border-radius: var(--lb-radius) !important;
  background: #fff !important; color: var(--lb-ink) !important; padding: 14px 16px !important;
  font-family: var(--font-ui) !important; font-size: 16px !important; line-height: 1.5 !important;
}
#user-input:focus { box-shadow: 0 0 0 3px rgba(250,163,52,.22) !important; border-color: var(--lb-amber) !important; }
#send-button {
  align-self: flex-end; width: auto !important; background: var(--lb-amber) !important; color: #1c1917 !important;
  border-radius: 10px !important; padding: 10px 22px !important; font-family: var(--font-ui) !important;
  font-size: 15px !important; font-weight: 600 !important; box-shadow: none !important;
}
#send-button:hover { background: var(--lb-amber-hover) !important; }

/* ----- "Search for a particular lawyer" well ----- */
#chat-form-container + .mt-4,
.lb-col .lb-namesearch {
  margin: 18px auto 0 !important; max-width: 760px; background: var(--lb-sand) !important;
  border: 1px solid var(--lb-line) !important; border-radius: var(--lb-radius) !important; padding: 16px 18px !important;
}
#lawyer-search-input {
  border: 1px solid var(--lb-line) !important; border-radius: 10px !important; background: #fff !important;
  color: var(--lb-ink) !important; font-family: var(--font-ui) !important; font-size: 15px !important; padding: 10px 14px !important;
}
#lawyer-search-input:focus { box-shadow: 0 0 0 3px rgba(250,163,52,.22) !important; border-color: var(--lb-amber) !important; }
#lawyer-search-button {
  background: var(--lb-amber) !important; color: #1c1917 !important; border-radius: 10px !important;
  font-family: var(--font-ui) !important; font-weight: 600 !important; padding: 10px 18px !important;
}
#lawyer-search-button:hover { background: var(--lb-amber-hover) !important; }

/* ----- Chat message bubbles ----- */
.chat-message { max-width: 760px !important; font-family: var(--font-ui) !important; }
.user-message {
  background: var(--lb-amber-soft) !important; color: var(--lb-ink) !important;
  border-radius: 14px 14px 0 14px !important; padding: 12px 16px !important;
}
.assistant-message {
  background: var(--lb-sand) !important; color: var(--lb-body) !important;
  border: 1px solid var(--lb-line); border-radius: 14px 14px 14px 0 !important; padding: 12px 16px !important;
  font-family: var(--font-body) !important; font-size: 16px !important; line-height: 1.55 !important;
}
.error-message { background: #fbece0 !important; color: #9a3b12 !important; border: 1px solid #f1c9a8; padding: 12px 16px !important; }

/* ----- Lawyer cards ----- */
#lawyer-stack { max-width: 760px !important; }
.lawyer-card {
  background: #fff !important; border: 1px solid var(--lb-line); border-radius: var(--lb-radius) !important;
  box-shadow: var(--lb-shadow) !important; padding: 20px !important; margin-bottom: 16px !important;
}
.lawyer-card-name { font-family: var(--font-ui) !important; font-size: 18px !important; font-weight: 700 !important; color: var(--lb-ink) !important; }
.lawyer-card-role { font-family: var(--font-ui) !important; font-size: 14px !important; color: var(--lb-amber-ink) !important; font-weight: 600; }
.lawyer-address, .lawyer-phone, .lawyer-email { font-family: var(--font-ui) !important; font-size: 14px !important; color: var(--lb-muted) !important; }
.lawyer-card-icon { color: var(--lb-faint); height: 18px !important; width: 18px !important; }
.lawyer-email:hover { color: var(--lb-amber-ink) !important; }
#lawyer-legal-field-heading { font-family: var(--font-ui) !important; font-size: 16px !important; color: var(--lb-ink) !important; font-weight: 600 !important; }

.view-profile-btn {
  background: var(--lb-amber) !important; color: #1c1917 !important; border-radius: 10px !important;
  font-family: var(--font-ui) !important; font-weight: 600 !important; font-size: 14px !important; padding: 9px 16px !important;
}
.view-profile-btn:hover { background: var(--lb-amber-hover) !important; }
.view-profile-btn + span { color: var(--lb-faint) !important; }

/* ----- Re-run / New chat buttons app.js toggles ----- */
#new-chat-button-top button,
#re-run-search-btn {
  background: var(--lb-amber) !important; color: #1c1917 !important; border-radius: 10px !important;
  font-family: var(--font-ui) !important; font-weight: 600 !important; box-shadow: none !important;
}
#new-chat-button-top button:hover,
#re-run-search-btn:hover { background: var(--lb-amber-hover) !important; }
/* keep the disabled "limit reached" state readable */
#re-run-search-btn.bg-gray-300 { background: #d8cdbd !important; color: var(--lb-muted) !important; }

/* ----- Loading spinner colour ----- */
#loading-spinner svg { color: var(--lb-amber) !important; }

/* ----- Profile modal ----- */
#profile-modal .modal-content { border-radius: 16px !important; background: var(--lb-paper) !important; }
#profile-modal #profile-content { font-family: var(--font-body) !important; font-size: 16px !important; color: var(--lb-body) !important; }
#profile-modal #close-profile-btn {
  background: var(--lb-ink) !important; color: var(--lb-paper) !important; border-radius: 10px !important; font-family: var(--font-ui) !important;
}
#profile-modal #close-profile-btn:hover { background: #000 !important; }

/* ---------- Static content pages (about / privacy / terms) ---------- */
.lb-doc h1 { font-family: var(--font-ui); font-size: 34px; font-weight: 700; letter-spacing: -.02em; color: var(--lb-ink); margin: 0 0 8px; }
.lb-doc .lb-updated { font-family: var(--font-ui); font-size: 13px; color: var(--lb-faint); margin: 0 0 28px; }
.lb-doc h2 { font-family: var(--font-ui); font-size: 21px; font-weight: 600; color: var(--lb-amber-ink); margin: 28px 0 10px; }
.lb-doc h3 { font-family: var(--font-ui); font-size: 16px; font-weight: 600; color: var(--lb-ink); margin: 20px 0 8px; }
.lb-doc, .lb-doc p, .lb-doc li { font-family: var(--font-body); font-size: 16px; line-height: 1.75; color: var(--lb-body); }
.lb-doc p  { margin: 0 0 14px; }
.lb-doc ul { margin: 0 0 14px; padding-left: 24px; }
.lb-doc li { margin: 0 0 4px; }
.lb-doc a  { color: var(--lb-amber-ink); }
.lb-doc a:hover { color: var(--lb-amber-hover); }
.lb-pukeko-note {
  display: flex; align-items: center; gap: 16px; margin-top: 32px; padding: 18px 20px;
  background: var(--lb-sand); border: 1px solid var(--lb-line); border-radius: var(--lb-radius);
}
.lb-pukeko-note img { width: 64px; height: 64px; object-fit: contain; flex-shrink: 0; }
.lb-pukeko-note p { margin: 0; }

/* ---------- 404 ---------- */
.lb-404 { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 40px; }
.lb-404 img { width: 96px; height: 96px; object-fit: contain; opacity: .92; margin-bottom: 8px; }
.lb-404-code { font-family: var(--font-ui); font-size: 128px; font-weight: 700; line-height: 1; letter-spacing: -.03em; color: var(--lb-amber); }
.lb-404 h2 { font-family: var(--font-ui); font-size: 30px; font-weight: 700; color: var(--lb-ink); margin: 16px 0 10px; }
.lb-404 p  { font-family: var(--font-body); font-size: 18px; color: var(--lb-muted); margin: 0 0 28px; max-width: 460px; }

/* ---------- Global link colours (fallback) ---------- */
a { color: var(--lb-amber-ink); }
a:hover { color: var(--lb-amber-hover); }

/* ---------- Small brand pukeko in the sidebar ---------- */
.lb-pukeko-mini { width: 22px; height: 22px; object-fit: contain; opacity: .8; }

/* ---------- Responsive: collapse sidebar on small screens ---------- */
@media (max-width: 768px) {
  .lb-shell { flex-direction: column; }
  .lb-sidebar { width: 100%; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--lb-line); }
  .lb-nav { flex-direction: row; flex-wrap: wrap; }
  .lb-nav-section, .lb-sidebar .lb-nav-section { display: none; }
  .lb-hero h1 { font-size: 30px; }
}
