:root {
  --sidebar-width: 260px;
}

html,
body {
  min-height: 100%;
}

body {
  background-color: #f8f9fa;
}

/* ==========================================================================
   APP LAYOUT & FIXED SIDEBAR
   ========================================================================== */
.app-shell {
  min-height: 100vh;
  display: flex;
  position: relative;
}

/* Fixed Sidebar Base */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  height: 100vh;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease-in-out;
}

/* Scrollable Menu */
.sidebar-menu-scroll {
  overflow-y: auto;
  overflow-x: hidden;
}

/* Custom scrollbar for sidebar */
.sidebar-menu-scroll::-webkit-scrollbar {
  width: 4px;
}
.sidebar-menu-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

/* Navigation items */
.app-sidebar .nav-link {
  font-size: 0.9rem;
  padding: 0.55rem 0.85rem;
  border-radius: 0.375rem;
}

.app-sidebar .nav-link:hover:not(.active) {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Alert Notification Sticky */
#global-alert {
  position: sticky;
  top: 56px;
  z-index: 1020;
}

/* ==========================================================================
   SELECT2 BOOTSTRAP 5 INPUT-GROUP & SIZING FIX
   ========================================================================== */
.select2-container--bootstrap-5.select2-container--sm .select2-selection,
.select2-container--bootstrap-5 .select2-selection {
  min-height: calc(1.5em + 0.5rem + 2px) !important;
  height: calc(1.5em + 0.5rem + 2px) !important;
  padding: 0.25rem 0.5rem !important;
  font-size: 0.875rem !important;
  display: flex !important;
  align-items: center !important;
  border-color: #dee2e6 !important;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
  padding-left: 0 !important;
  padding-right: 1.25rem !important;
  color: #212529 !important;
  line-height: 1.5 !important;
}

.input-group > .select2-container--bootstrap-5 {
  flex: 1 1 auto;
  width: 1% !important;
}

.input-group > .select2-container--bootstrap-5 .select2-selection {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}

.input-group .btn-sm {
  height: calc(1.5em + 0.5rem + 2px) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* ==========================================================================
   DESKTOP RESPONSIVE (>= 992px)
   ========================================================================== */
@media (min-width: 992px) {
  .app-sidebar {
    transform: translateX(0);
  }

  .app-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: margin-left 0.2s ease-in-out, width 0.2s ease-in-out;
  }

  /* Desktop Collapsed State */
  body.sidebar-collapsed .app-sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-collapsed .app-content {
    margin-left: 0;
    width: 100%;
  }

  .app-sidebar-backdrop {
    display: none !important;
  }
}

/* ==========================================================================
   TABLET & MOBILE RESPONSIVE (< 992px)
   ========================================================================== */
@media (max-width: 991.98px) {
  .app-sidebar {
    width: 260px;
    max-width: 80vw;
    height: 100dvh;
    transform: translateX(-100%);
    box-shadow: none;
    z-index: 1050;
  }

  body.sidebar-mobile-open .app-sidebar {
    transform: translateX(0);
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.4);
  }

  .app-content {
    width: 100%;
    margin-left: 0;
    min-height: 100vh;
  }

  /* Backdrop Overlay */
  .app-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1045;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
  }

  body.sidebar-mobile-open .app-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-mobile-open {
    overflow: hidden;
  }
}

/* ==========================================================================
   SELECT2 STYLE OVERRIDES (Menyesuaikan UI Border Tebal)
   ========================================================================== */
.select2-container--bootstrap-5 .select2-selection {
    border: 2px solid #000 !important;
    border-radius: 0.375rem !important;
    min-height: 2.375rem; /* Menyesuaikan tinggi default .form-control */
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: #000 !important;
    box-shadow: none !important;
}
