:root {
  /* dynamic colors variable */
  --brand-color: #1c6aa0; /* main brand color */
  --brand-dark: #2384c8;
  --brand-light: #5bb5ea;
  --brand-soft: #e8f3fb;
  --sidebar-bg: #0c1a2b;
  --page-bg: #f4f7fb;
  --bs-primary: #1c6aa0;
  --bs-primary-rgb: 28, 106, 160;
  --bs-link-color: #1c6aa0;
  --bs-link-color-rgb: 28, 106, 160;
  --bs-link-hover-color: #2384c8;
  --bs-link-hover-color-rgb: 35, 132, 200;
  --lte-sidebar-width: 220px;
}
body {
  font-family: "Source Sans 3", sans-serif;
  background-color: var(--page-bg);
}
a {
  text-decoration: none;
}
.text-brand {
  color: var(--brand-color);
}
/* Primary button */
.btn-primary {
  --bs-btn-bg: #1c6aa0;
  --bs-btn-border-color: #1c6aa0;
  --bs-btn-hover-bg: #2384c8;
  --bs-btn-hover-border-color: #2384c8;
  --bs-btn-active-bg: #185a8a;
  --bs-btn-active-border-color: #185a8a;
  --bs-btn-disabled-bg: #1c6aa0;
  --bs-btn-disabled-border-color: #1c6aa0;
  --bs-btn-focus-shadow-rgb: 35, 132, 200;
}
.bg-primary {
  background-color: #1c6aa0 !important;
}
.form-control:focus {
  border-color: var(--brand-light);
  box-shadow: 0 0 0 0.2rem rgba(35, 132, 200, 0.2);
}

/* ===== Sidebar ===== */
.app-sidebar {
  background-color: var(--brand-color) !important;
}
.app-sidebar .sidebar-brand {
  background-color: #185a8a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.app-sidebar .brand-link,
.app-sidebar .brand-text {
  color: #ffffff !important;
  font-weight: 600;
}
.app-sidebar .brand-icon {
  margin-right: 8px;
  font-size: 1.25rem;
}
.app-sidebar .nav-header {
  padding: 14px 16px 6px;
  font-size: 0.7rem;
  letter-spacing: 1.2px;
  color: #ffffff !important;
  font-weight: 600;
}
.app-sidebar .sidebar-menu .nav-link {
  color: #ffffff !important;
  background-color: transparent !important;
  border-radius: 8px;
  margin-bottom: 4px;
  transition: background-color 0.15s ease;
}
.app-sidebar .sidebar-menu .nav-link .nav-icon,
.app-sidebar .sidebar-menu .nav-link p {
  color: #ffffff !important;
}
.app-sidebar .sidebar-menu .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.14) !important;
}
.app-sidebar .sidebar-menu .nav-link.active {
  background-color: rgba(255, 255, 255, 0.22) !important;
  font-weight: 600;
  box-shadow: inset 3px 0 0 #ffffff;
}
/* ===== Nested menu levels ===== */
.app-sidebar .nav-treeview {
  padding-left: 10px;
}

.app-sidebar .nav-arrow {
  color: #ffffff !important;
}

/* Category row: link + small arrow button */
.app-sidebar .category-row {
  display: flex;
  align-items: center;
}

.app-sidebar .category-row .nav-link {
  flex: 1;
  min-width: 0;
}

.app-sidebar .category-arrow-toggle {
  background: transparent;
  border: 0;
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
}

.app-sidebar .category-arrow-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
}

.app-sidebar .category-arrow-toggle i {
  display: inline-block;
  transition: transform 0.2s ease;
}

.app-sidebar .category-arrow-toggle.rotate i {
  transform: rotate(180deg);
}

/* Sub-categories */
.app-sidebar .category-children {
  display: none;
  margin: 0;
  padding-left: 12px;
}

.app-sidebar .category-children.show {
  display: block;
}
/* end */

/*  Tables design */
.table thead th {
  background-color: var(--brand-soft);
  color: #185a8a;
  font-weight: 600;
  white-space: nowrap;
}

