/* ============================================================
   Political Party Management System — style.css
   Typography: Plus Jakarta Sans + DM Sans
   Color theme: Deep navy sidebar + Crisp white content
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
  --sidebar-width: 260px;
  --sidebar-bg:    #0f172a;
  --sidebar-text:  #94a3b8;
  --sidebar-hover: rgba(255,255,255,.06);
  --sidebar-active:#3b82f6;

  --topbar-h:      64px;
  --topbar-bg:     #ffffff;
  --topbar-border: #f1f5f9;

  --body-bg:       #f8fafc;
  --card-bg:       #ffffff;
  --card-border:   #e2e8f0;
  --card-radius:   14px;

  --primary:       #3b82f6;
  --primary-dark:  #2563eb;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #06b6d4;
  --purple:        #8b5cf6;
  --orange:        #f97316;
  --pink:          #ec4899;

  --text-dark:     #0f172a;
  --text-body:     #374151;
  --text-muted:    #6b7280;

  --font-main:    'Plus Jakarta Sans', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:    0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:    0 10px 40px rgba(0,0,0,.12);

  --transition:   all 0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--body-bg);
  color: var(--text-body);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

h1,h2,h3,h4,h5,h6 {
  font-family: var(--font-main);
  color: var(--text-dark);
}

a { text-decoration: none; color: var(--primary); }
a:hover { color: var(--primary-dark); }

.fw-500  { font-weight: 500; }
.fw-600  { font-weight: 600; }
.fw-700  { font-weight: 700; }
.text-pink { color: var(--pink) !important; }
.bg-pink   { background-color: var(--pink) !important; }

/* ============================================================
   LAYOUT
   ============================================================ */
.wrapper {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1000;
  transition: transform 0.3s ease;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}

.brand-name {
  display: block;
  font-family: var(--font-main);
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  letter-spacing: -.3px;
}

.brand-tag {
  display: block;
  font-size: 10px;
  color: var(--sidebar-text);
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* Sidebar user card */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

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

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--sidebar-text);
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 12px 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: rgba(148,163,184,.5);
  padding: 14px 8px 4px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.nav-item.active {
  background: rgba(59,130,246,.15);
  color: #93c5fd;
}

.nav-item i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-logout:hover {
  background: rgba(239,68,68,.15) !important;
  color: #fca5a5 !important;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 999;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: var(--transition);
}
.topbar-toggle:hover { background: #f1f5f9; color: var(--text-dark); }

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.breadcrumb-home { color: var(--primary); }
.breadcrumb-sep  { color: #d1d5db; }
.breadcrumb-link { color: var(--primary); }
.breadcrumb-current { color: var(--text-dark); font-weight: 500; }

.topbar-icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
  transition: var(--transition);
  background: none;
}
.topbar-icon-btn:hover { background: #f1f5f9; color: var(--text-dark); }

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 5px 14px 5px 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dark);
  cursor: pointer;
  transition: var(--transition);
}
.topbar-user-btn:hover { background: #f8fafc; }
.topbar-user-btn::after { display: none; }

.topbar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
}
.topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  flex: 1;
  padding: 28px 28px 48px;
}

.alert-flash {
  margin-bottom: 20px;
  border-radius: 10px;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-dark);
  margin: 0;
  letter-spacing: -.4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.page-actions { display: flex; gap: 8px; align-items: center; }

.badge-date {
  background: #f1f5f9;
  color: var(--text-muted);
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card-app {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header-app {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--card-border);
}

.card-title-wrap {
  display: flex;
  align-items: center;
}

.card-title-app {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.card-body-app { padding: 20px; }

.card-footer-app {
  padding: 14px 20px;
  border-top: 1px solid var(--card-border);
  background: #f8fafc;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .07;
}

.stat-blue   .stat-icon { background: rgba(59,130,246,.1);  color: var(--primary); }
.stat-green  .stat-icon { background: rgba(16,185,129,.1);  color: var(--success); }
.stat-orange .stat-icon { background: rgba(249,115,22,.1);  color: var(--orange); }
.stat-purple .stat-icon { background: rgba(139,92,246,.1);  color: var(--purple); }

.stat-blue::before   { background: var(--primary); }
.stat-green::before  { background: var(--success); }
.stat-orange::before { background: var(--orange); }
.stat-purple::before { background: var(--purple); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

.stat-value {
  font-family: var(--font-main);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-muted);
  padding-top: 8px;
  border-top: 1px solid var(--card-border);
}

/* ============================================================
   BIRTHDAY LIST
   ============================================================ */
.birthday-list {
  max-height: 420px;
  overflow-y: auto;
}

.birthday-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--card-border);
  transition: var(--transition);
}
.birthday-item:last-child { border-bottom: none; }
.birthday-item:hover { background: #f8fafc; }

.birthday-today {
  background: linear-gradient(90deg, rgba(239,68,68,.04), transparent);
  border-left: 3px solid var(--danger);
}

.birthday-avatar {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: visible;
  flex-shrink: 0;
}
.birthday-avatar img,
.birthday-avatar span {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.birthday-badge {
  position: absolute;
  bottom: -4px; right: -4px;
  font-size: 14px;
  line-height: 1;
}

.birthday-name { font-weight: 600; font-size: 13.5px; color: var(--text-dark); }
.birthday-meta { font-size: 12px; color: var(--text-muted); }
.birthday-info { flex: 1; }

.birthday-when { text-align: right; }
.bday-date { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.bday-badge-today {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .7; }
}

/* ============================================================
   TABLE
   ============================================================ */
.table-app thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--card-border);
  padding: 12px 16px;
  white-space: nowrap;
}

.table-app tbody td {
  padding: 12px 16px;
  vertical-align: middle;
  border-color: var(--card-border);
  font-size: 13.5px;
}

