/* ===== SIPPB modern theme — Gojek-inspired ===== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --brand: #00AA5B;
  --brand-dark: #00873F;
  --brand-light: #E6F8EE;
  --brand-soft: #F1FBF5;
  --ink: #1A1D1F;
  --muted: #6C7275;
  --border: #E7E9EB;
  --bg: #F6F8F7;
  --danger: #FF3B30;
  --warning: #FFB020;
  --info: #2F80ED;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.12);
  --sidebar-w: 264px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 0.94rem;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }

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

/* ===== App shell: sidebar + topbar ===== */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 1040;
  transition: transform .25s ease;
}

.app-sidebar .brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1.4rem 1.4rem 1rem;
  font-weight: 800; font-size: 1.15rem; color: var(--ink);
}
.app-sidebar .brand .brand-subtitle {
  font-size: .62rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .02em; line-height: 1.2;
}
.app-sidebar .brand .brand-logo-img {
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  box-shadow: 0 0 0 2px var(--brand-light);
}

.app-sidebar nav { flex: 1; overflow-y: auto; padding: .5rem .9rem 1rem; }

.app-sidebar .nav-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem .9rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 600;
  font-size: .89rem;
  margin-bottom: .15rem;
  transition: background .15s ease, color .15s ease;
}
.app-sidebar .nav-link i { width: 18px; text-align: center; font-size: .95rem; }
.app-sidebar .nav-link:hover { background: var(--brand-soft); color: var(--brand-dark); }
.app-sidebar .nav-link.active { background: var(--brand-light); color: var(--brand-dark); }

.app-sidebar .sidebar-section-label {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
  color: #A6ABAE; font-weight: 700; padding: 1rem .9rem .35rem;
}

.app-main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: .85rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  position: sticky; top: 0; z-index: 1020;
}

.app-topbar .sidebar-toggle {
  display: inline-flex;
  border: none; background: var(--bg); border-radius: var(--radius-sm);
  width: 40px; height: 40px; align-items: center; justify-content: center;
  color: var(--ink); font-size: 1.1rem;
}

html.sidebar-collapsed .app-sidebar { transform: translateX(-100%); }
html.sidebar-collapsed .app-main { margin-left: 0; }

.user-chip {
  display: flex; align-items: center; gap: .6rem;
  padding: .35rem .6rem .35rem .35rem;
  border-radius: 999px; background: var(--bg);
}
.user-chip .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem;
}
.user-chip .role-badge {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  color: var(--brand-dark); background: var(--brand-light);
  padding: .1rem .5rem; border-radius: 999px;
}

.app-content { padding: 1.5rem; flex: 1; }

.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1030;
}

@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .app-sidebar.show { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .app-topbar .sidebar-toggle { display: inline-flex; }
  .sidebar-backdrop.show { display: block; }
}

/* ===== Cards ===== */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.card-header {
  background: #fff; border-bottom: 1px solid var(--border);
  font-weight: 700; border-top-left-radius: var(--radius-md) !important; border-top-right-radius: var(--radius-md) !important;
  padding: 1rem 1.25rem;
}
.card-body { padding: 1.25rem; }

