/* ============================================================
   PWFMS — Main Stylesheet
   Mobile-first, Professional Society Management
   ============================================================ */

:root {
  --primary: #1a4a8a;
  --primary-light: #2563b8;
  --primary-dark: #0f2c54;
  --secondary: #ffffff;
  --accent: #0d7c4a;
  --accent-light: #10a862;
  --sidebar-w: 260px;
  --navbar-h: 56px;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,.12);
}

/* ---- BASE ---- */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.9375rem;
  background: #f0f4f8;
  color: #1e293b;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary); }

/* ---- NAVBAR ---- */
.pwf-navbar {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  height: var(--navbar-h);
  z-index: 1040;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
}

/* ---- SIDEBAR ---- */
.pwf-sidebar {
  position: fixed;
  top: var(--navbar-h);
  left: -var(--sidebar-w);
  left: calc(-1 * var(--sidebar-w));
  width: var(--sidebar-w);
  height: calc(100vh - var(--navbar-h));
  background: linear-gradient(180deg, var(--primary-dark) 0%, #0a2240 100%);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1035;
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  transform: translateX(0);
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}

.pwf-sidebar.open {
  transform: translateX(var(--sidebar-w));
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1034;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show { display: block; }

.sidebar-header {
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}

.sidebar-nav {
  padding: 0.5rem 0 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  padding: 1rem 1.25rem 0.35rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.72rem 1.25rem;
  color: rgba(255,255,255,.72);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all .2s;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.nav-item.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-left-color: var(--accent-light);
}

.nav-item i { font-size: 1.1rem; flex-shrink: 0; }

/* ---- MAIN CONTENT ---- */
.pwf-main {
  min-height: calc(100vh - var(--navbar-h));
  padding-bottom: 2rem;
}

/* ---- PAGE HEADER ---- */
.page-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 1rem 0;
  margin-bottom: 1.25rem;
  position: sticky;
  top: var(--navbar-h);
  z-index: 100;
}

.page-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
}

/* ---- CARDS ---- */
.card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: #fff;
}

.card-header {
  background: transparent;
  border-bottom: 1px solid #f1f5f9;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.875rem 1.25rem;
  color: #334155;
}

.section-header {
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  color: var(--primary);
}

.chart-card .card-body { padding: 1rem; }

/* ---- STAT CARDS ---- */
.stat-card {
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  cursor: default;
}

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

.stat-icon { font-size: 1.5rem; margin-bottom: 0.4rem; }
.stat-num  { font-size: 1.75rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 0.25rem; opacity: .85; }

