/* Silsilah Keluarga — Design System v2 */

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #ccfbf1;
  --accent: #d97706;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.1);
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --transition: 0.2s ease;
  --navbar-height: 64px;
  --mobile-header: 56px;
  --mobile-nav: 80px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  background-color: var(--bg);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

.app-main {
  min-height: calc(100vh - var(--navbar-height));
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.container { position: relative; max-width: 1200px; }

/* Navbar Desktop */
.app-navbar {
  position: sticky;
  top: 0;
  z-index: 1040;
  overflow: visible;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.app-navbar .search-wrap {
  position: relative;
  z-index: 1045;
}

.app-navbar .dropdown-menu {
  z-index: 1060;
}

.app-navbar .dropdown {
  position: relative;
  z-index: 20;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
}

.app-brand:hover { color: var(--primary); }

.app-brand-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.app-brand-icon-logo {
  background: rgba(255, 255, 255, 0.95);
  padding: 3px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.app-brand-icon-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 9px;
}

.mobile-brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px;
}

.app-brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.app-brand-title { font-weight: 700; font-size: 0.95rem; max-width: 280px; }
.app-brand-sub { font-size: 0.8rem; color: var(--text-muted); }

.app-nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.app-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all var(--transition);
}

.app-nav-link:hover { color: var(--primary); background: var(--primary-light); }
.app-nav-link.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }

.btn-wa {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #25d366;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.35);
}

.btn-wa i { font-size: 1.2rem; }

.btn-wa-sm-mobile {
  width: 34px;
  height: 34px;
  min-width: 34px;
  padding: 0;
}

.btn-wa-sm-mobile i { font-size: 1rem; }

/* Cards */
.card {
  margin-bottom: 1.25rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}

.card-header {
  font-weight: 600;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.page-section { min-height: auto; padding-top: 0.5rem; padding-bottom: 2rem; }

.page-title {
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--text);
  text-align: center;
  margin-bottom: 1.5rem;
}

.themed-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  background: var(--surface);
}

.themed-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.themed-card-body { padding: 1.25rem; }

.themed-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--primary-light);
  color: var(--primary);
}

.themed-badge-dark {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  background: var(--bg);
  color: var(--text-muted);
}

.themed-title {
  margin-top: 0.5rem;
  margin-bottom: 0;
  font-weight: 700;
  color: #fff;
  font-size: 1.05rem;
}

.themed-title-dark {
  margin-top: 0.5rem;
  margin-bottom: 0;
  font-weight: 800;
  color: var(--text);
  font-size: 1.15rem;
}

.themed-divider,
.themed-divider-dark {
  height: 1px;
  background: var(--border);
  margin: 0.75rem 0;
  border: none;
}

.themed-divider::before,
.themed-divider-dark::before { display: none; }

.themed-sub { margin: 0; color: rgba(255,255,255,0.85); font-weight: 500; font-size: 0.875rem; }
.themed-sub-dark { margin: 0; color: var(--text-muted); font-weight: 500; font-size: 0.875rem; }

.themed-bg-blue {
  background: linear-gradient(135deg, #1e40af, #3b82f6) !important;
  border: none; color: #fff;
}
.themed-bg-teal {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary)) !important;
  border: none; color: #fff;
}
.themed-bg-amber {
  background: linear-gradient(135deg, #b45309, #f59e0b) !important;
  border: none; color: #fff;
}
.themed-bg-rose {
  background: linear-gradient(135deg, #be123c, #f43f5e) !important;
  border: none; color: #fff;
}
.themed-bg-note {
  background: var(--surface) !important;
  border: 1px solid var(--border);
}

.action-card-link { display: block; text-decoration: none; color: inherit; height: 100%; }
.action-card {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  color: #fff;
  height: 100%;
}
.action-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.action-card-inner { padding: 1.15rem; }
.action-card-header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.action-card-title { margin-top: 0.5rem; font-weight: 700; font-size: 1rem; color: #fff; }
.action-card-sub { margin: 0; color: rgba(255,255,255,0.85); font-size: 0.82rem; }

.anggota-action-btn {
  min-width: 88px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.82rem;
}

.form-control, .form-select {
  border-radius: var(--radius);
  border-color: var(--border);
  font-size: 0.9rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring, rgba(13, 148, 136, 0.15));
}

.btn { font-weight: 600; font-size: 0.875rem; border-radius: var(--radius); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.alert { border-radius: var(--radius); border: none; }

.nav-pills .nav-link { border-radius: 999px; font-weight: 500; color: var(--text-muted); }
.nav-pills .nav-link.active { background: var(--primary); }

/* Mobile */
.mobile-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--mobile-header);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 1045;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem 0 1rem;
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.mobile-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
}

.mobile-brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-brand i {
  color: var(--primary);
  font-size: 1.2rem;
  flex-shrink: 0;
}

.mobile-header-btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  line-height: 1;
  flex-shrink: 0;
}

