/* Three-level product directory: shared front-end and admin presentation. */
.directory-manager {
  color: #20373f;
}

.directory-page-header {
  align-items: flex-start !important;
}

.directory-page-header h2,
.directory-page-header p {
  margin: 0;
}

.directory-page-header p {
  margin-top: 6px;
  color: #718087;
  font-size: 13px;
}

.directory-safety-note {
  margin-bottom: 18px;
  padding: 13px 16px;
  border: 1px solid rgba(1, 152, 175, 0.2);
  border-radius: 10px;
  color: #48636c;
  background: rgba(1, 152, 175, 0.06);
  line-height: 1.7;
}

.directory-category-list {
  display: grid;
  gap: 16px;
}

.directory-category-card {
  overflow: hidden;
  border: 1px solid #e1e9eb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(20, 54, 63, 0.06);
}

.directory-category-head {
  display: flex;
  min-height: 82px;
  padding: 16px 18px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, #f5fafb, #fff);
}

.directory-category-name,
.directory-spec-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.directory-category-name strong,
.directory-spec-name strong {
  color: #213940;
  font-size: 16px;
}

.directory-category-name small,
.directory-spec-name small {
  color: #849298;
}

.directory-level-badge {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
  background: #078fa4;
  font-size: 11px;
}

.directory-level-badge.subtle {
  color: #087f91;
  background: rgba(1, 152, 175, 0.1);
}

.directory-hidden-tag {
  padding: 3px 7px;
  border-radius: 999px;
  color: #997020;
  background: #fff4d7;
  font-size: 11px;
  font-style: normal;
}

.directory-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.directory-btn {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid #d8e2e5;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.directory-btn:hover {
  transform: translateY(-1px);
}

.directory-btn.small {
  min-height: 34px;
  padding: 6px 11px;
  font-size: 12px;
}

.directory-btn.primary {
  border-color: #0794a9;
  color: #fff;
  background: linear-gradient(135deg, #079db3, #087b8d);
  box-shadow: 0 5px 14px rgba(1, 152, 175, .16);
}

.directory-btn.secondary {
  color: #3a555e;
  background: #fff;
}

.directory-btn.danger {
  border-color: #f0d2d2;
  color: #c34b4b;
  background: #fff8f8;
}

.directory-btn:disabled {
  cursor: wait;
  opacity: .6;
}

.directory-spec-list {
  border-top: 1px solid #e7edef;
}

.directory-spec-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 14px;
  min-height: 62px;
  padding: 12px 18px;
  align-items: center;
  border-bottom: 1px dashed #e5ebed;
}

.directory-spec-row:last-child {
  border-bottom: 0;
}

.directory-tree-line {
  color: #92a4aa;
  font-size: 18px;
}

.directory-product-count {
  color: #708087;
  font-size: 12px;
  white-space: nowrap;
}

.directory-empty-spec,
.directory-empty,
.directory-loading {
  padding: 26px;
  color: #7c8b91;
  text-align: center;
}

.directory-modal-overlay {
  position: fixed;
  z-index: 2200;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(7, 31, 38, .56);
  backdrop-filter: blur(4px);
}

.directory-modal {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .24);
}

.directory-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.directory-modal-head h3 {
  margin: 0;
}

.directory-modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: #50666e;
  background: #eef4f5;
  cursor: pointer;
  font-size: 20px;
}

.directory-modal-help {
  color: #718087;
  font-size: 13px;
  line-height: 1.6;
}

.directory-field {
  display: grid;
  gap: 7px;
  margin-top: 15px;
  color: #3f565e;
  font-size: 13px;
}

.directory-field input {
  width: 100%;
  min-height: 43px;
  padding: 9px 12px;
  border: 1px solid #d7e1e4;
  border-radius: 8px;
  color: #20373f;
  background: #fff;
  outline: none;
}

.directory-field input:focus {
  border-color: #0698ae;
  box-shadow: 0 0 0 3px rgba(1, 152, 175, .1);
}

.directory-active-switch {
  display: flex;
  margin-top: 17px;
  align-items: center;
  gap: 9px;
  color: #3f565e;
}

.directory-active-switch input {
  width: 18px;
  height: 18px;
  accent-color: #0799af;
}

.directory-modal-actions {
  display: flex;
  margin-top: 22px;
  justify-content: flex-end;
  gap: 10px;
}

/* Product directory front end. */
.product-directory-view {
  padding-bottom: 60px;
  background: #fff;
}

.product-directory-view .banner {
  width: 100%;
  height: 400px;
  overflow: hidden;
}

.product-directory-view .banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-directory-view .breadcrumb-bar {
  margin-bottom: 30px;
  border-bottom: 1px solid #e7edef;
  background: #f5f7f8;
}

.product-directory-view .breadcrumb-inner {
  padding: 14px 0;
  color: #8a989d;
  font-size: 14px;
}

.product-directory-view .breadcrumb-inner a {
  color: #5a6b71;
  text-decoration: none;
}

.product-directory-view .breadcrumb-inner a:hover,
.product-directory-view .product-card:hover .product-name,
.product-directory-view .hot-product-item:hover .hp-name {
  color: #078fa4;
}

.product-directory-view .sep {
  margin: 0 8px;
  color: #c1cbce;
}

.product-directory-view .page-layout {
  display: flex;
  align-items: flex-start;
  gap: 30px;
}

