/* ═══════════════════════════════════════════════════
   SOMALILAND BAR ASSOCIATION — Registration System
   Design: Refined Legal Authority
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --navy:    #0d1b2e;
  --navy2:   #152640;
  --gold:    #c8972a;
  --gold2:   #e8b84b;
  --cream:   #f8f4ef;
  --cream2:  #ede8e0;
  --white:   #ffffff;
  --text:    #1a1a2e;
  --muted:   #6b7280;
  --border:  #d9d0c4;
  --green:   #1a7a4a;
  --red:     #b91c1c;
  --pending: #d97706;
  --shadow:  0 4px 24px rgba(13,27,46,.12);
  --shadow-lg: 0 12px 48px rgba(13,27,46,.2);
  --radius:  12px;
  --radius-lg: 20px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', sans-serif;
  --transition:   all .25s cubic-bezier(.4,0,.2,1);
}

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

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── SCROLLBAR ─────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--cream2); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }

/* ══ HEADER ════════════════════════════════════════ */
#site-header {
  background: var(--navy);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 2px 20px rgba(0,0,0,.3);
}

.header-inner {
  max-width: 1400px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-seal {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.logo-name {
  font-family: var(--font-display);
  font-size: .95rem;
  color: var(--white);
  font-weight: 600;
  letter-spacing: .02em;
}

.logo-sub {
  font-size: .68rem;
  color: var(--gold2);
  letter-spacing: .08em;
  text-transform: uppercase;
}

nav {
  display: flex;
  align-items: center;
  gap: .25rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.nav-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.75);
  font-family: var(--font-body);
  font-size: .85rem;
  font-weight: 500;
  padding: .45rem .9rem;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: .4rem;
  letter-spacing: .01em;
}

.nav-btn:hover, .nav-btn.active {
  background: rgba(200,151,42,.15);
  color: var(--gold2);
}

.nav-btn.primary {
  background: var(--gold);
  color: var(--navy);
  font-weight: 600;
}

.nav-btn.primary:hover { background: var(--gold2); }

.nav-btn.danger {
  background: rgba(185,28,28,.2);
  color: #fca5a5;
}

.nav-btn.danger:hover { background: rgba(185,28,28,.4); }

/* ══ PAGES ════════════════════════════════════════ */
.page { display: none; }
.page.active { display: block; }

/* ══ HERO BANNER ══════════════════════════════════ */
.page-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 60%, #1e3a5f 100%);
  padding: 4rem 2rem 3rem;
  position: relative;
  overflow: hidden;
}

.page-hero::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(200,151,42,.15) 0%, transparent 70%);
  border-radius: 50%;
}

.page-hero::after {
  content: '';
  position: absolute;
  bottom: -40px;
  left: 10%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(200,151,42,.08) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-content {
  max-width: 1400px;
  margin: auto;
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: rgba(200,151,42,.15);
  border: 1px solid rgba(200,151,42,.3);
  color: var(--gold2);
  padding: .3rem .8rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: var(--white);
  line-height: 1.2;
  margin-bottom: .75rem;
}

.hero-title span { color: var(--gold2); }

.hero-sub {
  color: rgba(255,255,255,.6);
  font-size: .95rem;
  max-width: 600px;
}

/* ══ STAT CARDS ═══════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
  padding: 2rem;
  max-width: 1400px;
  margin: auto;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--gold);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(200,151,42,.06);
}

.stat-card.blue  { border-left-color: #2563eb; }
.stat-card.pink  { border-left-color: #db2777; }
.stat-card.green { border-left-color: var(--green); }
.stat-card.red   { border-left-color: var(--red); }
.stat-card.orange{ border-left-color: var(--pending); }

.stat-icon {
  font-size: 1.6rem;
  margin-bottom: .5rem;
  display: block;
}

.stat-num {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}

.stat-label {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: .3rem;
}

/* ══ SECTION WRAPPER ══════════════════════════════ */
.section {
  max-width: 1400px;
  margin: auto;
  padding: 1.5rem 2rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .75rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--navy);
  font-weight: 600;
}