/* CRUD DESIGN */
.page-title {
  margin: 0;
  font-weight: 700;
  color: var(--brand-color);
}
.filter-card .form-label {
  margin-bottom: 4px;
  font-size: 0.9rem;
  font-weight: 600;
}
.data-table {
  --bs-table-hover-bg: #eef5fb;
}
.data-table thead th {
  background-color: #f1f3f5;
  color: #10202e;
  font-weight: 700;
  white-space: nowrap;
}
.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.pill-active {
  background: #e3f6ec;
  color: #198754;
}
.pill-inactive {
  background: #fde8e8;
  color: #dc3545;
}
.pill-main {
  background: var(--brand-soft);
  color: var(--brand-color);
}
.pill-sub {
  background: #fff3cd;
  color: #856404;
}
.btn-act {
  padding: 5px 12px;
  border: 0;
  border-radius: 6px;
  color: #ffffff !important;
  font-size: 0.85rem;
  font-weight: 600;
}
.btn-act-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.btn-act:hover {
  filter: brightness(0.9);
}
.btn-act-edit,
.btn-act-edit:hover,
.btn-act-edit:focus,
.btn-act-edit:active {
  background-color: #2e9e6b !important;
  border-color: #2e9e6b !important;
  color: #ffffff !important;
}
.btn-act-view,
.btn-act-view:hover,
.btn-act-view:focus,
.btn-act-view:active {
  background-color: var(--brand-color) !important;
  border-color: var(--brand-color) !important;
  color: #ffffff !important;
}
.btn-act-delete,
.btn-act-delete:hover,
.btn-act-delete:focus,
.btn-act-delete:active {
  background-color: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
}
.btn-act:hover {
  filter: brightness(0.88);
}

.required-field::after {
  content: " *";
  color: #c62828;
  font-weight: 700;
}

/* Inline field errors */
.field-error {
  color: #dc3545;
  font-size: 15px;
  font-weight: 500;
  margin-top: 5px;
  transition: opacity 0.4s ease;
}

.field-error.hide {
  opacity: 0;
}

.form-control.is-invalid {
  border-color: #dc3545;
}

form[enctype="multipart/form-data"] .invalid-feedback {
  display: none !important;
}

small {
  color: #807d7d;
}

select.form-control {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 40px;
  cursor: pointer;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='3 6 8 11 13 6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}
/* ===== Category tree (move to your custom admin CSS if you prefer) ===== */
.cat-name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: no-wrap;
}


.tree-toggle {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: inherit;
}
.tree-toggle:hover {
  background: rgba(0, 0, 0, 0.07);
}
.tree-toggle i {
  transition: transform 0.15s ease;
}
tr.expanded > td .tree-toggle i {
  transform: rotate(90deg);
}
.tree-spacer {
  display: inline-block;
  width: 24px;
  text-align: center;
  color: #98a2b3;
}

.table tr.cat-parent > td {
  background-color: #f8f9fb;
}
.table tr.cat-parent .cat-title {
  font-weight: 600;
}
.table tr.row-match > td:first-child {
  box-shadow: inset 3px 0 0 #f5b301;
}

.child-count {
  font-size: 11px;
  color: #667085;
  background: #eef0f3;
  padding: 2px 8px;
  border-radius: 10px;
}
.multi-tag {
  font-size: 11px;
  color: #b54708;
  background: #fff4e5;
  padding: 2px 8px;
  border-radius: 10px;
}

/* parent chips: 2 visible + "+N more" */
td.parent-cell {
  min-width: 200px;
  max-width: 260px;
}
.parent-chip {
  display: inline-block;
  background: #eef2f7;
  color: #333;
  border-radius: 12px;
  padding: 2px 10px;
  margin: 2px 4px 2px 0;
  font-size: 13px;
}
.parent-chip.chip-here {
  background: #e0efff;
  color: #175cd3;
}
.parent-cell .parent-chip.chip-extra {
  display: none;
}
.more-btn,
.less-btn {
  border: none;
  background: none;
  color: #175cd3;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
}
.more-btn:hover,
.less-btn:hover {
  text-decoration: underline;
}
.more-mobile {
  display: none;
}
.less-btn {
  display: none;
}
.parent-cell.open .parent-chip {
  display: inline-block;
}
.parent-cell.open .more-btn {
  display: none !important;
}
.parent-cell.open .less-btn {
  display: inline-block;
}

@media (max-width: 768px) {
  td.parent-cell {
    min-width: 140px;
    max-width: 180px;
  }
  .parent-cell:not(.open) .chip-2 {
    display: none;
  }
  .more-desktop {
    display: none;
  }
  .more-mobile {
    display: inline-block;
  }
}

.section-label {
  color: var(--brand-color);
  font-weight: 400;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.product-image-wrapper {
  margin-top: 2px;
}

row > * {
  margin-top: 2px !important;
}

.product-image-box {
  width: 100%;
  max-width: 550px;
  aspect-ratio: 520 / 190;
  max-height: 190px;
  border: 2px dashed #b8c6d3;
  border-radius: 8px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  overflow: visible;
  transition: 0.3s ease;
}

.product-image-box:hover {
  border-color: #005295;
  background: #f0f6fb;
}

#image-placeholder,
#category-image-placeholder {
  text-align: center;
  color: #64748b;
  padding: 10px;
}

.upload-icon {
  font-size: 35px;
  color: #005295;
  display: block;
  margin-bottom: 8px;
}

#image-placeholder p,
#category-image-placeholder p {
  font-size: 13px;
  margin: 0 0 5px;
}

