/* ===== Base Styles ===== */
.sidebar {
  background-color: #fff;
  min-height: 100vh;
  border-right: 1px solid #dee2e6;
  position: relative;
}

.main-content {
  padding: 20px;
}

.navbar-brand {
  font-weight: 600;
}

.user-info {
  font-size: 0.9em;
}

.role-badge {
  font-size: 0.75em;
}

/* ===== Stat Cards ===== */
.card-stat {
  background: linear-gradient(135deg, #163024 0%, #2d5a42 100%);
  color: white;
}

.card-stat .card-body {
  padding: 1.5rem;
}

.stat-icon {
  font-size: 2rem;
  opacity: 0.8;
}

/* ===== Pagination ===== */
.pagination .page-item.active .page-link {
  background-color: #198754 !important;
  border-color: #198754 !important;
}

.pagination .page-link:hover {
  background-color: #f0f9f4;
  border-color: #198754;
  color: #198754;
}

/* ===== Sidebar Navigation ===== */
.sidebar .nav-link {
  color: #333;
  padding: 10px 15px;
  border-radius: 6px;
  margin-bottom: 2px;
}

.sidebar .nav-link:hover {
  background-color: #e9ecef;
}

.sidebar .nav-link.active {
  background-color: #163024;
  color: #fff;
}

.sidebar .collapse .nav-link.active {
  background-color: #2d5a42;
  color: #fff;
}

/* ===== Submenu Styles ===== */
.nav-link[data-bs-toggle="collapse"] {
  cursor: pointer;
}

.nav-link[data-bs-toggle="collapse"]:hover {
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 5px;
}

.nav-link[data-bs-toggle="collapse"] .fa-chevron-down {
  transition: transform 0.3s ease;
}

.nav-link[data-bs-toggle="collapse"][aria-expanded="true"] .fa-chevron-down {
  transform: rotate(180deg);
}

/* ===== Sidebar Toggle Button ===== */
.sidebar-toggle {
  position: absolute;
  right: -12px;
  top: 20px;
  width: 24px;
  height: 24px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: #163024;
  z-index: 10;
}

.sidebar-toggle:hover {
  background: #163024;
  color: #fff;
}

/* ===== Sidebar Collapsed State ===== */
.sidebar.collapsed {
  width: 70px !important;
  min-width: 70px !important;
  max-width: 70px !important;
  flex: 0 0 70px !important;
}

.sidebar.collapsed .nav-text,
.sidebar.collapsed h6,
.sidebar.collapsed .fa-chevron-down,
.sidebar.collapsed .collapse {
  display: none;
}

.sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 12px 8px;
}

.sidebar.collapsed .nav-link i {
  margin: 0;
}

.sidebar.collapsed .p-3 {
  padding: 0.75rem !important;
}

.sidebar.collapsed + .main-content {
  flex: 1 !important;
  max-width: calc(100% - 70px) !important;
}

/* ===== Mobile Menu Toggle Button ===== */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #163024 0%, #2d5a42 100%);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1001;
  font-size: 1.5rem;
}

/* ===== Sidebar Backdrop ===== */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  width: 100%;
  height: calc(100vh - 56px);
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.sidebar-backdrop.show {
  display: block;
}

/* ===== Mobile Styles (max-width: 991px) ===== */
@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    top: 56px;
    left: -100%;
    width: 250px;
    height: calc(100vh - 56px);
    min-height: auto;
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
  }

  .sidebar.col-md-3 {
    flex: 0 0 0;
    max-width: 0;
    padding: 0;
    margin: 0;
    overflow: visible;
  }

  .sidebar.col-md-3.show {
    width: 250px;
    max-width: 250px;
    left: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  }

  .main-content {
    padding: 15px;
    margin-left: 0 !important;
    width: 100% !important;
  }

  .main-content.col-md-9 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .navbar-brand {
    font-size: 0.9rem;
  }

  .navbar-brand i {
    font-size: 1rem;
  }

  .sidebar-toggle {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* ===== Tablet Styles (max-width: 768px) ===== */
@media (max-width: 768px) {
  .main-content {
    padding: 10px;
  }

  .card-stat .card-body {
    padding: 1rem;
  }

  .stat-icon {
    font-size: 1.5rem;
  }

  .user-info {
    font-size: 0.8em;
  }

  .role-badge {
    display: none;
  }

  h2,
  h3 {
    font-size: 1.5rem;
  }

  h4,
  h5 {
    font-size: 1.25rem;
  }

  .btn {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
  }

  .card {
    margin-bottom: 1rem;
  }

  .table {
    font-size: 0.85rem;
  }

  .table td,
  .table th {
    padding: 0.5rem;
  }
}

/* ===== Small Mobile Styles (max-width: 576px) ===== */
@media (max-width: 576px) {
  .navbar-brand {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
  }

  .main-content {
    padding: 8px;
  }

  .card-stat .card-body {
    padding: 0.75rem;
  }

  .stat-icon {
    font-size: 1.25rem;
  }

  h2 {
    font-size: 1.25rem;
  }

  .btn-sm {
    font-size: 0.75rem;
    padding: 0.375rem 0.625rem;
  }

  .table {
    font-size: 0.75rem;
  }
}
