/* ===================================================================
   BUTTON UTAMA
=================================================================== */
.btn-primary-custom {
  background-color: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}
.btn-primary-custom:hover {
  background-color: #020617;
  border-color: #020617;
}

/* ===================================================================
   CARD
=================================================================== */
.card {
  border-radius: 10px;
}

/* ===================================================================
   FORM
=================================================================== */
.form-control {
  border-radius: 6px;
  font-size: 1rem;
}
.form-label {
  color: #0f172a;
  font-weight: 500;
}

/* ===================================================================
   LOGIN PAGE
=================================================================== */
.auth-page {
  background-color: #ffffff;
}

/* ===================================================================
   GLOBAL
=================================================================== */
:root {
  --primary-dark: #0f172a;
  --sidebar-width: 260px;
  --topbar-height: 52px;
  --transition: 0.3s ease;
}

body {
  background-color: #f8fafc;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.text-muted {
  font-size: 1rem;
}

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===================================================================
   SIDEBAR
=================================================================== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: #0f172a;
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform var(--transition);
  transform: translateX(0);
}

.sidebar-header {
  padding: 1.2rem;
  font-size: 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  min-height: var(--topbar-height);
}

/* Tombol X di dalam sidebar (khusus mobile) */
.btn-sidebar-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.2s, background 0.2s;
}
.btn-sidebar-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
  list-style: none;
  margin: 0;
}
.sidebar-menu::-webkit-scrollbar { width: 4px; }
.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
}

.sidebar-menu li {
  margin-bottom: 0.25rem;
}

.sidebar-menu a {
  display: block;
  padding: 0.5rem 0.85rem;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: background 0.15s, color 0.15s;
  margin: 0 0.5rem;
}
.sidebar-menu a:hover {
  background-color: rgba(255,255,255,0.08);
  color: #fff;
}
.sidebar-menu a.active {
  background-color: #3b82f6;
  color: #fff;
  font-weight: 500;
}
.sidebar-menu a.active:hover {
  background-color: #2563eb;
}

.menu-title {
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 0 1.2rem;
}

/* Submenu */
.submenu {
  list-style: none;
  padding: 0;
  margin: 0;
}
.submenu a {
  padding-left: 2rem;
  font-size: 0.9rem;
}
.submenu a.active {
  background-color: rgba(59,130,246,0.15);
  color: #93c5fd;
  border-left: 3px solid #3b82f6;
  padding-left: calc(2rem - 3px);
}

/* ===================================================================
   SIDEBAR FOOTER
=================================================================== */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  background-color: #020617;
}
.user-info strong {
  display: block;
  color: #f1f5f9;
  font-size: 0.9rem;
}
.user-info small {
  display: block;
  color: #94a3b8;
  font-size: 0.8rem;
}

/* ===================================================================
   OVERLAY (aktif saat sidebar terbuka di mobile)
=================================================================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1030;
  backdrop-filter: blur(1px);
}
.sidebar-overlay.show {
  display: block;
}

/* ===================================================================
   TOPBAR
=================================================================== */
.topbar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0 1.25rem;
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.topbar-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-dark);
}

/* ── Tombol Hamburger ── */
.btn-sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  transition: background 0.2s;
}
.btn-sidebar-toggle:hover {
  background: #f1f5f9;
}

/* Tiga garis */
.btn-sidebar-toggle .bar {
  display: block;
  width: 20px;
  height: 2px;
  background: #0f172a;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease, width 0.3s ease;
  transform-origin: center;
}

/* Desktop: hamburger → X saat sidebar collapse */
body.sidebar-collapsed .btn-sidebar-toggle .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
body.sidebar-collapsed .btn-sidebar-toggle .bar:nth-child(2) {
  opacity: 0;
  width: 0;
}
body.sidebar-collapsed .btn-sidebar-toggle .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile: hamburger → X saat sidebar terbuka */
body.sidebar-open .btn-sidebar-toggle .bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
body.sidebar-open .btn-sidebar-toggle .bar:nth-child(2) {
  opacity: 0;
  width: 0;
}
body.sidebar-open .btn-sidebar-toggle .bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===================================================================
   MAIN CONTENT
=================================================================== */
.main-content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition), width var(--transition);
}

.main-content > *:not(.topbar) {
  padding: 1.5rem;
}

/* ===================================================================
   DESKTOP — SIDEBAR COLLAPSED
=================================================================== */
body.sidebar-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-width)));
}
body.sidebar-collapsed .main-content {
  margin-left: 0;
  width: 100%;
}

/* ===================================================================
   DASHBOARD CARD
=================================================================== */
.dashboard-card {
  transition: all .2s ease;
}
.dashboard-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 .5rem 1rem rgba(0,0,0,.08);
}

.chart-wrapper {
  height: 280px;
  width: 100%;
}

/* ===================================================================
   PAGE TITLE
=================================================================== */
.page-title {
  font-weight: 600;
  color: var(--primary-dark);
}

/* ===================================================================
   CARD SYSTEM
=================================================================== */
.card-system {
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.04);
}

