/* ═══════════════════════════════════════════════════
   LawConnect — Shared Design System
   Import this in every page
═══════════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #22263a;
  --border:    #2e3348;
  --border2:   #3d4260;
  --gold:      #D4A80C;
  --gold-mid:  #F5C518;
  --gold-pale: rgba(212,168,12,.12);
  --gold-glow: rgba(212,168,12,.25);
  --text:      #f0f2ff;
  --text2:     #8b90a7;
  --text3:     #5a5f7a;
  --success:   #22c55e;
  --danger:    #ef4444;
  --warning:   #f59e0b;
}

/* ── Reset ── */
*  { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; }
body { min-height: 100%; display: flex; flex-direction: column; font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); }
a    { text-decoration: none; color: inherit; }
button { font-family: 'DM Sans', sans-serif; cursor: pointer; }
input, select, textarea { font-family: 'DM Sans', sans-serif; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--border); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── Typography ── */
h1,h2,h3 { font-family: 'Playfair Display', serif; }

/* ── NAV ── */
nav {
  position: sticky; top: 0; z-index: 200;
  height: 64px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 2.5rem;
  background: rgba(15,17,23,.97); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-logo { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.nav-logo-text { font-family: 'Playfair Display', serif; font-size: 1.3rem; font-weight: 900; color: var(--gold); }
.nav-logo-text span { color: var(--text); }
.nav-links { display: flex; gap: .15rem; align-items: center; }
.nav-link {
  padding: .42rem .85rem; border-radius: 8px; font-size: .85rem; font-weight: 500;
  color: var(--text2); border: none; background: none; cursor: pointer; transition: all .15s;
  text-decoration: none; display: inline-flex; align-items: center;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--gold); }
.nav-link.ai { background: var(--gold-pale); color: var(--gold); border: 1px solid rgba(212,168,12,.3); font-weight: 600; }
.nav-link.ai:hover { background: rgba(212,168,12,.2); }
.nav-av {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--gold); color: #0d0d0d;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .75rem; cursor: pointer;
  border: 2px solid transparent; transition: border-color .2s;
}
.nav-av:hover { border-color: var(--gold-mid); }

