/* Tenant primary color drives Bootstrap controls as well as the WowDash tokens. */
.btn-primary {
  --bs-btn-bg: var(--primary-600);
  --bs-btn-border-color: var(--primary-600);
  --bs-btn-hover-bg: var(--primary-700);
  --bs-btn-hover-border-color: var(--primary-700);
  --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
  --bs-btn-active-bg: var(--primary-800);
  --bs-btn-active-border-color: var(--primary-800);
  --bs-btn-disabled-bg: var(--primary-600);
  --bs-btn-disabled-border-color: var(--primary-600);
}

.btn-outline-primary {
  --bs-btn-color: var(--primary-600);
  --bs-btn-border-color: var(--primary-600);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--primary-600);
  --bs-btn-hover-border-color: var(--primary-600);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--primary-700);
  --bs-btn-active-border-color: var(--primary-700);
  --bs-btn-disabled-color: var(--primary-600);
  --bs-btn-disabled-border-color: var(--primary-600);
}

.bg-primary,
.badge.bg-primary,
.progress-bar {
  background-color: var(--primary-600) !important;
}

.text-primary,
.link-primary {
  color: var(--primary-600) !important;
}

.border-primary {
  border-color: var(--primary-600) !important;
}

.pagination {
  --bs-pagination-color: var(--primary-600);
  --bs-pagination-hover-color: var(--primary-700);
  --bs-pagination-hover-bg: var(--primary-50);
  --bs-pagination-hover-border-color: var(--primary-200);
  --bs-pagination-focus-color: var(--primary-700);
  --bs-pagination-focus-bg: var(--primary-50);
  --bs-pagination-focus-box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
  --bs-pagination-active-color: #fff;
  --bs-pagination-active-bg: var(--primary-600);
  --bs-pagination-active-border-color: var(--primary-600);
  --bs-pagination-disabled-color: var(--neutral-400);
  --bs-pagination-disabled-bg: transparent;
  --bs-pagination-disabled-border-color: var(--neutral-200);
  gap: 6px;
}

.pagination .page-link {
  border-radius: 8px;
  min-width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-weight: 600;
}

.pagination .page-item.active .page-link,
.pagination .page-item.active .page-link:hover {
  background-color: var(--primary-600) !important;
  border-color: var(--primary-600) !important;
  color: #fff !important;
}

.form-check-input:checked[type='radio'] {
  background-color: var(--primary-600);
  border-color: var(--primary-600);
}

/* Checkboxes: one box, aligned with its label, with a visible tick.
   The theme clears Bootstrap's check image and paints a same-color
   square in ::before, so a checked box otherwise looks empty. */
.form-check:not(.form-switch) {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 0;
  min-height: 0;
}

.form-check:not(.form-switch) .form-check-label {
  line-height: 1.35;
  cursor: pointer;
}

.form-check:not(.form-switch) .form-check-input[type='checkbox'],
input[type='checkbox']:not(.form-check-input) {
  appearance: none;
  -webkit-appearance: none;
  float: none;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid var(--neutral-400);
  border-radius: 4px;
  background-color: var(--white);
  background-image: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  cursor: pointer;
  vertical-align: middle;
}

.form-check:not(.form-switch) .form-check-input[type='checkbox']::before,
.form-check:not(.form-switch) .form-check-input[type='checkbox']::after,
input[type='checkbox']:not(.form-check-input)::before,
input[type='checkbox']:not(.form-check-input)::after {
  content: none;
}

.form-check:not(.form-switch) .form-check-input[type='checkbox']:checked,
.form-check:not(.form-switch) .form-check-input[type='checkbox']:indeterminate,
input[type='checkbox']:not(.form-check-input):checked,
input[type='checkbox']:not(.form-check-input):indeterminate {
  background-color: var(--primary-600);
  border-color: var(--primary-600);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
}

.form-check:not(.form-switch) .form-check-input[type='checkbox']:indeterminate,
input[type='checkbox']:not(.form-check-input):indeterminate {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/%3e%3c/svg%3e");
}

.form-check:not(.form-switch) .form-check-input[type='checkbox']:focus,
input[type='checkbox']:not(.form-check-input):focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.25);
}

.form-check:not(.form-switch) .form-check-input[type='checkbox']:disabled,
input[type='checkbox']:not(.form-check-input):disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.form-check:not(.form-switch) .form-check-input[type='checkbox']:disabled + .form-check-label {
  cursor: default;
}

/* Checkboxes outside a .form-check row, such as the permission grid. */
input.form-check-input[type='checkbox']:not([role='switch']) {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid var(--neutral-400);
  border-radius: 4px;
  background-color: var(--white);
  background-image: none;
  cursor: pointer;
  vertical-align: middle;
}

input.form-check-input[type='checkbox']:not([role='switch']):checked,
input.form-check-input[type='checkbox']:not([role='switch']):indeterminate {
  background-color: var(--primary-600);
  border-color: var(--primary-600);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
}

input.form-check-input[type='checkbox']:not([role='switch']):indeterminate {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/%3e%3c/svg%3e");
}

input.form-check-input[type='checkbox']:not([role='switch']):focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.25);
}

/* Switches share the checkbox ::before, which the theme hides until checked. */
.form-switch .form-check-input::before,
.form-switch .form-check-input:checked::before {
  visibility: visible;
  opacity: 1;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transform: translateY(-50%);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-400);
  box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.2);
}

.sidebar-brand-mark,
.navbar-brand-mark {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-600);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  flex: 0 0 auto;
}

.sidebar-brand-mark {
  border-radius: 12px;
}

.navbar-brand-mark {
  border-radius: 50%;
}

.sidebar-logo img.light-logo,
.sidebar-logo img.logo-icon {
  object-fit: contain;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.sidebar {
  display: flex;
  flex-direction: column;
}

.sidebar-menu-area {
  height: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.25rem 0.75rem 0.9rem;
  padding: 0.55rem 0.7rem;
  border-radius: 14px;
  background: var(--neutral-50, #f8fafc);
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--neutral-200, #e2e8f0);
}

.sidebar-user:hover {
  background: var(--primary-50, #f8fafc);
  color: inherit;
}

.sidebar-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-600);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex: 0 0 auto;
  object-fit: cover;
}

.sidebar-user-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: var(--text-secondary-light, #64748b);
  line-height: 1.3;
}

.sidebar.active .sidebar-user {
  justify-content: center;
  margin-inline: 0.5rem;
  padding: 0.45rem;
}

.sidebar.active .sidebar-user-meta {
  display: none;
}

.sidebar.active:hover .sidebar-user {
  justify-content: flex-start;
  margin-inline: 0.75rem;
  padding: 0.55rem 0.7rem;
}

.sidebar.active:hover .sidebar-user-meta {
  display: flex;
}