.mobile-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

.mobile-header-icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  position: relative;
  z-index: 5;
}

/* Overlay pencarian mobile */
.mobile-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.mobile-search-overlay.is-open {
  pointer-events: auto;
  visibility: visible;
  opacity: 1;
}

.mobile-search-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.mobile-search-overlay-panel {
  position: absolute;
  top: var(--mobile-header);
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 0.85rem 1rem 1rem;
  transform: translateY(-12px);
  transition: transform 0.22s ease;
}

.mobile-search-overlay.is-open .mobile-search-overlay-panel {
  transform: translateY(0);
}

.mobile-search-overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.65rem;
  color: var(--text);
  font-size: 0.9rem;
}

.search-results-overlay {
  position: static !important;
  margin-top: 0.65rem;
  max-height: min(60vh, 420px);
  min-width: 0;
  left: auto !important;
  right: auto !important;
  top: auto !important;
}

body.search-overlay-open {
  overflow: hidden;
}

.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  padding: 0.45rem 0.85rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
}

.mobile-bottom-nav-inner {
  position: relative;
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 0.15rem;
  max-width: 480px;
  margin: 0 auto;
  padding: 0.4rem 0.55rem;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 1.25rem;
  box-shadow:
    0 8px 32px rgba(15, 23, 42, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.8) inset;
  pointer-events: auto;
  overflow: hidden;
}

.mobile-bottom-nav-inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85), transparent);
  pointer-events: none;
}

.mobile-nav-item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-width: 0;
  padding: 0.2rem 0.15rem;
  border-radius: 0.85rem;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.25s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2rem;
  border-radius: 999px;
  font-size: 1.2rem;
  line-height: 1;
  transition: background 0.28s ease, transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.28s ease;
}

.mobile-nav-icon .nav-icon-solid {
  position: absolute;
  opacity: 0;
  transform: scale(0.72);
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.mobile-nav-icon .nav-icon-line {
  transition: opacity 0.18s ease, transform 0.22s ease;
}

.mobile-nav-label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.15;
  transition: opacity 0.2s ease, transform 0.25s ease;
}

.mobile-nav-item:hover {
  color: var(--primary);
}

.mobile-nav-item:active .mobile-nav-icon {
  transform: scale(0.88);
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item.active .mobile-nav-icon {
  background: var(--primary-light);
  box-shadow: 0 2px 10px var(--primary-ring);
  transform: scale(1.04);
  animation: mobile-nav-pop 0.38s cubic-bezier(0.34, 1.45, 0.64, 1);
}

.mobile-nav-item.active .nav-icon-line {
  opacity: 0;
  transform: scale(0.65);
}

.mobile-nav-item.active .nav-icon-solid {
  opacity: 1;
  transform: scale(1);
}

.mobile-nav-item.active .mobile-nav-label {
  transform: translateY(-1px);
}

.mobile-content-spacer {
  height: var(--mobile-nav);
}

@keyframes mobile-nav-pop {
  0%   { transform: scale(0.92); }
  55%  { transform: scale(1.1); }
  100% { transform: scale(1.04); }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav-item.active .mobile-nav-icon {
    animation: none;
  }

  .mobile-nav-icon,
  .mobile-nav-icon .nav-icon-line,
  .mobile-nav-icon .nav-icon-solid,
  .mobile-nav-label {
    transition: none;
  }
}

@media (max-width: 991.98px) {
  body {
    padding-top: var(--mobile-header);
    padding-bottom: var(--mobile-nav);
  }
  .app-main { padding-top: 0.75rem; }
  .container { padding-left: 0.85rem; padding-right: 0.85rem; }
  body.page-dashboard .app-main { padding-top: 0; }
}

@media (min-width: 992px) {
  .mobile-header, .mobile-bottom-nav, .mobile-content-spacer { display: none !important; }
}

@media (max-width: 575.98px) {
  :root { --mobile-nav: 74px; }
  .mobile-header { height: 50px; }
  .mobile-brand { font-size: 0.9rem; }
  .mobile-bottom-nav { padding-left: 0.65rem; padding-right: 0.65rem; }
  .mobile-bottom-nav-inner { padding: 0.35rem 0.4rem; border-radius: 1.1rem; }
  .mobile-nav-icon { width: 2.25rem; height: 1.85rem; font-size: 1.1rem; }
  .mobile-nav-label { font-size: 0.58rem; }
  body {
    padding-top: var(--mobile-header);
    padding-bottom: var(--mobile-nav);
  }
}

.dashboard-bg {
  background: transparent !important;
  padding-top: 0 !important;
}