/* Summary stat cards */
.stat-card {
  border-radius: var(--radius-lg);
  border: none;
  color: #fff;
  overflow: hidden;
  position: relative;
  padding: 1.35rem 1.5rem;
  min-height: 118px;
  box-shadow: var(--shadow-md);
  transition: transform .18s ease, box-shadow .18s ease;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card::after {
  content: '';
  position: absolute;
  width: 130px; height: 130px;
  right: -35px; top: -45px;
  background: rgba(255, 255, 255, .12);
  border-radius: 50%;
}
.stat-card .stat-icon {
  position: absolute; top: 1.1rem; right: 1.2rem;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; z-index: 1;
}
.stat-card .stat-label {
  position: relative; z-index: 1;
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; opacity: .92; margin-bottom: .55rem;
}
.stat-card .stat-value {
  position: relative; z-index: 1;
  font-size: 2.1rem; font-weight: 800; line-height: 1;
}
.stat-card-primary { background: linear-gradient(135deg, var(--brand), var(--brand-dark)); }
.stat-card-warning { background: linear-gradient(135deg, #FFC24B, #FF9F1C); }
.stat-card-info { background: linear-gradient(135deg, #4FC3F7, #2F80ED); }
.stat-card-danger { background: linear-gradient(135deg, #FF6B6B, #E63946); }

/* ===== Buttons ===== */
.btn { border-radius: var(--radius-sm); font-weight: 600; padding: .5rem 1.1rem; }
.btn-sm { border-radius: 8px; padding: .3rem .7rem; }
.btn-primary { background: var(--brand); border-color: var(--brand); }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover { background: var(--brand); border-color: var(--brand); }
.btn-outline-secondary { border-color: var(--border); color: var(--muted); }

/* ===== Forms ===== */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border-color: var(--border);
  padding: .55rem .85rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.form-label { font-weight: 600; font-size: .85rem; color: var(--ink); }

/* ===== Tables ===== */
.table { font-size: .89rem; }
.table thead.table-dark th { background: var(--ink); color: #fff; border: none; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.table > :not(caption) > * > * { padding: .7rem .85rem; }
.table-hover tbody tr:hover { background: var(--brand-soft); }

/* ===== Badges ===== */
.badge { border-radius: 999px; font-weight: 600; padding: .4em .75em; font-size: .74rem; }

/* ===== Alerts ===== */
.alert { border: none; border-radius: var(--radius-sm); font-weight: 500; }
.alert-success { background: var(--brand-light); color: var(--brand-dark); }

/* ===== Login / guest pages ===== */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 45%, #063 100%);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
.auth-wrapper::before,
.auth-wrapper::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  pointer-events: none;
}
.auth-wrapper::before { width: 460px; height: 460px; top: -160px; left: -140px; }
.auth-wrapper::after { width: 340px; height: 340px; bottom: -140px; right: -100px; background: rgba(255, 255, 255, .06); }
.auth-card {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 2.25rem; width: 100%; max-width: 420px;
  position: relative; z-index: 1;
}
.auth-card .auth-logo-img {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
  display: block; margin: 0 auto 1rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
.auth-input-group .input-group-text {
  background: var(--bg); border-color: var(--border); border-right: none;
  border-top-left-radius: var(--radius-sm); border-bottom-left-radius: var(--radius-sm);
  color: var(--muted); width: 42px; justify-content: center;
}
.auth-input-group .form-control {
  border-left: none; padding-left: .4rem;
}
.auth-input-group .form-control:focus { z-index: 3; }
.auth-input-group.focused .input-group-text { border-color: var(--brand); }
.auth-toggle-password {
  background: #fff; border-color: var(--border); border-left: none; color: var(--muted);
}
.auth-toggle-password:hover { color: var(--ink); background: #fff; }
.auth-divider {
  display: flex; align-items: center; justify-content: center; gap: .85rem;
  color: var(--muted); font-size: .74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  margin: 1.4rem 0 1.25rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1 1 0; max-width: 130px; height: 1px; background: var(--border);
}

/* ===== Misc ===== */
.text-brand { color: var(--brand) !important; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #D5D9DB; border-radius: 999px; }

/* ===== Rich text editor (Quill) ===== */
.rich-editor-container { background: #fff; border-radius: var(--radius-sm); }
.rich-editor-container .ql-toolbar {
  border-color: var(--border);
  border-top-left-radius: var(--radius-sm); border-top-right-radius: var(--radius-sm);
  background: var(--bg);
}
.rich-editor-container .ql-container {
  border-color: var(--border);
  border-bottom-left-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm);
  min-height: 220px; font-size: .94rem; font-family: inherit;
}
.rich-editor-container .ql-editor { min-height: 220px; }

/* ===== Select2 (searchable dropdowns) ===== */
.select2-container--bootstrap-5 .select2-selection {
  border-radius: var(--radius-sm) !important;
  border-color: var(--border) !important;
  min-height: 44px !important;
  padding: .25rem .3rem !important;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5 .select2-selection:focus,
.select2-container--bootstrap-5 .select2-selection--single:focus {
  border-color: var(--brand) !important;
  box-shadow: 0 0 0 .2rem var(--brand-light) !important;
}
.select2-container--bootstrap-5 .select2-selection__rendered {
  padding: 0 !important;
  display: flex; flex-wrap: wrap; gap: .4rem;
  align-items: center;
}
.select2-container--bootstrap-5 .select2-selection__choice {
  background: var(--brand-light) !important;
  border: none !important;
  color: var(--brand-dark) !important;
  border-radius: var(--radius-md) !important;
  padding: .5rem .6rem .5rem .9rem !important;
  margin: 0 !important;
  font-size: .84rem; font-weight: 600;
  line-height: 1.4;
  display: flex; align-items: flex-start; gap: .5rem;
  max-width: 100%;
  width: 100%;
}
.select2-container--bootstrap-5 .select2-selection__choice__display {
  padding: .1rem 0 0 !important;
  white-space: normal;
  word-break: break-word;
  flex: 1;
}
.select2-container--bootstrap-5 .select2-selection__choice__remove {
  color: var(--brand-dark) !important;
  background: transparent !important;
  border: none !important;
  border-radius: 50% !important;
  order: 2;
  width: 18px; height: 18px; flex: 0 0 18px;
  display: flex !important; align-items: center; justify-content: center;
  font-size: 1rem;
  line-height: 1;
}
.select2-container--bootstrap-5 .select2-selection__choice__remove:hover {
  color: #fff !important;
  background: var(--danger) !important;
}
.select2-container--bootstrap-5 .select2-search--inline .select2-search__field {
  font-family: inherit; margin-top: .2rem !important;
}
.select2-dropdown {
  border-radius: var(--radius-sm) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.select2-container--bootstrap-5 .select2-results__option--highlighted[aria-selected] {
  background-color: var(--brand) !important;
}
.select2-container--bootstrap-5 .select2-results__option--selected {
  background-color: var(--brand-soft) !important;
}

/* Make the searchable nature of select2 fields visually obvious (magnifying glass) */
.select2-container--bootstrap-5 .select2-selection--single {
  position: relative;
  padding-left: 2.3rem !important;
}
.select2-container--bootstrap-5 .select2-selection--single::before {
  content: '\f002';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  left: .9rem; top: 14px;
  color: var(--muted);
  font-size: .85rem;
  pointer-events: none;
  z-index: 1;
}
.select2-container--bootstrap-5 .select2-selection--multiple {
  padding-left: .5rem !important;
}
.select2-container--bootstrap-5 .select2-search--inline {
  position: relative;
}
.select2-container--bootstrap-5 .select2-search--inline::before {
  content: '\f002';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: var(--muted);
  font-size: .8rem;
  margin-right: .5rem;
  align-self: center;
}
.select2-container--bootstrap-5 .select2-search--dropdown .select2-search__field {
  border-radius: var(--radius-sm) !important;
  border-color: var(--border) !important;
}

/* ===== Rank history timeline (Praja profile) ===== */
.rank-timeline {
  position: relative;
  padding-left: 2.75rem;
}
.rank-timeline::before {
  content: '';
  position: absolute;
  left: 1.1rem; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--border);
}
.rank-timeline-item {
  position: relative;
  padding-bottom: 1.1rem;
}
.rank-timeline-item:last-child { padding-bottom: 0; }
.rank-timeline-dot {
  position: absolute;
  left: -2.2rem; top: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .72rem;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--border);
}
.rank-timeline-content {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: .65rem .9rem;
}
