html {
  font-size: 12px;
  overflow-x: hidden;
  width: 100%;
  font-family: 'Roboto', sans-serif;
}

@media (min-width: 768px) {
  html {
    font-size: 14px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

    body {
      margin: 0;
      padding: 0;
      overflow-x: hidden;
      width: 100%;
      position: relative;
      font-family: 'Roboto', sans-serif;
    }

    /* Button Spinner */
    .btn-spinner {
      display: inline-block;
      width: 1rem;
      height: 1rem;
      border: 2px solid currentColor;
      border-right-color: transparent;
      border-radius: 50%;
      animation: spinner-rotate 0.75s linear infinite;
      margin-right: 0.5rem;
      vertical-align: middle;
    }

    .btn-spinner.hidden {
      display: none;
    }

    @keyframes spinner-rotate {
      to {
        transform: rotate(360deg);
      }
    }

    .btn:disabled {
      opacity: 0.65;
      cursor: not-allowed;
    }

.footer {
  position: relative;
  width: 100%;
  white-space: nowrap;
}

/* Sidebar và Content co giãn cùng nhau - Giống AdminPanel */
body {
  display: flex;
  overflow-x: hidden;
}

.sidebar {
  transition: width 0.3s ease, transform 0.3s ease;
  width: 256px;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

/* Đảm bảo sidebar-nav có thể scroll */
.sidebar .sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Đảm bảo simplebar hoạt động */
.sidebar .sidebar-nav[data-simplebar] {
  height: auto;
  flex: 1;
}

/* Custom scrollbar cho sidebar - Webkit browsers (Chrome, Safari, Edge) */
.sidebar .sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar .sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar .sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  transition: background 0.2s ease;
}

.sidebar .sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* Custom scrollbar cho sidebar - Firefox */
.sidebar .sidebar-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

.sidebar.sidebar-narrow,
.sidebar.sidebar-unfoldable {
  width: 64px;
}

/* Sidebar brand text */
#sidebar-brand-text {
  transition: opacity 0.3s ease, width 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  display: inline-block;
}

#sidebar-brand-short {
  transition: opacity 0.3s ease;
  white-space: nowrap;
  display: none;
  font-size: 1.25rem;
  font-weight: 600;
}

.sidebar.sidebar-narrow #sidebar-brand-text,
.sidebar.sidebar-unfoldable #sidebar-brand-text {
  opacity: 0;
  width: 0;
  display: none;
}

.sidebar.sidebar-narrow #sidebar-brand-short,
.sidebar.sidebar-unfoldable #sidebar-brand-short {
  display: inline-block !important;
  opacity: 1;
}

/* Nav title ẩn khi sidebar thu nhỏ */
.sidebar.sidebar-narrow .nav-title,
.sidebar.sidebar-unfoldable .nav-title {
  display: none !important;
}

/* Wrapper transition - không dùng margin-left, dùng flex */
.wrapper {
  transition: margin-left 0.3s ease;
  margin-left: 256px;
  width: calc(100% - 256px);
  min-width: 0;
  overflow-x: hidden;
}

.sidebar.sidebar-narrow ~ .wrapper,
.sidebar.sidebar-unfoldable ~ .wrapper {
  margin-left: 64px;
  width: calc(100% - 64px);
}

/* Đảm bảo content area điều chỉnh khi sidebar thay đổi */
#main-content {
  transition: all 0.3s ease;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* Header transition */
.header {
  transition: margin-left 0.3s ease;
  width: 100%;
  max-width: 100%;
  overflow: visible !important;
  position: relative;
  z-index: 100;
}

/* Header container fluid - cho phép overflow */
.header .container-fluid {
  max-width: 100%;
  overflow: visible !important;
  position: relative;
}

/* Header nav dropdown - hiển thị ra ngoài header */
.header-nav {
  position: relative;
  overflow: visible !important;
}

.header-nav .nav-item {
  overflow: visible !important;
}

.header-nav .dropdown {
  position: static;
  overflow: visible !important;
}

.header-nav .dropdown-menu {
  position: absolute !important;
  top: 100% !important;
  right: 0 !important;
  left: auto !important;
  margin-top: 0.125rem;
  z-index: 1050;
  min-width: 280px;
  transform: none !important;
}

/* Mobile - Full width dropdown với padding */
@media (max-width: 767.98px) {
  .header-nav .dropdown-menu {
    position: fixed !important;
    top: auto !important;
    right: 1rem !important;
    left: 1rem !important;
    width: calc(100% - 2rem) !important;
    min-width: calc(100% - 2rem) !important;
    margin-top: 0;
    transform: none !important;
  }
}