/* ── Avatar dropdown menu ── */
.nav-av-wrap { position: relative; cursor: pointer; user-select: none; }
.nav-av-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  padding: .5rem;
  z-index: 99999;
  pointer-events: all;
}
.nav-av-menu.open { display: block; }
.nav-av-name { font-size: .82rem; font-weight: 700; color: var(--text); padding: .5rem .75rem .1rem; }
.nav-av-role { font-size: .74rem; color: var(--text3); padding: 0 .75rem .5rem; text-transform: capitalize; }
.nav-av-divider { height: 1px; background: var(--border); margin: .35rem 0; }
.nav-av-item {
  display: block; width: 100%;
  padding: .55rem .75rem;
  font-size: .84rem; color: var(--text2);
  text-decoration: none; background: none; border: none;
  border-radius: 8px; cursor: pointer; text-align: left;
  transition: background .12s, color .12s;
  font-family: 'DM Sans', sans-serif;
}
.nav-av-item:hover { background: var(--gold-pale); color: var(--gold); }
.nav-av-logout { color: #f87171 !important; }
.nav-av-logout:hover { background: rgba(248,113,113,.12) !important; color: #f87171 !important; }

/* ── SIDEBAR LAYOUT ── */
.layout { display: flex; height: calc(100vh - 64px); overflow: hidden; flex: 1; }
.sidebar {
  width: 230px; flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 1.5rem .9rem; display: flex; flex-direction: column; gap: .18rem;
  overflow-y: auto;
}
.sb-sec {
  font-size: .67rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--text3); padding: .7rem .75rem .28rem;
}
.sb-item {
  display: flex; align-items: center; gap: .65rem;
  padding: .56rem .75rem; border-radius: 8px;
  color: var(--text2); font-size: .84rem; font-weight: 500;
  cursor: pointer; border: none; background: none;
  width: 100%; text-align: left; transition: all .15s;
  text-decoration: none;
}
.sb-item:hover { background: var(--gold-pale); color: var(--gold); }
.sb-item.active { background: var(--gold-pale); color: var(--gold); font-weight: 600; }
.sb-badge {
  margin-left: auto; background: var(--gold); color: #0d0d0d;
  font-size: .64rem; font-weight: 700; padding: .1rem .4rem; border-radius: 50px;
}
.sb-ai {
  margin-top: auto;
  background: linear-gradient(135deg, rgba(212,168,12,.15), rgba(245,197,24,.06));
  border: 1px solid rgba(212,168,12,.3); border-radius: 10px;
  padding: .9rem; display: flex; align-items: center; gap: .6rem;
  cursor: pointer; transition: background .2s; text-decoration: none;
}
.sb-ai:hover { background: var(--gold-pale); }
.sb-ai-icon { font-size: 1.25rem; }
.sb-ai-text { font-size: .8rem; font-weight: 600; color: var(--gold); }
.sb-ai-sub  { font-size: .7rem; color: var(--text3); }

/* ── MAIN CONTENT AREA ── */
.main-content { flex: 1; overflow-y: auto; padding: 2.5rem; }

/* ── BUTTONS ── */
.btn-gold {
  padding: .55rem 1.4rem; border: none; border-radius: 8px;
  background: var(--gold); color: #0d0d0d; font-size: .875rem; font-weight: 700;
  cursor: pointer; transition: all .2s; display: inline-flex; align-items: center; gap: .4rem;
}
.btn-gold:hover { background: var(--gold-mid); transform: translateY(-1px); }
.btn-gold:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-ghost {
  padding: .5rem 1.1rem; border: 1px solid var(--border2); border-radius: 8px;
  background: transparent; color: var(--text2); font-size: .85rem; font-weight: 500;
  cursor: pointer; transition: all .15s;
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }

.btn-lg { padding: .8rem 1.9rem; border-radius: 10px; font-size: .95rem; font-weight: 700; cursor: pointer; transition: all .2s; display: inline-block; border: none; }
.btn-lg.primary { background: var(--gold); color: #0d0d0d; box-shadow: 0 6px 22px var(--gold-glow); }
.btn-lg.primary:hover { background: var(--gold-mid); transform: translateY(-2px); }
.btn-lg.outline { background: transparent; color: var(--text); border: 1.5px solid var(--border2); }
.btn-lg.outline:hover { border-color: var(--gold); color: var(--gold); }

.btn-sm { padding: .4rem 1rem; border: none; border-radius: 8px; background: var(--gold); color: #0d0d0d; font-size: .8rem; font-weight: 700; cursor: pointer; }
.btn-sm:hover { background: var(--gold-mid); }

.btn-submit {
  width: 100%; padding: .85rem; border: none; border-radius: 10px;
  background: var(--gold); color: #0d0d0d; font-size: .95rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .5rem;
  box-shadow: 0 6px 22px var(--gold-glow); transition: all .2s;
}
.btn-submit:hover:not(:disabled) { background: var(--gold-mid); transform: translateY(-1px); }
.btn-submit:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-submit .spinner { display: none; width: 18px; height: 18px; border: 2px solid rgba(13,13,13,.25); border-top-color: #0d0d0d; border-radius: 50%; animation: spin .65s linear infinite; }
.btn-submit.loading .spinner { display: block; }
.btn-submit.loading .btn-text { display: none; }

/* ── FORMS ── */
.form-row { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .38rem; color: var(--text2); }
.form-input {
  width: 100%; padding: .7rem 1rem; border: 1px solid var(--border2); border-radius: 9px;
  font-size: .88rem; background: var(--surface2); color: var(--text); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-input::placeholder { color: var(--text3); }
.form-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-pale); }
.form-input.error { border-color: var(--danger); }
select.form-input option { background: var(--surface2); }
.input-wrap { position: relative; }
.pw-toggle { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text3); font-size: 1rem; padding: 0; }
.pw-toggle:hover { color: var(--gold); }
.forgot-link { font-size: .8rem; color: var(--gold); cursor: pointer; }
.forgot-link:hover { text-decoration: underline; }

/* ── CARD ── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.35rem; }
.card-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; }
.card-title { font-weight: 700; font-size: .9rem; }
.card-link { font-size: .78rem; color: var(--gold); cursor: pointer; font-weight: 500; }
.card-link:hover { text-decoration: underline; }

/* ── KPI GRID ── */
.kpi-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1.1rem; margin-bottom: 1.75rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 1.35rem; transition: border-color .2s; }
.kpi:hover { border-color: rgba(212,168,12,.35); }
.kpi-label { font-size: .75rem; color: var(--text2); margin-bottom: .4rem; }
.kpi-val { font-family: 'Playfair Display', serif; font-size: 1.9rem; font-weight: 700; margin-bottom: .25rem; }
.kpi-trend { font-size: .73rem; color: var(--text3); }
.kpi.gold { background: var(--gold); border-color: var(--gold); }
.kpi.gold .kpi-label { color: rgba(13,13,13,.65); }
.kpi.gold .kpi-val   { color: #0d0d0d; }
.kpi.gold .kpi-trend { color: rgba(13,13,13,.5); }

/* ── 2-COL GRID ── */
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }
.three-col { display: grid; grid-template-columns: repeat(3,1fr); gap: 1.25rem; }

/* ── PAGE HEADER ── */
.page-hdr { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 2rem; }
.page-title { font-family: 'Playfair Display', serif; font-size: 1.7rem; font-weight: 900; margin-bottom: .2rem; }
.page-sub { color: var(--text2); font-size: .87rem; }

/* ── CHIPS ── */
.chip { display: inline-block; padding: .12rem .5rem; border-radius: 50px; font-size: .68rem; font-weight: 700; }
.chip.confirmed { background: rgba(34,197,94,.15);   color: #4ade80; }
.chip.pending   { background: rgba(245,158,11,.15);  color: #fbbf24; }
.chip.cancelled { background: rgba(239,68,68,.15);   color: #f87171; }
.chip.completed { background: rgba(255,255,255,.08); color: var(--text2); }
.chip.online    { background: rgba(59,130,246,.15);  color: #60a5fa; }
.chip.inperson  { background: rgba(139,92,246,.15);  color: #a78bfa; }

/* ── APPT ITEM ── */
.appt-item { display: flex; align-items: center; gap: .85rem; padding: .8rem 0; border-bottom: 1px solid var(--border); }
.appt-item:last-child { border-bottom: none; }
.appt-av { width: 38px; height: 38px; border-radius: 50%; background: var(--gold-pale); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .78rem; color: var(--gold); flex-shrink: 0; border: 1px solid rgba(212,168,12,.25); }
.appt-name { font-weight: 600; font-size: .87rem; }
.appt-type { font-size: .74rem; color: var(--text2); }
.appt-time { margin-left: auto; text-align: right; font-size: .8rem; font-weight: 600; }

/* ── ACTIVITY ── */
.act-item { display: flex; gap: .7rem; padding: .65rem 0; border-bottom: 1px solid var(--border); }
.act-item:last-child { border-bottom: none; }
.act-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-top: 6px; flex-shrink: 0; }
.act-dot.g { background: var(--text3); }
.act-text { font-size: .82rem; line-height: 1.5; }
.act-time { font-size: .71rem; color: var(--text3); }

/* ── ALERTS ── */
.alert { padding: .8rem 1rem; border-radius: 9px; font-size: .87rem; margin-bottom: 1.2rem; display: none; align-items: flex-start; gap: .6rem; }
.alert.error   { background: rgba(239,68,68,.12); color: #f87171; border: 1px solid rgba(239,68,68,.3); }
.alert.success { background: rgba(34,197,94,.12); color: #4ade80; border: 1px solid rgba(34,197,94,.3); }
.alert.show { display: flex; }

/* ── MODAL ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(6px); z-index: 500; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal-box { background: var(--surface); border: 1px solid var(--border2); border-radius: 18px; max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto; position: relative; }
.modal-box::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--gold), var(--gold-mid)); border-radius: 18px 18px 0 0; }
.modal-hdr { padding: 1.75rem 1.75rem 0; display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-title { font-family: 'Playfair Display', serif; font-size: 1.2rem; font-weight: 900; }
.modal-close { background: none; border: none; color: var(--text3); font-size: 1.3rem; cursor: pointer; padding: .2rem; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 0 1.75rem 1.75rem; }

/* ── AUTH LAYOUT ── */
.auth-wrap { height: 100vh; display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.auth-l { background: var(--surface); padding: 3rem 3.5rem; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; border-right: 1px solid var(--border); height: 100vh; position: sticky; top: 0; }
.auth-l::before { content: ''; position: absolute; top: -100px; right: -100px; width: 450px; height: 450px; border-radius: 50%; background: radial-gradient(circle, rgba(212,168,12,.35) 0%, transparent 65%); }
.auth-l::after  { content: ''; position: absolute; bottom: -80px; left: -60px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(245,197,24,.18) 0%, transparent 65%); }
.auth-inner { position: relative; z-index: 1; }
.auth-logo { font-family: 'Playfair Display', serif; font-size: 1.5rem; font-weight: 900; color: var(--gold); margin-bottom: 3rem; display: inline-block; }
.auth-logo span { color: var(--text); }
.auth-l h1 { font-size: 2.6rem; font-weight: 900; line-height: 1.12; margin-bottom: 1.25rem; }
.auth-l h1 em { font-style: italic; color: var(--gold-mid); }
.auth-l p { color: var(--text2); font-size: .94rem; line-height: 1.75; margin-bottom: 2.5rem; }
.auth-stats { display: flex; gap: 2.5rem; margin-bottom: 2.5rem; }
.auth-stat-val { font-family: 'Playfair Display', serif; font-size: 1.8rem; font-weight: 900; color: var(--gold-mid); }
.auth-stat-label { font-size: .78rem; color: var(--text2); }
.auth-testi { padding: 1.5rem; background: rgba(255,255,255,.04); border-radius: 14px; border: 1px solid var(--border2); }
.auth-testi-q { color: var(--text2); font-size: .88rem; line-height: 1.65; font-style: italic; margin-bottom: .9rem; }
.auth-testi-a { font-size: .78rem; color: var(--gold); font-weight: 600; }
.auth-r { display: flex; align-items: flex-start; justify-content: center; padding: 2.5rem 2rem; background: var(--bg); overflow-y: auto; height: 100vh; }
.auth-box { width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--border2); border-radius: 20px; padding: 2.75rem; position: relative; overflow: hidden; margin: auto 0; }
.auth-box::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--gold), var(--gold-mid)); }
.auth-box h2 { font-size: 1.85rem; font-weight: 900; margin-bottom: .35rem; }
.auth-box .sub { color: var(--text2); font-size: .9rem; margin-bottom: 2rem; }
.auth-bottom { text-align: center; margin-top: 1.25rem; font-size: .87rem; color: var(--text2); }
.auth-bottom a { color: var(--gold); font-weight: 600; cursor: pointer; }
.auth-bottom a:hover { text-decoration: underline; }

/* ── BADGE / HERO BADGE ── */
.hbadge { display: inline-flex; align-items: center; gap: .5rem; background: var(--gold-pale); color: var(--gold); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: .3rem .85rem; border-radius: 50px; margin-bottom: 1rem; border: 1px solid rgba(212,168,12,.25); }
.hbadge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: pulse 2s infinite; }

/* ── SECTION LABELS ── */
.stag   { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); margin-bottom: .5rem; }
.stitle { font-size: clamp(1.6rem,3vw,2.2rem); font-weight: 900; margin-bottom: .4rem; }
.ssub   { color: var(--text2); font-size: .9rem; margin-bottom: 2rem; }

/* ── TOAST ── */
#toastWrap { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 999; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; }
.toast { display: flex; align-items: center; gap: .65rem; background: var(--surface); border: 1px solid var(--border2); border-left: 3px solid var(--gold); border-radius: 10px; padding: .7rem 1rem; font-size: .85rem; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: toastIn .25s ease; pointer-events: all; }

/* ── FOOTER ── */
footer {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1rem 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.83rem;
  color: var(--text3);
  margin-top: auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
footer a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
}
footer a:hover { text-decoration: underline; }
.footer-logo { font-family: 'Playfair Display', serif; font-size: 1.1rem; font-weight: 900; color: var(--gold); margin-bottom: .4rem; }
.footer-logo span { color: var(--text); }
.disclaimer-bar { text-align: center; font-size: .77rem; color: var(--text3); padding: 1.25rem 2.5rem; background: rgba(0,0,0,.15); border-top: 1px solid var(--border); }

/* ── PAGE WRAP (for non-layout pages) ── */
.page-wrap { flex: 1; display: flex; flex-direction: column; padding-bottom: 5rem; }
.page-wrap > .main-pad { flex: 1; padding: 2.5rem; max-width: 1100px; margin: 0 auto; width: 100%; }

/* ── BAR CHART ── */
.chart-bars { display: flex; gap: .5rem; align-items: flex-end; height: 90px; padding: 0 .5rem; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--border2); transition: background .2s; }
.bar.on, .bar:hover { background: var(--gold); }
.bar-label { font-size: .69rem; color: var(--text3); }

