/* =========================================================
   1. VARIABLES & RESET
   ========================================================= */
:root {
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
  --topbar-height: 64px;
  --bg-topbar: #ffffff;
  --bg-sidebar: #1e293b;            /* Bright Navy Slate */
  --bg-menu-hover: #334155;         /* Lighter Navy */
  --bg-menu-active: #e06d3b;        /* Orange Dop */
  --text-topbar: #0f172a;
  --text-sidebar: #cbd5e1;
  --text-sidebar-hover: #ffffff;
  --border-color: #e2e8f0;
  --accent-color: #e06d3b;
}

* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
  font-family: 'Plus Jakarta Sans', sans-serif; 
}

body { 
  background-color: #f8fafc; 
  color: #334155; 
  overflow-x: hidden; 
}

/* =========================================================
   2. TOPBAR STYLING
   ========================================================= */
.topbar {
  position: fixed; 
  top: 0; 
  left: 0; 
  right: 0; 
  height: var(--topbar-height);
  background: var(--bg-topbar); 
  border-bottom: 1px solid var(--border-color);
  display: flex; 
  align-items: center; 
  justify-content: space-between;
  padding: 0 20px; 
  z-index: 1000; 
  transition: all 0.3s ease;
}

.topbar-left { 
  display: flex; 
  align-items: center; 
  gap: 15px; 
}

.btn-toggle { 
  background: none; 
  border: none; 
  font-size: 1.25rem; 
  color: #64748b; 
  cursor: pointer; 
  padding: 5px; 
}

.brand-logo { 
  font-size: 1.2rem; 
  font-weight: 700; 
  color: #0f172a; 
  display: flex; 
  align-items: center; 
  gap: 8px; 
}

.badge-mode { 
  background: #ef4444; 
  color: #fff; 
  font-size: 0.7rem; 
  padding: 4px 8px; 
  border-radius: 6px; 
  font-weight: 600; 
}

.search-bar { 
  position: relative; 
  width: 320px; 
}

.search-bar input {
  width: 100%; 
  padding: 8px 12px 8px 36px; 
  border-radius: 8px;
  border: 1px solid var(--border-color); 
  background: #f1f5f9; 
  font-size: 0.85rem; 
  outline: none;
}

.search-bar i { 
  position: absolute; 
  left: 12px; 
  top: 50%; 
  transform: translateY(-50%); 
  color: #94a3b8; 
}

.topbar-right { 
  display: flex; 
  align-items: center; 
  gap: 16px; 
}

.btn-quick-add { 
  background: var(--accent-color); 
  color: #fff; 
  border: none; 
  border-radius: 6px; 
  width: 32px; 
  height: 32px; 
  cursor: pointer; 
}

.user-profile { 
  display: flex; 
  align-items: center; 
  gap: 10px; 
  cursor: pointer; 
}

.avatar { 
  width: 36px; 
  height: 36px; 
  border-radius: 50%; 
  background: #cbd5e1; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-weight: bold; 
  color: #1e293b; 
}

/* =========================================================
   3. SIDEBAR STYLING
   ========================================================= */
.sidebar {
  position: fixed; 
  top: var(--topbar-height); 
  left: 0; 
  bottom: 0;
  width: var(--sidebar-width); 
  background: var(--bg-sidebar);
  overflow-y: auto; 
  transition: all 0.3s ease; 
  z-index: 999;
}

body.collapsed .sidebar { 
  width: var(--sidebar-collapsed-width); 
}

.sidebar-menu { 
  list-style: none; 
  padding: 15px 0; 
}

.menu-header { 
  font-size: 0.68rem; 
  font-weight: 700; 
  color: #64748b; 
  padding: 12px 20px 6px; 
  text-transform: uppercase; 
  letter-spacing: 0.5px; 
}

body.collapsed .menu-header { 
  display: none; 
}

.menu-item { 
  position: relative; 
}

.menu-link {
  display: flex; 
  align-items: center; 
  justify-content: space-between;
  padding: 10px 20px; 
  color: var(--text-sidebar); 
  text-decoration: none;
  font-size: 0.875rem; 
  transition: all 0.2s ease; 
  cursor: pointer;
}

.menu-link:hover { 
  background: var(--bg-menu-hover); 
  color: var(--text-sidebar-hover); 
}

.menu-link.active { 
  background: var(--bg-menu-active); 
  color: #ffffff; 
  font-weight: 600; 
}

.menu-icon { 
  width: 24px; 
  font-size: 1rem; 
  text-align: center; 
  margin-right: 12px; 
}

body.collapsed .menu-text, 
body.collapsed .arrow-icon, 
body.collapsed .badge-count { 
  display: none; 
}

body.collapsed .menu-icon { 
  margin-right: 0; 
}

body.collapsed .menu-link { 
  justify-content: center; 
  padding: 12px 0; 
}

/* Submenu Accordion */
.submenu { 
  list-style: none; 
  background: #0f172a; 
  display: none; 
  padding: 5px 0; 
}

.submenu a { 
  display: block; 
  padding: 8px 20px 8px 56px; 
  color: #94a3b8; 
  text-decoration: none; 
  font-size: 0.8rem; 
}

.submenu a:hover { 
  color: #ffffff; 
}

.menu-item.open .submenu { 
  display: block; 
}

.menu-item.open .arrow-icon { 
  transform: rotate(90deg); 
}

.arrow-icon { 
  transition: transform 0.2s ease; 
  font-size: 0.75rem; 
}