/* ══ SEARCH BAR ═══════════════════════════════════ */
.search-bar {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-wrap .icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1rem;
}

input[type="search"], input[type="text"], input[type="email"],
input[type="tel"], input[type="password"], select, textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .6rem 1rem;
  font-family: var(--font-body);
  font-size: .9rem;
  background: var(--white);
  color: var(--text);
  transition: var(--transition);
  outline: none;
}

input[type="search"] { padding-left: 2.5rem; }

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200,151,42,.12);
}

select { cursor: pointer; }

/* ══ DIRECTORY CARDS ══════════════════════════════ */
.dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.dir-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  border: 1.5px solid transparent;
}

.dir-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--gold);
}

.dir-card-top {
  background: linear-gradient(135deg, var(--navy), var(--navy2));
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid rgba(200,151,42,.4);
  object-fit: cover;
  flex-shrink: 0;
}

.initials {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  flex-shrink: 0;
}

.dir-card-name {
  font-family: var(--font-display);
  color: var(--white);
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.3;
}

.dir-card-body {
  padding: 1rem 1.25rem 1.25rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.tag.category { background: rgba(13,27,46,.08); color: var(--navy); }
.tag.region   { background: rgba(200,151,42,.12); color: #7a5a10; }
.tag.approved { background: rgba(26,122,74,.12); color: var(--green); }
.tag.pending  { background: rgba(217,119,6,.12); color: var(--pending); }
.tag.rejected { background: rgba(185,28,28,.1); color: var(--red); }

.btn-view {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--navy);
  color: var(--gold2);
  border: none;
  border-radius: 6px;
  padding: .45rem .9rem;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: .75rem;
  font-family: var(--font-body);
  letter-spacing: .03em;
}

.btn-view:hover { background: var(--gold); color: var(--navy); }

/* ══ BUTTONS ═══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  letter-spacing: .02em;
  text-decoration: none;
}

.btn-primary   { background: var(--navy); color: var(--gold2); }
.btn-primary:hover { background: var(--gold); color: var(--navy); }
.btn-gold      { background: var(--gold); color: var(--navy); }
.btn-gold:hover{ background: var(--gold2); }
.btn-green     { background: var(--green); color: #fff; }
.btn-green:hover { background: #155e38; }
.btn-red       { background: var(--red); color: #fff; }
.btn-red:hover { background: #991b1b; }
.btn-outline   { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-sm { padding: .35rem .75rem; font-size: .78rem; }

/* ══ TABLE ═════════════════════════════════════════ */
.table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

thead { background: var(--navy); }
thead th {
  padding: .85rem 1rem;
  text-align: left;
  color: var(--gold2);
  font-weight: 600;
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--cream2);
  transition: background .15s;
}

tbody tr:hover { background: var(--cream); }

tbody td {
  padding: .75rem 1rem;
  vertical-align: middle;
  color: var(--text);
}

.td-name {
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .6rem;
}

.mini-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .75rem;
  color: var(--navy);
  flex-shrink: 0;
  overflow: hidden;
}

.mini-avatar img { width: 100%; height: 100%; object-fit: cover; }

.action-btns { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ══ CHARTS ════════════════════════════════════════ */
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  padding: 0 2rem 1.5rem;
  max-width: 1400px;
  margin: auto;
}

.chart-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.chart-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--navy);
  font-weight: 600;
  margin-bottom: 1rem;
}

/* ══ MODALS ════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,27,46,.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn .2s ease;
}

.modal-overlay.open { display: flex; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .3s cubic-bezier(.4,0,.2,1);
}

.modal.modal-sm { max-width: 440px; }
.modal.modal-lg { max-width: 900px; }

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.75rem 1rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 1;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--navy);
  font-weight: 600;
}

.modal-close {
  background: var(--cream2);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--muted);
  transition: var(--transition);
}

.modal-close:hover { background: var(--border); color: var(--text); }

.modal-body { padding: 1.5rem 1.75rem; }

.modal-footer {
  padding: 1rem 1.75rem 1.5rem;
  display: flex;
  gap: .75rem;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

/* ══ FORMS ═════════════════════════════════════════ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: .02em;
  text-transform: uppercase;
}

.required::after { content: ' *'; color: var(--red); }

.file-input-wrap {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--cream);
}

.file-input-wrap:hover { border-color: var(--gold); }

.file-input-wrap input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

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

/* ══ PROFILE MODAL ════════════════════════════════ */
.profile-header {
  background: linear-gradient(135deg, var(--navy), var(--navy2));
  padding: 2rem 1.75rem;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.profile-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  object-fit: cover;
  flex-shrink: 0;
}