/* ── MINI CALENDAR ── */
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; }
.cal-dh { text-align: center; font-size: .67rem; font-weight: 700; color: var(--text3); padding: .22rem 0; }
.cal-d  { text-align: center; font-size: .73rem; padding: .32rem; border-radius: 6px; color: var(--text2); cursor: pointer; }
.cal-d:hover     { background: var(--gold-pale); color: var(--gold); }
.cal-d.today     { background: var(--gold); color: #0d0d0d; font-weight: 700; }
.cal-d.has-slot  { color: var(--gold); }
.cal-d.other-mo  { opacity: .3; }

/* ── VERIFIED BADGE ── */
.verified-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .7rem; font-weight: 700; color: #4ade80; background: rgba(34,197,94,.1); padding: .12rem .5rem; border-radius: 50px; }

/* ── ANIMATIONS ── */
@keyframes pulse  { 0%,100%{opacity:1}50%{opacity:.3} }
@keyframes spin   { to{transform:rotate(360deg)} }
@keyframes toastIn { from{transform:translateX(120%);opacity:0}to{transform:none;opacity:1} }

/* ── RESPONSIVE ── */
@media(max-width:1100px){ .kpi-grid{grid-template-columns:repeat(2,1fr);} }
@media(max-width:900px){
  nav { padding: 0 1rem; }
  .nav-links .nav-link:not(.ai) { display: none; }
  .sidebar { display: none; }
  .two-col, .three-col { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-l { display: none; }
}
@media(max-width:600px){
  .auth-r { padding: 1.5rem 1rem; }
  .auth-box { padding: 2rem 1.5rem; }
}