.table-app tbody tr:hover { background: #f8fafc; }

.table-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
}
.table-avatar img { width: 100%; height: 100%; object-fit: cover; }

.row-birthday-today    { background: rgba(239,68,68,.04) !important; }
.row-birthday-upcoming { background: rgba(245,158,11,.03) !important; }

/* ============================================================
   BADGES
   ============================================================ */
.badge-level {
  background: rgba(59,130,246,.1);
  color: var(--primary);
  font-weight: 600;
  font-size: 11px;
  padding: 4px 8px;
}

.badge-wing {
  background: rgba(139,92,246,.1);
  color: var(--purple);
  font-weight: 600;
  font-size: 11px;
  padding: 4px 8px;
}

.badge-sm { font-size: 10px; padding: 2px 6px; }

/* ============================================================
   LEVEL BAR ITEMS (dashboard)
   ============================================================ */
.level-bar-item { margin-bottom: 14px; }
.level-bar-item:last-child { margin-bottom: 0; }

.progress { border-radius: 99px; background: #f1f5f9; }
.progress-bar {
  background: linear-gradient(90deg, var(--primary), #6366f1);
  border-radius: 99px;
  transition: width .6s ease;
}

/* ============================================================
   HIERARCHY TREE
   ============================================================ */
.hierarchy-tree { font-size: 13.5px; }

.tree-node { margin-bottom: 4px; }

.tree-node-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  transition: var(--transition);
}
.tree-node-inner:hover { background: #f1f5f9; }

.tree-node-icon { width: 18px; text-align: center; }
.tree-node-name { flex: 1; font-weight: 500; }
.tree-node-count { flex-shrink: 0; }

/* ============================================================
   WING CARDS
   ============================================================ */
.wing-card { padding: 0; }

.wing-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
}

.wing-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(139,92,246,.1);
  display: flex; align-items: center; justify-content: center;
  color: var(--purple);
  font-size: 20px;
  flex-shrink: 0;
}

.wing-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.wing-desc {
  padding: 0 20px 16px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--card-border);
  padding-top: 12px;
  margin-top: -8px;
}

.btn-ghost {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.btn-ghost:hover { background: #f1f5f9; color: var(--text-dark); }

/* ============================================================
   FORMS
   ============================================================ */
.form-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-dark); }
.form-control, .form-select {
  font-size: 13.5px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  padding: 9px 12px;
  transition: var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.modal-content { border-radius: 16px; border: none; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--card-border); }
.modal-footer { border-top: 1px solid var(--card-border); }

/* Buttons */
.btn {
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 8px;
  padding: 9px 18px;
  transition: var(--transition);
}
.btn-primary  { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ============================================================
   PROFILE AVATAR
   ============================================================ */
.profile-avatar-lg {
  width: 90px; height: 90px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 26px;
}
.profile-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }

/* Photo preview */
.photo-preview-wrap {
  width: 120px; height: 120px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto;
  border: 3px solid var(--card-border);
}
.photo-preview-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 50%;
}
.photo-placeholder {
  width: 100%; height: 100%;
  background: #f1f5f9;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px;
  color: #d1d5db;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}
.empty-state i { font-size: 40px; display: block; margin-bottom: 12px; opacity: .4; }
.empty-state p { margin: 0; font-size: 14px; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body { background: #f8fafc; min-height: 100vh; font-family: var(--font-main); }

.login-page {
  display: flex;
  min-height: 100vh;
}

.login-brand-panel {
  width: 480px;
  background: linear-gradient(145deg, #0f172a 0%, #1e3a5f 100%);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 48px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.brand-pattern {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(59,130,246,.2) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139,92,246,.2) 0%, transparent 50%);
}

.login-brand-content {
  position: relative;
  z-index: 1;
  color: #fff;
  text-align: center;
}

.login-logo-wrap {
  width: 72px; height: 72px;
  border-radius: 20px;
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  color: #60a5fa;
  margin: 0 auto 28px;
}

.login-brand-content h1 {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 14px;
  letter-spacing: -.5px;
}

.login-brand-content p {
  color: rgba(255,255,255,.6);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 40px;
}

.login-stats-row {
  display: flex;
  gap: 24px;
  justify-content: center;
}

.login-stat {
  text-align: center;
  background: rgba(255,255,255,.06);
  padding: 14px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.08);
}

.stat-num {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: #60a5fa;
}

.stat-label {
  display: block;
  font-size: 11px;
  color: rgba(255,255,255,.5);
  margin-top: 2px;
}

/* Login form panel */
.login-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: #fff;
}

.login-form-inner {
  width: 100%;
  max-width: 420px;
}

.login-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 6px;
  letter-spacing: -.5px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.input-group-login .input-group-text {
  background: #f8fafc;
  border-color: #d1d5db;
  color: var(--text-muted);
  border-radius: 8px 0 0 8px;
}

.input-group-login .form-control {
  border-left: none;
  border-radius: 0;
}

.input-group-login .btn-toggle-pass {
  background: #f8fafc;
  border: 1px solid #d1d5db;
  border-left: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-login {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff;
  border: none;
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
  transition: var(--transition);
}
.btn-login:hover {
  background: linear-gradient(135deg, var(--primary-dark), #4f46e5);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,.35);
  color: #fff;
}

.mobile-logo {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 16px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .sidebar-overlay.show {
    display: block;
  }
  .main-content {
    margin-left: 0;
  }
  .login-brand-panel {
    display: none !important;
  }
  .login-form-inner {
    padding: 0 8px;
  }
}

@media (max-width: 575.98px) {
  .page-content { padding: 16px 14px 40px; }
  .page-header  { flex-direction: column; align-items: flex-start; }
  .stat-value   { font-size: 22px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