#image-placeholder small,
#category-image-placeholder small {
  font-size: 11px;
}

#image-preview,
#category-image-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  border-radius: 8px;
}

/* Image Dropdown */

.image-menu-wrapper {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
}

.image-menu-button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #333;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
}

.image-dropdown {
  display: none;
  position: absolute;
  top: 36px;
  right: 0;
  width: 145px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.image-dropdown.show {
  display: block;
}

.image-dropdown button {
  width: 100%;
  padding: 10px;
  border: none;
  background: #fff;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
}

.image-dropdown button:hover {
  background: #f1f5f9;
}

#remove-image,
#category-remove-image {
  color: #dc3545;
}

.product-image-box.drag-over {
  border-color: #005295;
  background-color: #eef6fc;
  box-shadow: 0 0 0 3px rgba(0, 82, 149, 0.12);
}

@media (max-width: 768px) {
  .product-image-box {
    max-width: 100%;
    aspect-ratio: 16 / 9;
  }

  #image-placeholder p,
  #category-image-placeholder p {
    font-size: 12px;
  }

  .image-dropdown {
    width: 130px;
  }
}

@media (max-width: 480px) {
  .product-image-box {
    aspect-ratio: 4 / 3;
  }

  .upload-icon {
    font-size: 28px;
  }

  .image-menu-button {
    width: 36px; /* larger touch target */
    height: 36px;
  }

  .image-dropdown button {
    padding: 12px 10px; /* easier to tap */
  }
}

.view-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.view-stat {
  display: flex;
  flex-direction: column;
  min-width: 140px;
  padding: 14px 18px;
  background: #f4f6f9;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.view-stat-number {
  font-size: 24px;
  font-weight: 700;
  color: #0d3b7a;
}

.view-stat-label {
  font-size: 13px;
  color: #666;
}

.view-subtitle-badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #abd5ea;
  color: #24617f;
  max-width: 100%;
  overflow-wrap: anywhere; /* long names won't overflow */
  margin-bottom: 10px;
}

.view-subcategory-badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #dfcf7f;
  color: #543e05;
  max-width: 100%;
  overflow-wrap: anywhere; /* long names won't overflow */
  margin-bottom: 10px;
}

/* Status */
.status-active,
.status-inactive,
.status-incomplete {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-incomplete {
  background: #fff3cd;
  color: #856404;
}

.status-active {
  background: #d1e7dd;
  color: #0f5132;
}

.status-inactive {
  background: #f8d7da;
  color: #842029;
}

.view-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 10px;
}

.view-badges {
  display: flex;
  flex-wrap: wrap; /* correct property */
}

.view-subtitle-badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #abd5ea;
  color: #24617f;
  max-width: 100%;
  overflow-wrap: anywhere; /* long names won't overflow */
  margin-bottom: 10px;
}

.view-subcategory-badge {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #dfcf7f;
  color: #543e05;
  max-width: 100%;
  overflow-wrap: anywhere; /* long names won't overflow */
  margin-bottom: 10px;
}

@media (max-width: 768px) {
  .view-title-row {
    flex-direction: column; /* stack title above badges */
    align-items: stretch;
  }
}

.product-view-image {
  width: 100%;
  height: 280px;
  border: 1px solid #ddd;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
}

.product-view-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.no-product-image {
  color: #777;
}

.product-view-details h3 {
  color: #005295;
  margin-bottom: 20px;
}

.product-view-details p {
  margin-bottom: 14px;
  line-height: 1.6;
}