/* Container fluid không vượt quá */
.container-fluid {
  max-width: 100%;
  overflow: visible !important;
}


/* Responsive cho mobile */
@media (max-width: 991.98px) {
  /* Ẩn sidebar trên mobile */
  .sidebar {
    display: none !important;
  }
  
  .wrapper {
    margin-left: 0 !important;
    width: 100% !important;
  }
  
  /* Mobile menu dropdown */
  .mobile-menu-dropdown {
    position: fixed !important;
    top: 56px !important;
    left: 0.5rem !important;
    right: 0.5rem !important;
    width: calc(100% - 1rem) !important;
    max-width: calc(100% - 1rem) !important;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.25rem !important;
    margin-top: 0.5rem !important;
    transform: none !important;
    z-index: 1060 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 0 !important;
    pointer-events: auto !important;
    position: relative;
  }
  
  /* Chặn scroll body khi menu mobile mở */
  body.mobile-menu-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
  }
  
  .mobile-menu-dropdown .dropdown-item {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }
  
  .mobile-menu-dropdown .dropdown-item i {
    width: 20px;
    text-align: center;
  }
  
  .mobile-menu-dropdown .dropdown-header {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6c757d;
  }
  
  .mobile-menu-dropdown .dropdown-header small {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }
}

/* Active nav link */
.sidebar-nav .nav-link.active {
  background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-nav .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* User profile dropdown header styling */
.header-nav .dropdown-header {
  padding: 0.75rem 1rem !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.header-nav .dropdown-header .fw-semibold {
  font-size: 0.95rem;
  color: #212529;
  margin-bottom: 0.25rem;
}

.header-nav .dropdown-header .small {
  font-size: 0.85rem;
  color: #6c757d;
  line-height: 1.4;
}

.header-nav .dropdown-header .badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.25rem 0.5rem;
}

/* Override primary color to green */
:root {
  --cui-primary: #28a745;
  --cui-primary-rgb: 40, 167, 69;
  --cui-primary-text-emphasis: #1e7e34;
  --cui-primary-bg-subtle: #d4edda;
  --cui-primary-border-subtle: #c3e6cb;
}

.btn-primary {
  --cui-btn-bg: #28a745;
  --cui-btn-border-color: #28a745;
  --cui-btn-hover-bg: #218838;
  --cui-btn-hover-border-color: #1e7e34;
  --cui-btn-focus-shadow-rgb: 40, 167, 69;
  --cui-btn-active-bg: #1e7e34;
  --cui-btn-active-border-color: #1c7430;
  --cui-btn-disabled-bg: #28a745;
  --cui-btn-disabled-border-color: #28a745;
  background-color: #28a745;
  border-color: #28a745;
}

.btn-primary:hover {
  background-color: #218838;
  border-color: #1e7e34;
}

.btn-primary:focus {
  box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.5);
}

.btn-primary:active,
.btn-primary.active {
  background-color: #1e7e34;
  border-color: #1c7430;
}

.bg-primary {
  background-color: #28a745 !important;
}

.text-primary {
  color: #28a745 !important;
}

.border-primary {
  border-color: #28a745 !important;
}

.badge.bg-primary {
  background-color: #28a745 !important;
}

.alert-primary {
  --cui-alert-color: #0f5132;
  --cui-alert-bg: #d1e7dd;
  --cui-alert-border-color: #badbcc;
  --cui-alert-link-color: #0c4128;
}

/* Focus states */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem rgba(40, 167, 69, 0.5);
}

/* Link primary */
a.text-primary:hover,
a.text-primary:focus {
  color: #218838 !important;
}

/* Nav link active */
.nav-link.active {
  color: #28a745 !important;
}

/* Toastr success color (already green, but ensure consistency) */
.toast-success {
  background-color: #28a745 !important;
}

/* Apply Roboto font to all elements */
* {
  font-family: 'Roboto', sans-serif;
}

/* Ensure form controls use Roboto */
input, textarea, select, button {
  font-family: 'Roboto', sans-serif;
}

/* Language dropdown - width 100% */
.header-nav .nav-item .dropdown-menu {
  min-width: 100%;
  width: 100%;
}

.header-nav .nav-item .dropdown-menu form {
  width: 100%;
  display: block;
}

.header-nav .nav-item .dropdown-menu .dropdown-item {
  width: 100%;
  text-align: left;
  padding: 0.5rem 1rem;
}

