/**
 * SAMPLER UI — complements Bootstrap 4 (loaded in base.html).
 */

:root {
  --app-bg: #f6f5f2;
  --app-border: #e0dfd8;
  --app-text: #2c2b28;
  --app-muted: #6c6a64;
  --app-sidebar-bg: #faf9f7;
  --app-topbar-bg: #ffffff;
}

html {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--app-bg);
  color: var(--app-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Top bar */
.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 1.25rem;
  background: var(--app-topbar-bg);
  border-bottom: 1px solid var(--app-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.app-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.app-logo img {
  height: 36px;
  width: auto;
  display: block;
}

.app-breadcrumb {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.95rem;
  color: var(--app-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-breadcrumb .sep {
  opacity: 0.5;
}

.app-page-title {
  font-weight: 600;
  color: var(--app-text);
}

/* Shell layout */
.app-layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

.app-sidebar {
  width: 280px;
  flex-shrink: 0;
  padding: 1rem 0.75rem;
  background: var(--app-sidebar-bg);
  border-right: 1px solid var(--app-border);
  overflow-y: auto;
}

.side-label {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--app-muted);
  padding: 0.5rem 0.65rem 0.35rem;
}

.side-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  margin-bottom: 2px;
  border-radius: 6px;
  color: var(--app-text);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.12s ease;
}

.side-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--app-text);
  text-decoration: none;
}

.side-item.is-active {
  background: rgba(61, 90, 74, 0.12);
  font-weight: 600;
}

.side-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b4b2a9;
  flex-shrink: 0;
}

.side-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #b4b2a9;
  background: #fff;
  flex-shrink: 0;
  overflow: hidden;
  display: inline-block;
  box-sizing: border-box;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.side-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.side-thumb-empty {
  display: inline-block;
}

.side-name {
  flex: 1;
  min-width: 0;
}

.side-count {
  font-size: 0.75rem;
  color: var(--app-muted);
  flex-shrink: 0;
}

.app-main {
  flex: 1;
  min-width: 0;
  padding: 1.25rem 1.5rem;
}

/* Login / small forms */
.form-card {
  background: #fff;
  border: 1px solid var(--app-border);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.form-card form p {
  margin-bottom: 0.75rem;
}

/* Product list grid */
.products-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 992px) {
  .products-grid.has-details {
    grid-template-columns: minmax(280px, 380px) 1fr;
    align-items: stretch;
    /* Fill the main content area; each column scrolls independently. */
    height: calc(100vh - 56px - 2.5rem);
  }

  .products-grid.has-details .products-col-list,
  .products-grid.has-details .products-col-details {
    min-height: 0;
    overflow-y: auto;
    padding-right: 0.5rem;
  }
}

.products-col-list {
  min-width: 0;
}

.products-col-details {
  min-width: 0;
}

.app-search input[type="search"] {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  background: #fff;
}

.detail-hero {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.detail-hero-images {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.detail-hero-item {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 110px;
}
.detail-hero-caption {
  margin-top: 0.35rem;
  text-align: center;
  line-height: 1.15;
  font-size: 0.72rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.detail-hero-role {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.62rem;
  color: var(--app-muted);
}
.detail-hero-name {
  font-weight: 600;
  color: #2a2a27;
  word-break: break-word;
}
.detail-hero-arrow {
  font-size: 1.4rem;
  color: var(--app-muted);
  align-self: center;
  padding: 0 0.1rem;
  /* Offset roughly to align with the thumb center, since captions push figures taller. */
  margin-top: -1.5rem;
}
.detail-hero-thumb {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px solid #b4b2a9;
  background: #fff;
  overflow: hidden;
  flex-shrink: 0;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.detail-hero-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.detail-hero-thumb.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}
.detail-hero-text {
  min-width: 0;
}
.detail-hero-text h2 {
  margin: 0;
}
.detail-hero-sub {
  font-size: 0.8rem;
  color: var(--app-muted);
  margin-top: 0.15rem;
}

.side-search {
  padding: 0 0.35rem 0.4rem;
}
.side-search input[type="search"] {
  width: 100%;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--app-border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: #fff;
}
.side-search input[type="search"]:focus {
  outline: none;
  border-color: #2d6cdf;
  box-shadow: 0 0 0 2px rgba(45, 108, 223, 0.15);
}

.pc-card {
  border: 1px solid var(--app-border);
  border-radius: 8px;
  margin-bottom: 0.65rem;
  background: #fff;
  overflow: hidden;
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.pc-card.is-selected {
  border-color: #2d6cdf;
  background: #eef4ff;
  box-shadow: 0 0 0 2px rgba(45, 108, 223, 0.25);
}

.pc-card.is-selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #2d6cdf;
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.pc-card.is-selected .pc-card-name {
  color: #1b4fb0;
}

.pc-card.is-selected .pc-card-link:hover {
  background: rgba(45, 108, 223, 0.06);
}

.pc-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
}

.pc-card-link {
  color: inherit;
  text-decoration: none;
}

.pc-card-link:hover {
  background: rgba(0, 0, 0, 0.02);
  color: inherit;
}

.pc-card-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.pc-card-code {
  font-size: 0.8rem;
  color: var(--app-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.pc-badge-active {
  font-size: 0.72rem;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  background: #e8f0ea;
  color: #2d4a38;
}

.pc-chevron {
  opacity: 0.45;
  font-size: 1.25rem;
  line-height: 1;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