.product-view-description {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 5px;
  margin-bottom: 18px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

@media (max-width: 768px) {
  .product-view-container {
    grid-template-columns: 1fr;
  }

  .product-view-image {
    max-width: 100%;
  }
}

.view-section {
  background: #fff;
  padding: 25px;
  margin-bottom: 25px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.view-section h3 {
  margin: 0 0 20px;
  padding-bottom: 12px;
  color: #005295;
  border-bottom: 1px solid #e5e7eb;
}

/* Label / value rows */
.view-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  margin: 0;
}

.view-grid:not(.view-grid-bordered) {
  gap: 14px 20px;
}

.view-grid.view-grid-bordered {
  gap: 0;
  border: 1px solid #e5e7eb;
}

.view-grid.view-grid-bordered > dt,
.view-grid.view-grid-bordered > dd {
  margin: 0;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
}

/* Label column */
.view-grid.view-grid-bordered > dt {
  border-right: 1px solid #e5e7eb;
  background: #f9fafb;
}

/* No double line on the last row */
.view-grid.view-grid-bordered > dt:last-of-type,
.view-grid.view-grid-bordered > dd:last-of-type {
  border-bottom: 0;
}

.view-grid dt {
  font-weight: 600;
  color: #333;
}

.view-grid dd {
  margin: 0;
  line-height: 1.7;
  color: #555;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Image + basic details side by side */
.view-section-top {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 30px;
  align-items: start;
}

@media (max-width: 768px) {
  .view-section-top {
    grid-template-columns: 1fr;
  }

  .view-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .view-grid dd {
    margin-bottom: 12px;
  }

  .view-grid.view-grid-bordered > dt {
    border-right: 0;
  }
}

.subcategory-box img {
  width: 120px;
  height: 120px;
}

.subcategory-box p {
  text-align: center;
}

.subimage {
  display: block;
  padding: 10px;
}

.chip-status {
  display: block;
  width: fit-content;
  margin: auto; /* pushes chip to the right */
  padding: 5px 12px;
  border-radius: 20px;
  background: #d1ecf1;
  color: #0c5460;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.chip-status-inactive {
  display: block;
  width: fit-content;
  margin: auto; /* pushes chip to the right */
  padding: 5px 12px;
  border-radius: 20px;
  background: #f8d7da;
  color: #842029;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.parent-chip {
  display: inline-block;
  background: #eef2f7;
  color: #333;
  border-radius: 12px;
  padding: 2px 10px;
  margin: 2px 4px 2px 0;
  font-size: 13px;
  text-decoration: none;
}

.view-chip {
  padding: 7px 14px;
  color: #005295;
  border-radius: 2px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(22, 22, 22, 0.08);
  box-shadow: 2px 4px 4px rgba(0, 0, 0, 0.1);
  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.view-chip-inactive {
  background: #f1f1f1;
  color: #888;
}

.view-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 12px;
  scrollbar-width: thin;
  scrollbar-color: #c5ccd3 transparent;
}

/* Group of header buttons */
.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 576px) {
  .header-actions {
    width: 100%;
  }

  .header-actions .btn {
    flex: 1 1 auto; /* buttons share the row, or stack if too narrow */
  }
}

#productsContent.is-loading {
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.product-thumbnail {
  width: 55px;
  height: 55px;
  object-fit: contain;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 3px;
  background: #fff;
}

.product-categories {
  max-width: 300px;
}
.product-categories .cat-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-categories .cat-more summary {
  cursor: pointer;
  color: var(--bs-primary, #0d6efd);
  font-size: 0.85em;
}
.product-categories .cat-more[open] .cat-line {
  white-space: normal;
}

.product-cat-group {
  margin-bottom: 0.4rem;
}
.product-cat-arrow {
  margin: 0 0.25rem;
  color: #6c757d;
}

.bg-primary-light { background: #e7f1ff; color: #0a58ca; }
.bg-secondary-light { background: #f1f3f5; color: #6c757d; }
.chip-count { display: block; text-align : center; color: #6c757d; font-size: .8em; padding-bottom:12px }

.product-count { margin-left: auto; }
.product-count-badge {
  display: inline-block; padding: 8px 16px; border-radius: 8px;
  background: #f1f5f9; border: 1px solid #dee2e6; font-weight: 600;
}
.product-count-badge strong { color: #1b6ca8; }
@media (max-width: 767.98px) {
  .product-count { margin-left: 0; }
  .product-count-badge { display: block; text-align: center; }
}


/* ===== Home Page Settings (append to your admin CSS file) ===== */

/* Generic image field (works with the existing .product-image-box look) */
.home-img-box {
  max-width: 100%;
  max-height: none;
  aspect-ratio: 16 / 9;
}

.home-img-box.img-square {
  max-width: 140px;
  aspect-ratio: 1 / 1;
}

.img-placeholder {
  text-align: center;
  color: #64748b;
  padding: 10px;
}

.img-placeholder p {
  font-size: 13px;
  margin: 0;
}

.img-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  border-radius: 8px;
}

.image-dropdown .img-remove {
  color: #dc3545;
}

/* Repeatable blocks (hero slides, about paragraphs, mission blocks) */
.hero-grid {
    display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 16px;
  min-width: 0;
}

.repeat-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 576px) {
  .view-grid.view-grid-bordered > dd {
    padding: 12px;
  }

  .repeat-item {
    padding: 10px;
  }

  .product-view-image {
    padding: 8px;
  }

  .product-view-image img {
    width: 100%;
    height: 100%;
  }
}
.repeat-list > .repeat-item {
  margin-bottom: 12px;
}

.repeat-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-weight: 600;
  color: #185a8a;
}

.repeat-actions {
  display: flex;
  gap: 6px;
}

.repeat-actions button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.repeat-actions button:hover {
  background: #e2e8f0;
}

.repeat-actions .btn-remove-item {
  color: #dc3545;
}

.section-note {
  background: var(--brand-soft);
  color: #185a8a;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 0.9rem;
}