.badge-count { 
  background: #ef4444; 
  color: #fff; 
  font-size: 0.7rem; 
  padding: 2px 6px; 
  border-radius: 10px; 
  font-weight: 600; 
}

.sidebar-menu a,
.sidebar-menu .menu-link {
  position: relative;
  z-index: 10;
  cursor: pointer !important;
  pointer-events: auto !important;
}

/* =========================================================
   4. CONTENT AREA & LAYOUT CONTAINER (FULL WIDTH)
   ========================================================= */
.main-content {
  margin-top: var(--topbar-height);
  margin-left: var(--sidebar-width);
  padding: 20px;
  transition: all 0.3s ease;
  min-height: calc(100vh - var(--topbar-height) - 60px);
  width: calc(100% - var(--sidebar-width)) !important;
  box-sizing: border-box;
}

.content-wrapper {
  max-width: 100% !important;
  margin: 0 auto;
  width: 100% !important;
}

/* Dashboard Grid Layout */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.card-stat {
  background: #ffffff;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.card-info h4 {
  font-size: 0.8rem;
  color: #64748b;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.card-info .number {
  font-size: 1.6rem;
  font-weight: 700;
  color: #0f172a;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.dashboard-section {
  margin-top: 20px;
  background: #ffffff;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  width: 100% !important;
  box-sizing: border-box;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

/* =========================================================
   5. BIMBINGAN KONSELING (BK) SPECIFIC STYLING
   ========================================================= */
.bk-dashboard {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

.stat-grid-bk {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card-bk {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card-bk:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px -5px rgba(0,0,0,0.08);
  border-color: #38bdf8;
}

.stat-icon-box {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.section-box-bk {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
  margin-bottom: 24px;
  width: 100% !important;
  box-sizing: border-box;
}

.form-grid-custom {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.form-group-bk {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-bk label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
}

.form-control-bk {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s;
  background: #f8fafc;
}

.form-control-bk:focus {
  background: #ffffff;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.badge-status-bk {
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-block;
}

.badge-proses { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-selesai { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }

.filter-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-btn-group {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
}

.filter-btn {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn.active {
  background: #ffffff;
  color: #0284c7;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

/* =========================================================
   6. GLOBAL TABLE STYLING (ZEBRA STRIPING & FULL WIDTH)
   ========================================================= */
.table-custom,
.table-rapat {
  width: 100% !important;
  border-collapse: collapse !important;
  font-size: 0.85rem;
}

.table-custom th,
.table-rapat th {
  background: #e2e8f0 !important;
  color: #0f172a !important;
  text-align: left;
  padding: 10px 12px !important;
  font-weight: 700 !important;
  border-bottom: 2px solid #cbd5e1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.table-custom th:hover,
.table-rapat th:hover {
  background: #cbd5e1 !important;
}

.table-custom td,
.table-rapat td {
  padding: 8px 12px !important;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle !important;
}

/* Tampilan 2 Warna Selang-Seling (Zebra Striping) */
.table-custom tbody tr:nth-child(odd),
#tableBody tr:nth-child(odd) {
  background-color: #ffffff !important;
}

.table-custom tbody tr:nth-child(even),
#tableBody tr:nth-child(even) {
  background-color: #f8fafc !important;
}

.table-custom tbody tr:hover,
#tableBody tr:hover {
  background-color: #f1f5f9 !important;
}

/* Status Badges */
.status-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-badge.danger { background: #fee2e2; color: #ef4444; }
.status-badge.warning { background: #fef3c7; color: #d97706; }
.status-badge.success { background: #dcfce7; color: #16a34a; }

/* =========================================================
   7. TABLE FOOTER & PAGINATION STYLING
   ========================================================= */
.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  font-size: 0.78rem;
  color: #64748b;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-page {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-page:hover:not(:disabled) {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.btn-page:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =========================================================
   8. MODAL POPUP STYLING
   ========================================================= */
.bk-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.bk-modal-overlay.active { 
  display: flex; 
}

.bk-modal-content {
  background: #ffffff;
  border-radius: 20px;
  width: 90%;
  max-width: 600px;
  padding: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  animation: modalIn 0.2s ease-out;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* =========================================================
   9. FOOTER STYLING
   ========================================================= */
.main-footer {
  margin-left: var(--sidebar-width);
  padding: 15px 25px;
  background: #ffffff;
  border-top: 1px solid var(--border-color);
  color: #64748b;
  font-size: 0.8rem;
  transition: all 0.3s ease;
}

.main-footer .footer-content {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge-version {
  background: #f1f5f9;
  color: #475569;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* =========================================================
   10. RESPONSIVE & SIDEBAR COLLAPSED ADJUSTMENTS
   ========================================================= */
body.collapsed .main-content,
.app-container.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed-width) !important;
  width: calc(100% - var(--sidebar-collapsed-width)) !important;
}

body.collapsed .main-footer,
.app-container.sidebar-collapsed .main-footer {
  margin-left: var(--sidebar-collapsed-width) !important;
}

body.collapsed .content-wrapper,
.app-container.sidebar-collapsed .content-wrapper {
  max-width: 100% !important;
}

.app-container.sidebar-collapsed .sidebar,
aside.collapsed,
aside.hide {
  display: none !important;
}

.sidebar.is-closed + .main-content,
.app-container.sidebar-collapsed .main-content.full-width {
  margin-left: 0 !important;
  width: 100% !important;
}
