/* CSS Variables - CJ Feed n Care Brand Colors */
:root {
  /* Primary - CJ Blue */
  --brand-primary: #0066CC;
  --brand-primary-hover: #0052A3;
  --brand-primary-light: #E6F2FF;
  
  /* CJ Red */
  --brand-red: #E63946;
  --brand-red-hover: #D62839;
  --brand-red-light: #FFE6E8;
  
  /* CJ Orange */
  --brand-orange: #FF6B35;
  --brand-orange-hover: #E55A2B;
  --brand-orange-light: #FFF4F0;
  
  /* Bootstrap overrides */
  --bs-primary: var(--brand-primary);
  --bs-primary-rgb: 0, 102, 204;
  --bs-danger: var(--brand-red);
  --bs-danger-rgb: 230, 57, 70;
  --bs-warning: var(--brand-orange);
  --bs-warning-rgb: 255, 107, 53;
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

/* Typography - System Font Stack */
body {
  margin: 0;
  padding: 0;
  background-color: #f3f4f6;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

/* Card headers */
.card-header h5,
.card-header h4,
.card-header h3 {
  font-weight: 500;
  line-height: 1.4;
}

/* Form labels */
.form-label {
  font-weight: 500;
  line-height: 1.5;
}

/* Sidebar Styles */
#sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: visible;
  transition: width 0.3s ease, transform 0.3s ease;
  z-index: 1000;
  width: 15rem;
  background-color: #f3f4f6 !important;
  border-right: 1px solid #e5e7eb;
}

#mobile-sidebar-toggle {
  display: none;
}

@media (max-width: 767.98px) {
  #mobile-sidebar-toggle {
    display: block;
  }
  
  #sidebar {
    transform: translateX(-100%);
  }
  
  #sidebar.mobile-open {
    transform: translateX(0);
  }
  
  body.sidebar-open {
    overflow: hidden;
  }
}

/* Sidebar collapse */
#sidebar.collapsed {
  width: 4rem !important;
}

#sidebar.collapsed .sidebar-title {
  display: none;
}

#sidebar.collapsed .sidebar-text {
  display: none;
}

#sidebar.collapsed .nav-item {
  justify-content: center;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

#sidebar.collapsed .nav-item i {
  margin: 0 !important;
  margin-right: 0 !important;
}

/* Sidebar header */
.sidebar-header {
  min-height: auto;
  padding: 0.5rem 1rem !important;
  background-color: #ffffff;
  border-bottom: 1px solid #e5e7eb !important;
}

.sidebar-title h1 {
  font-size: 1rem !important;
  font-weight: 500 !important;
  line-height: 1.3;
  margin-bottom: 0.125rem;
  color: #111827 !important;
}

.sidebar-title p {
  font-size: 0.75rem !important;
  line-height: 1.2;
  margin-top: 0;
  color: #6b7280 !important;
}

/* Sidebar toggle button */
#sidebar-toggle-btn {
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #ffffff;
  border: 2px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1001;
  color: #374151 !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

#sidebar-toggle-btn:hover {
  background-color: #f3f4f6;
  border-color: #d1d5db;
}

#sidebar.collapsed #sidebar-toggle-btn i {
  transform: rotate(180deg);
}

/* Sidebar text */
.sidebar-text {
  line-height: 1.5;
  font-weight: 400;
  font-size: 14px;
}

.sidebar-icon {
  width: 1.25rem;
  font-size: 1.25rem;
  flex-shrink: 0;
}

/* Sidebar logo */
.sidebar-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  object-fit: contain;
  /* Logo có nền đen và màu sắc, giữ nguyên màu gốc */
}

#sidebar.collapsed .sidebar-logo {
  width: 32px;
  height: 32px;
}

/* Sidebar navigation items */
.nav-item {
  color: #374151;
  transition: background-color 0.2s, color 0.2s;
}

.nav-item:hover {
  background-color: #e5e7eb;
  color: #111827;
}

.nav-item.active {
  background-color: var(--brand-primary);
  font-weight: 500;
  color: #ffffff !important;
}

.nav-item.active .sidebar-text {
  color: #ffffff !important;
}

.nav-item.active i {
  color: #ffffff !important;
}

.nav-item i {
  color: #6b7280;
  transition: color 0.2s;
}

.nav-item:hover i {
  color: #111827;
}

/* Main content */
.main-content {
  margin-left: 15rem;
  transition: margin-left 0.3s ease;
  min-height: 100vh;
  padding: 0;
  margin-top: 0;
}

#sidebar.collapsed ~ .main-content {
  margin-left: 4rem;
}

@media (max-width: 767.98px) {
  .main-content {
    margin-left: 0;
  }
}

/* Statistics Cards */
.stat-card {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  background-color: #ffffff;
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px 0 rgba(0, 0, 0, 0.1);
}

.stat-card-icon {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  font-size: 1.5rem;
}

.stat-card-primary .stat-card-icon {
  background-color: var(--brand-primary-light);
  color: var(--brand-primary);
}

.stat-card-success .stat-card-icon {
  background-color: #d1fae5;
  color: #10b981;
}

.stat-card-danger .stat-card-icon {
  background-color: var(--brand-red-light);
  color: var(--brand-red);
}

.stat-card-warning .stat-card-icon {
  background-color: var(--brand-orange-light);
  color: var(--brand-orange);
}

.stat-card-info .stat-card-icon {
  background-color: var(--brand-primary-light);
  color: var(--brand-primary);
}

.stat-card-secondary .stat-card-icon {
  background-color: #f3f4f6;
  color: #6b7280;
}

.stat-card-content {
  flex: 1;
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.stat-card-label {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0.25rem 0 0 0;
}

/* Container utility */
.container-fluid.p-0.m-0 {
  padding: 0 !important;
  margin: 0 !important;
}

/* Icon-only action button */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
}

/* Global icon alignment */
.bi {
  vertical-align: -0.125em;
  line-height: 1;
}

/* Table minimum height for dropdown */
.table-responsive {
  min-height: 250px;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

/* Dropdown menu z-index */
.dropdown-menu {
  z-index: 1050;
}

/* Hide validation summary when valid */
.validation-summary-valid {
  display: none !important;
}

/* Validation summary styling */
.validation-summary-errors {
  display: block;
}

.validation-summary-errors ul {
  margin-bottom: 0;
  padding-left: 1.5rem;
}

/* Focus styles */
.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;
}