.profile-initials {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
  flex-shrink: 0;
}

.profile-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--white);
  font-weight: 700;
}

.profile-meta { color: rgba(255,255,255,.65); font-size: .85rem; margin-top: .25rem; }

.profile-sections { padding: 1.5rem 1.75rem; display: grid; gap: 1.25rem; }

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

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

.info-item { }
.info-key {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .15rem;
}
.info-val { font-size: .9rem; color: var(--text); font-weight: 500; }

.bio-box {
  background: var(--cream);
  border-left: 3px solid var(--gold);
  padding: 1rem 1.25rem;
  border-radius: 0 8px 8px 0;
  font-size: .88rem;
  color: var(--text);
  line-height: 1.7;
  font-style: italic;
}

/* ══ TABS ══════════════════════════════════════════ */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; }
.tab-btn {
  background: none;
  border: none;
  padding: .6rem 1.1rem;
  font-family: var(--font-body);
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}
.tab-btn.active { color: var(--navy); border-bottom-color: var(--gold); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ══ LOGIN PAGE ═══════════════════════════════════ */
#login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a5f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.login-seal {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, var(--navy), var(--navy2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  box-shadow: 0 4px 20px rgba(13,27,46,.3);
}

.login-seal span {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold2);
}

.login-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--navy);
  margin-bottom: .25rem;
}

.login-sub { color: var(--muted); font-size: .85rem; margin-bottom: 1.75rem; }

.login-form { display: flex; flex-direction: column; gap: .9rem; text-align: left; }

.login-form .form-group { gap: .4rem; }

.error-msg {
  background: rgba(185,28,28,.08);
  border: 1px solid rgba(185,28,28,.2);
  color: var(--red);
  padding: .6rem .9rem;
  border-radius: 6px;
  font-size: .82rem;
  display: none;
}

/* ══ LOADER ════════════════════════════════════════ */
.loader {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
  font-size: .9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--cream2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

.empty {
  text-align: center;
  padding: 3rem;
  color: var(--muted);
}

.empty-icon { font-size: 3rem; margin-bottom: .5rem; display: block; }

/* ══ TOAST ════════════════════════════════════════ */
#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.toast-item {
  background: var(--navy);
  color: var(--white);
  padding: .75rem 1.25rem;
  border-radius: 10px;
  font-size: .85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease;
  display: flex;
  align-items: center;
  gap: .5rem;
  border-left: 3px solid var(--gold);
}

.toast-item.success { border-left-color: var(--green); }
.toast-item.error   { border-left-color: var(--red); }

@keyframes toastIn {
  from { transform: translateX(100px); opacity: 0; }
  to   { transform: translateX(0);     opacity: 1; }
}

/* ══ RESPONSIVE ═══════════════════════════════════ */
@media (max-width: 768px) {
  .stats-row { padding: 1rem; gap: .75rem; }
  .section { padding: 1rem; }
  .charts-row { padding: 0 1rem 1rem; }
  .header-inner { gap: .5rem; }
  nav { gap: .1rem; }
  .nav-btn { padding: .4rem .6rem; font-size: .78rem; }
  .logo-sub { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .dir-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* ══ MISC UTILITIES ═══════════════════════════════ */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.text-gold { color: var(--gold); }
.text-navy { color: var(--navy); }
.text-muted { color: var(--muted); }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.flex { display: flex; }
.gap-1 { gap: .5rem; }
.items-center { align-items: center; }
.wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.font-display { font-family: var(--font-display); }
.w-full { width: 100%; }