.product-directory-view .sidebar {
  width: 260px;
  flex-shrink: 0;
}

.product-directory-view .sidebar-block {
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid #e3eaec;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(20, 54, 63, .05);
}

.product-directory-view .sidebar-title,
.product-directory-view .sidebar-title-blue {
  margin: 0;
  padding: 15px 20px;
  border-bottom: 1px solid #e3eaec;
  color: #20373f;
  background: #f5f8f9;
  font-weight: 700;
}

.product-directory-view .sidebar-title-blue {
  color: #078fa4;
  font-size: 14px;
}

.product-directory-view .sidebar-menu {
  margin: 0;
  padding: 0;
  list-style: none;
}

.product-directory-view .sidebar-menu > li {
  border-bottom: 1px solid #f0f3f4;
}

.product-directory-view .sidebar-menu > li:last-child {
  border-bottom: 0;
}

.product-directory-view .sidebar-menu a {
  display: block;
  padding: 12px 20px;
  color: #52666d;
  text-decoration: none;
  transition: color .2s ease, background .2s ease;
}

.product-directory-view .sidebar-menu a:hover,
.product-directory-view .sidebar-menu a.active {
  color: #078fa4;
  background: #f4fafb;
}

.product-directory-view .hot-products {
  padding: 10px 15px;
}

.product-directory-view .hot-product-item {
  display: flex;
  padding: 10px 0;
  align-items: center;
  gap: 12px;
  border-bottom: 1px dashed #e4eaec;
  text-decoration: none;
}

.product-directory-view .hot-product-item:last-child {
  border-bottom: 0;
}

.product-directory-view .hp-img {
  width: 60px;
  height: 60px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid #e3e9eb;
  border-radius: 8px;
}

.product-directory-view .hp-img img,
.product-directory-view .product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}

.product-directory-view .hot-product-item:hover img,
.product-directory-view .product-card:hover .product-image img {
  transform: scale(1.045);
}

.product-directory-view .hp-name {
  overflow: hidden;
  color: #334a52;
  font-size: 13px;
  line-height: 1.45;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.product-directory-view .main-content {
  min-width: 0;
  min-height: 500px;
  padding: 28px;
  flex: 1;
  border: 1px solid #e3eaec;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(20, 54, 63, .05);
}

.product-directory-view .product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.product-directory-view .product-card {
  display: block;
  overflow: hidden;
  border: 1px solid #e1e8ea;
  border-radius: 12px;
  background: #fff;
  text-decoration: none;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.product-directory-view .product-card:hover {
  transform: translateY(-3px);
  border-color: rgba(1, 152, 175, .55);
  box-shadow: 0 12px 28px rgba(22, 61, 70, .12);
}

.product-directory-view .product-image {
  width: 100%;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-bottom: 1px solid #e7edef;
  background: #f5f7f8;
}

.product-directory-view .product-name {
  padding: 15px 12px 8px;
  color: #263d45;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
}

.product-directory-view .no-data {
  padding: 60px 0;
  grid-column: 1 / -1;
  color: #87969b;
  text-align: center;
}

.product-directory-view .directory-page-heading {
  display: flex;
  margin: 0 0 18px;
  padding: 4px 2px 14px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e3eaec;
}

.product-directory-view .directory-page-heading h1 {
  margin: 3px 0 0;
  color: #20373f;
  font-size: 28px;
}

.directory-level-caption,
.directory-result-count {
  color: #77878d;
  font-size: 12px;
}

.product-directory-sidebar .directory-sidebar-category > a {
  font-weight: 600;
}

.directory-sidebar-specs {
  margin: 0;
  padding: 4px 0 7px 16px;
  list-style: none;
}

.directory-sidebar-specs a {
  display: block;
  padding: 9px 12px;
  border-left: 2px solid #dce7e9;
  color: #65777e;
  font-size: 13px;
}

.directory-sidebar-specs a.active {
  border-left-color: #0799af;
  color: #078ca1;
  background: rgba(1, 152, 175, .06);
}

.product-directory-path {
  min-height: 20px;
  padding: 0 15px 14px;
  color: #859399;
  font-size: 11px;
}

.directory-loading-state {
  padding: 80px 20px;
  color: #7b8a90;
  text-align: center;
}

/* Product editor: category + specification + sort fields. */
.admin-page .form-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1000px) {
  .directory-category-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .directory-spec-row {
    grid-template-columns: 1fr auto;
  }

  .directory-spec-row .directory-actions {
    grid-column: 1 / -1;
  }

  .product-directory-view .page-layout {
    flex-direction: column;
  }

  .product-directory-view .sidebar {
    width: 100%;
  }

  .product-directory-view .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .directory-spec-row {
    grid-template-columns: 1fr;
  }

  .directory-product-count,
  .directory-spec-row .directory-actions {
    grid-column: auto;
  }

  .directory-modal-overlay {
    padding: 12px;
  }

  .directory-modal {
    padding: 18px;
  }

  .product-directory-view .directory-page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .product-directory-view .directory-page-heading h1 {
    font-size: 23px;
  }

  .admin-page .form-row {
    grid-template-columns: 1fr;
  }

  .product-directory-view .banner {
    height: 220px;
  }

  .product-directory-view .main-content {
    padding: 18px;
  }

  .product-directory-view .product-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}