/* ===================================================================
   TABLE SYSTEM
=================================================================== */
.table-system thead {
  background-color: #f1f5f9;
}
.table-system th {
  font-weight: 600;
  color: var(--primary-dark);
}

/* ===================================================================
   BADGE
=================================================================== */
.badge-role {
  background-color: var(--primary-dark);
  color: #fff;
  font-weight: 500;
  padding: 5px 10px;
}

/* ===================================================================
   BUTTON PRIMARY
=================================================================== */
.btn-primary {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
}
.btn-primary:hover {
  background-color: #020617;
}

/* ===================================================================
   RESPONSIVE — TABLET (max 992px)
=================================================================== */
@media (max-width: 992px) {
  :root {
    --sidebar-width: 230px;
  }

  .chart-wrapper {
    height: 240px;
  }
}

/* ===================================================================
   RESPONSIVE — MOBILE (max 768px)
=================================================================== */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 260px;
  }

  /* Sidebar selalu tersembunyi di mobile */
  .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

  /* Muncul saat body.sidebar-open */
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  /* Overlay aktif */
  body.sidebar-open .sidebar-overlay {
    display: block;
  }

  /* Main content selalu full di mobile */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }

  body.sidebar-collapsed .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }
  body.sidebar-collapsed .main-content {
    margin-left: 0;
    width: 100%;
  }

  .main-content > *:not(.topbar) {
    padding: 1rem;
  }

  .page-title { font-size: 1.1rem; }
  .dashboard-card { margin-bottom: 1rem; }
  .chart-wrapper { height: 200px; }
  .table-system { font-size: 0.875rem; }
  .table-responsive { border-radius: 8px; overflow: hidden; }
  .btn-mobile-full { width: 100%; }
  .card-system .card-body { padding: 1rem; }
  .form-label { font-size: 0.9rem; }
  .form-control { font-size: 0.95rem; }
}

/* ===================================================================
   RESPONSIVE — SMARTPHONE KECIL (max 576px)
=================================================================== */
@media (max-width: 576px) {
  .main-content > *:not(.topbar) { padding: 0.75rem; }
  .card-body { padding: 1rem; }
  .card-system .card-body { padding: 0.875rem; }
  .page-title { font-size: 1rem; }
  .chart-wrapper { height: 180px; }
  .badge-role { font-size: 0.75rem; padding: 3px 8px; }

  .btn-group-mobile > .btn,
  .action-buttons > .btn {
    display: block;
    width: 100%;
    margin-bottom: 0.4rem;
  }

  .text-muted { font-size: 0.875rem; }
  .table-system { font-size: 0.8rem; }
  .table-system th,
  .table-system td { padding: 0.4rem 0.5rem; }
  .sidebar-header { padding: 1rem; font-size: 0.95rem; }
}

/* ===================================================================
   LANDSCAPE MOBILE
=================================================================== */
@media (max-width: 768px) and (orientation: landscape) {
  .chart-wrapper { height: 160px; }
}


/* ===================================================================
   AUTH / LOGIN PAGE
=================================================================== */

/* Body login */
.auth-page {
  background-color: #f1f5f9;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Wrapper: full height, tengah */
.auth-page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
}

/* Card login */
.auth-box {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  padding: 2.25rem 2rem;
}

/* Area logo */
.auth-logo-area {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-logo-area img {
  max-height: 80px;
  width: auto;
  display: block;
  margin: 0 auto 0.75rem;
}

.auth-subtitle {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0;
}

/* Tombol login */
.btn-login {
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  border-radius: 8px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background 0.2s ease, transform 0.15s ease;
}
.btn-login:hover {
  transform: translateY(-1px);
}
.btn-login:active {
  transform: translateY(0);
}

/* Input fokus warna brand */
.auth-box .form-control:focus {
  border-color: #0f172a;
  box-shadow: 0 0 0 0.2rem rgba(15,23,42,0.1);
}

/* Footer teks */
.auth-footer-text {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.6;
  margin-bottom: 0;
}

/* ── Tablet (max 576px) ── */
@media (max-width: 576px) {
  .auth-page-wrapper {
    padding: 1rem 0.75rem;
    justify-content: flex-start;
    padding-top: 2.5rem;
  }

  .auth-box {
    max-width: 100%;
    padding: 1.75rem 1.25rem;
    border-radius: 10px;
  }

  .auth-logo-area img {
    max-height: 64px;
  }

  .auth-logo-area {
    margin-bottom: 1.25rem;
  }

  .auth-subtitle {
    font-size: 0.8rem;
  }

  .btn-login {
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
  }
}

/* ── Smartphone sangat kecil (max 360px) ── */
@media (max-width: 360px) {
  .auth-box {
    padding: 1.5rem 1rem;
  }

  .auth-logo-area img {
    max-height: 56px;
  }
}

/* ===================================================================
   FOOTER
=================================================================== */
.app-footer {
  margin-top: auto;
  padding: 1rem 1.5rem;
  font-size: 0.8rem;
  color: #94a3b8;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  text-align: center;
}

.app-footer strong {
  color: #64748b;
}

@media (max-width: 576px) {
  .app-footer {
    padding: 0.875rem 1rem;
    font-size: 0.75rem;
  }
}