.stat-primary  { background: linear-gradient(135deg,#1a4a8a,#2563b8); color:#fff; }
.stat-success  { background: linear-gradient(135deg,#0d7c4a,#16a34a); color:#fff; }
.stat-info     { background: linear-gradient(135deg,#0891b2,#06b6d4); color:#fff; }
.stat-warning  { background: linear-gradient(135deg,#d97706,#f59e0b); color:#fff; }
.stat-cyan     { background: linear-gradient(135deg,#0e7490,#0891b2); color:#fff; }
.stat-orange   { background: linear-gradient(135deg,#c2410c,#f97316); color:#fff; }

/* ---- MEMBER CARDS (mobile) ---- */
.member-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  transition: box-shadow .2s;
}
.member-card:hover { box-shadow: var(--shadow-md); }

/* Family member dynamic rows */
.family-member-row .form-check-card { min-height: 44px; }
.family-member-row .card-body { padding: 1rem; }
@media (max-width: 575.98px) {
  .family-member-row .fm-remove span { display: none !important; }
}

.member-row {
  cursor: pointer;
  transition: background .15s;
}
.member-row:hover { background: #f8fafc; }

/* ---- PROFILE ---- */
.profile-header-card {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--accent) 100%);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: #fff;
  box-shadow: var(--shadow-md);
}

.profile-avatar {
  border: 3px solid rgba(255,255,255,.4);
  border-radius: 50%;
}

/* ---- TABS ---- */
.tab-scroll { -webkit-overflow-scrolling: touch; }
.tab-scroll::-webkit-scrollbar { display: none; }

.nav-pills .nav-link {
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.4rem 1rem;
  white-space: nowrap;
  color: #64748b;
  background: #fff;
  margin-right: 0.25rem;
  box-shadow: var(--shadow);
}
.nav-pills .nav-link.active {
  background: var(--primary);
  color: #fff;
}

/* ---- INFO ROWS ---- */
.info-row {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f1f5f9;
  align-items: flex-start;
}
.info-row:last-child { border-bottom: none; }
.info-label {
  min-width: 140px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding-top: 2px;
  flex-shrink: 0;
}
.info-value { font-weight: 500; color: #1e293b; word-break: break-word; }

/* ---- WIZARD ---- */
.wizard-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  overflow-x: auto;
  padding: 0.5rem 0;
  -webkit-overflow-scrolling: touch;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  border: 2px solid #cbd5e1;
  background: #fff;
  color: #94a3b8;
  transition: all .3s;
}

.wizard-step.active .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(26,74,138,.2);
}

.wizard-step.done .step-circle {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.step-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
}
.wizard-step.active .step-label { color: var(--primary); }
.wizard-step.done .step-label   { color: var(--accent); }

.step-line {
  width: 32px;
  height: 2px;
  background: #e2e8f0;
  flex-shrink: 0;
  margin-bottom: 1.6rem;
  transition: background .3s;
}
.step-line.done { background: var(--accent); }

.wizard-card { max-width: 680px; margin: 0 auto; }

/* ---- FORM ELEMENTS ---- */
.form-control, .form-select {
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  padding: 0.65rem 0.9rem;
  font-size: 0.9375rem;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,74,138,.12);
}
.form-control-lg { padding: 0.8rem 1rem; font-size: 1rem; }
.input-group-text { border-radius: 10px 0 0 10px; border: 1.5px solid #e2e8f0; background: #f8fafc; }

.required-label::after { content: ' *'; color: #ef4444; }

/* ---- RADIO CARDS ---- */
.form-check-card {
  border: 2px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all .2s;
}
.form-check-card:has(.form-check-input:checked) {
  border-color: var(--primary);
  background: rgba(26,74,138,.05);
}
.form-check-card .form-check-input { display: none; }
.form-check-card .form-check-label { cursor: pointer; font-weight: 500; }

/* ---- UPLOAD AREA ---- */
.upload-area {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: #f8fafc;
}
.upload-area:hover { border-color: var(--primary); background: rgba(26,74,138,.03); }

/* ---- PHOTO UPLOAD ---- */
.photo-upload-wrap { position: relative; display: inline-block; }
.photo-preview { border: 3px solid #e2e8f0; }
.photo-upload-label {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

/* ---- AVATAR CIRCLE ---- */
.avatar-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ---- BUTTONS ---- */
.btn { border-radius: 10px; font-weight: 600; transition: all .2s; }
.btn-lg { padding: 0.8rem 1.5rem; font-size: 1rem; border-radius: 12px; }
.btn-sm { border-radius: 8px; font-size: 0.8rem; }
.btn-rounded { border-radius: 20px; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); }
.btn-success { background: var(--accent); border-color: var(--accent); }
.btn-success:hover { background: var(--accent-light); border-color: var(--accent-light); }

/* ---- BADGES ---- */
.badge { font-weight: 600; letter-spacing: .02em; padding: 0.35em 0.65em; border-radius: 6px; }

/* ---- TABLE ---- */
.table th { font-size: 0.78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.table td { font-size: 0.875rem; vertical-align: middle; }
.table-dark th { background: var(--primary-dark); color: rgba(255,255,255,.9); border-color: rgba(255,255,255,.1); }

/* ---- PAGINATION ---- */
.page-link { border-radius: 8px !important; margin: 0 2px; color: var(--primary); border: 1.5px solid #e2e8f0; font-weight: 500; }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

/* ---- STICKY SAVE ---- */
.sticky-save {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid #e2e8f0;
  padding: 0.875rem 0;
  z-index: 200;
  box-shadow: 0 -4px 16px rgba(0,0,0,.08);
}

/* ---- REPORT CARDS ---- */
.report-card {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  color: inherit;
}
.report-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

/* ---- AUDIT ROW ---- */
.audit-row { padding: 0.875rem 1.25rem; border-bottom: 1px solid #f1f5f9; }
.audit-row:last-child { border-bottom: none; }

/* ---- ALERTS ---- */
.alert { border-radius: var(--radius); border: none; }
.alert-success { background: #dcfce7; color: #14532d; }
.alert-danger  { background: #fee2e2; color: #7f1d1d; }
.alert-info    { background: #e0f2fe; color: #0c4a6e; }
.alert-warning { background: #fef9c3; color: #713f12; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

/* ---- PRINT ---- */
@media print {
  .pwf-navbar, .pwf-sidebar, .sidebar-overlay, .page-header, .btn, nav { display: none !important; }
  .pwf-main { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ---- DESKTOP SIDEBAR (md+) ---- */
@media (min-width: 768px) {
  .pwf-sidebar {
    transform: translateX(var(--sidebar-w));
  }
  .pwf-main { margin-left: var(--sidebar-w); }
  .sidebar-overlay { display: none !important; }
  #sidebarToggle { display: none; }
}

/* ---- SCROLL FAB (registration forms) ---- */
.scroll-fab {
  position: fixed;
  right: 1rem;
  bottom: 6.5rem;
  z-index: 1035;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.scroll-fab-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(15, 76, 129, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: transform .15s, background .15s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.scroll-fab-btn:active { transform: scale(0.92); }
.scroll-fab-btn:hover { background: var(--primary-light); color: #fff; }
.scroll-fab-btn.is-hidden { opacity: 0; pointer-events: none; }

@media (min-width: 768px) {
  .scroll-fab { bottom: 2rem; }
}

/* ---- MOBILE TWEAKS ---- */
@media (max-width: 767.98px) {
  .container-fluid { padding-left: 1rem; padding-right: 1rem; }
  .stat-num { font-size: 1.4rem; }
  .info-label { min-width: 110px; font-size: 0.75rem; }
  .wizard-card { margin: 0; }
  .page-header { padding: 0.75rem 0; }
  .page-title { font-size: 1rem; }
}
