/* Catalogue look for the products page and the admin pages.
   Built from the A.S Instruments reference stylesheet (style.css). Every rule is scoped under .catalogue
   so the rest of the ATS site keeps its own styles. Body-level rules are written by hand below. */

.catalogue {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
}

.admin-body {
    background: var(--surface-alt);
    min-height: 100vh;
}

.catalogue {
    --navy-900: #050c18;
    --navy-800: #071527;
    --navy-700: #0f2744;
    --royal: #1d4ed8;
    --royal-hover: #1e40af;
    --cyan: #0284c7;
    --cyan-light: #38bdf8;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --surface: #ffffff;
    --surface-alt: #f8fafc;
    --danger: #b91c1c;
    --danger-bg: #fef2f2;
    --success: #047857;
    --success-bg: #ecfdf5;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.06);
    --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Outfit', var(--font-body);
}

.catalogue *,
.catalogue *::before,
.catalogue *::after {
    box-sizing: border-box;
}

.catalogue img {
    max-width: 100%;
    display: block;
}

.catalogue a {
    color: var(--royal);
}

.catalogue a:hover {
    color: var(--royal-hover);
}

.catalogue h1,
.catalogue h2,
.catalogue h3 {
    font-family: var(--font-display);
    line-height: 1.2;
    margin: 0 0 0.5em;
    color: var(--navy-800);
}

.catalogue h1 {
    font-size: clamp(1.9rem, 4vw, 2.6rem);
}

.catalogue h2 {
    font-size: clamp(1.5rem, 3vw, 1.9rem);
}

.catalogue h3 {
    font-size: 1.15rem;
}

.catalogue p {
    margin: 0 0 1em;
}

.catalogue :focus-visible {
    outline: 3px solid var(--cyan-light);
    outline-offset: 2px;
}

.catalogue .container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 20px;
}

.catalogue .muted {
    color: var(--muted);
}

.catalogue .small {
    font-size: 0.85rem;
}

.catalogue .mono {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
    font-size: 0.92em;
}

.catalogue .req {
    color: var(--danger);
}

.catalogue .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    border-radius: 9px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.catalogue .btn-primary {
    background: var(--royal);
    color: #fff;
    box-shadow: 0 4px 14px rgba(29, 78, 216, 0.25);
}

.catalogue .btn-primary:hover {
    background: var(--royal-hover);
    color: #fff;
}

.catalogue .btn-light {
    background: #fff;
    color: var(--navy-800);
}

.catalogue .btn-light:hover {
    background: var(--surface-alt);
    color: var(--navy-800);
}

.catalogue .btn-outline {
    background: #fff;
    color: var(--navy-800);
    border-color: var(--border);
}

.catalogue .btn-outline:hover {
    border-color: var(--royal);
    color: var(--royal);
}

.catalogue .btn-outline-light {
    background: transparent;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
}

.catalogue .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.catalogue .btn-danger {
    background: var(--danger);
    color: #fff;
}

.catalogue .btn-danger:hover {
    background: #991b1b;
    color: #fff;
}

.catalogue .btn-sm {
    padding: 7px 12px;
    font-size: 0.85rem;
}

.catalogue .btn-block {
    width: 100%;
}

.catalogue .text-link {
    font-weight: 700;
    text-decoration: none;
}

.catalogue .text-link:hover {
    text-decoration: underline;
}

.catalogue .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--navy-800);
}

.catalogue .brand-logo {
    height: 46px;
    width: auto;
    object-fit: contain;
}

.catalogue .brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.catalogue .brand-text strong {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.catalogue .brand-text small {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--royal);
}

.catalogue .flash-container:empty {
    display: none;
}

.catalogue .flash-container {
    padding-top: 16px;
}

.catalogue .flash {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.catalogue .flash-success {
    background: var(--success-bg);
    border-color: #a7f3d0;
    color: var(--success);
}

.catalogue .flash-error {
    background: var(--danger-bg);
    border-color: #fecaca;
    color: var(--danger);
}

.catalogue .flash-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    padding: 0 4px;
}

.catalogue .section {
    padding: 56px 0;
}

.catalogue .section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.catalogue .section-head p {
    color: var(--muted);
    margin: 0;
}

.catalogue .page-banner {
    background: linear-gradient(120deg, var(--navy-900), var(--navy-800) 55%, var(--navy-700));
    color: #fff;
    padding: 56px 0 48px;
}

.catalogue .page-banner h1 {
    color: #fff;
    margin-bottom: 8px;
}

.catalogue .page-banner p {
    color: #cbd5e1;
    margin: 0;
    max-width: 640px;
}

.catalogue .empty-state {
    text-align: center;
    color: var(--muted);
    padding: 40px 0;
}

.catalogue .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.catalogue .facts .btn {
    margin-top: 16px;
}

.catalogue .filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.catalogue .filter-bar .field {
    min-width: 180px;
}

.catalogue .filter-bar .grow {
    flex: 1 1 260px;
}

.catalogue .filter-actions {
    display: flex;
    gap: 8px;
}

.catalogue .results-count {
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 16px;
}

.catalogue .product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.catalogue .product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    transition: transform 0.15s, box-shadow 0.15s;
}

.catalogue .product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}

.catalogue .product-image {
    background: #fff;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.catalogue .product-image img {
    max-height: 100%;
    width: auto;
    object-fit: contain;
}

.catalogue .product-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.catalogue .product-meta {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--royal);
    margin-bottom: 4px;
}

.catalogue .product-name {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.catalogue .product-sku {
    font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 8px;
}

.catalogue .product-desc {
    font-size: 0.9rem;
    color: #475569;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 10px;
}

.catalogue .pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
    flex-wrap: wrap;
    color: var(--muted);
}

.catalogue .stack > * + * {
    margin-top: 16px;
}

.catalogue .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 20px;
}

.catalogue .span-2 {
    grid-column: span 2;
}

.catalogue .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.catalogue .field label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--navy-800);
}

.catalogue .field input,
.catalogue .field select,
.catalogue .field textarea {
    font: inherit;
    font-size: 0.97rem;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    width: 100%;
}

.catalogue .field input:focus,
.catalogue .field select:focus,
.catalogue .field textarea:focus {
    outline: none;
    border-color: var(--royal);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

.catalogue .field textarea {
    resize: vertical;
}

.catalogue .hint {
    color: var(--muted);
    font-size: 0.82rem;
}

.catalogue .checkbox-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin: 18px 0;
}

.catalogue .checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    cursor: pointer;
}

.catalogue .checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--royal);
}

.catalogue .form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.catalogue .image-picker {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
}

.catalogue .image-preview {
    width: 140px;
    height: 140px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px;
}

.catalogue .image-picker input[type="file"] {
    font: inherit;
}

.catalogue .error-box {
    text-align: center;
    padding: 64px 0;
}

.catalogue .error-box p {
    color: var(--muted);
    margin-bottom: 24px;
}

@media (max-width: 760px) {
  .catalogue .section {
      padding: 40px 0;
  }
  .catalogue .form-grid {
      grid-template-columns: 1fr;
  }
  .catalogue .span-2 {
      grid-column: auto;
  }
  .catalogue .filter-bar .field {
      min-width: 100%;
  }
  .catalogue .filter-actions {
      width: 100%;
  }
  .catalogue .filter-actions .btn {
      flex: 1;
  }
}

.admin-body {
    background: #eef2f7;
}

.catalogue .admin-header {
    background: var(--navy-800);
    color: #fff;
    padding: 12px 0;
}

.catalogue .admin-header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.catalogue .admin-header .brand {
    color: #fff;
}

.catalogue .admin-header .brand small {
    color: var(--cyan-light);
}

.catalogue .admin-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.catalogue .admin-header-actions form {
    margin: 0;
}

.catalogue .admin-main {
    padding: 28px 0 56px;
}

.catalogue .page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.catalogue .page-head h1 {
    margin-bottom: 4px;
}

.catalogue .page-head p {
    margin: 0;
}

.catalogue .stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.catalogue .stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 20px;
}

.catalogue .stat span {
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
}

.catalogue .stat strong {
    font-family: var(--font-display);
    font-size: 1.9rem;
    color: var(--navy-800);
}

.catalogue .table-card {
    padding: 0;
    overflow: hidden;
}

.catalogue .table-wrap {
    overflow-x: auto;
}

.catalogue .table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
}

.catalogue .table th,
.catalogue .table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.catalogue .table th {
    background: var(--surface-alt);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    white-space: nowrap;
}

.catalogue .table tbody tr:hover {
    background: #f8fbff;
}

.catalogue .thumb {
    width: 56px;
    height: 56px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
}

.catalogue .actions {
    white-space: nowrap;
}

.catalogue .actions form,
.catalogue .actions a {
    display: inline-block;
    margin: 2px 4px 2px 0;
    vertical-align: middle;
}

.catalogue .actions form {
    margin-right: 4px;
}

.catalogue .actions-col {
    text-align: right;
}

.catalogue .badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    margin-left: 6px;
    vertical-align: middle;
}

.catalogue .badge-published {
    background: var(--success-bg);
    color: var(--success);
}

.catalogue .badge-hidden {
    background: #f1f5f9;
    color: #475569;
}

.catalogue .badge-featured {
    background: #eff6ff;
    color: var(--royal);
}

.catalogue .empty-card {
    text-align: center;
    padding: 48px 24px;
}

.catalogue .empty-card p {
    color: var(--muted);
}

.catalogue .form-card {
    padding: 28px;
    max-width: 920px;
}

.catalogue .form-card .stack {
    margin: 0;
}

@media (max-width: 900px) {
  .catalogue .stats {
      grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .catalogue .actions {
      white-space: normal;
  }
  .catalogue .admin-header-actions {
      width: 100%;
          justify-content: flex-end;
  }
}

.catalogue .product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.catalogue .is-disabled {
    opacity: 0.45;
    pointer-events: none;
}

.catalogue .breadcrumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.92rem;
    color: var(--muted);
    margin-bottom: 24px;
}

.catalogue .breadcrumbs a {
    color: var(--royal);
    text-decoration: none;
}

.catalogue .detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 40px;
    align-items: start;
}

.catalogue .detail-image {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    box-shadow: var(--shadow);
}

.catalogue .detail-image img {
    max-height: 420px;
    width: auto;
    object-fit: contain;
}

.catalogue .detail-info h1 {
    margin-bottom: 8px;
}

.catalogue .detail-heading {
    font-size: 1.05rem;
    margin: 24px 0 8px;
}

.catalogue .detail-text {
    color: #334155;
    white-space: pre-line;
}

.catalogue .detail-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.catalogue .spec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.catalogue .spec-table th,
.catalogue .spec-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.catalogue .spec-table th {
    width: 42%;
    color: var(--muted);
    font-weight: 600;
    background: var(--surface-alt);
}

.catalogue .spec-table tr:last-child th,
.catalogue .spec-table tr:last-child td {
    border-bottom: none;
}

.catalogue .inline-form {
    margin: 0;
    display: inline-block;
}

.catalogue .optional {
    font-weight: 500;
    color: var(--muted);
    font-size: 0.85rem;
}

.catalogue .badge-warn {
    background: #fffbeb;
    color: #92400e;
}

.catalogue .flags .badge {
    margin-left: 0;
}

.catalogue .admin-nav {
    display: flex;
    gap: 4px;
}

.catalogue .admin-nav a {
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 8px;
}

.catalogue .admin-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.catalogue .admin-nav a[aria-current="page"] {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
}

.catalogue .h3 {
    font-size: 1.15rem;
    margin: 0 0 12px;
}

@media (max-width: 900px) {
  .catalogue .detail {
      grid-template-columns: 1fr;
          gap: 24px;
  }
  .catalogue .detail-image {
      min-height: 240px;
  }
  .catalogue .admin-nav {
      width: 100%;
  }
}

@media (max-width: 560px) {
  .catalogue .catalogue-band-inner .btn,
  .catalogue .detail-actions .btn {
      width: 100%;
  }
  .catalogue .spec-table th {
      width: 40%;
  }
}

.catalogue .bulk-card {
    margin-bottom: 24px;
}

.catalogue .bulk-steps {
    margin: 12px 0 18px;
    padding-left: 20px;
    line-height: 1.7;
}

.catalogue .bulk-card input[type="file"] {
    font: inherit;
    max-width: 100%;
}

/* Helpers used by the catalogue templates and the shared catalogue viewer popup */
.catalogue .hidden {
    display: none !important;
}

.catalogue .tone-error {
    color: var(--danger);
}

.catalogue .tone-success {
    color: var(--success);
}

.catalogue .catalogue-dialog {
    border: none;
    border-radius: 12px;
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.25);
    padding: 0;
    width: min(95vw, 56rem);
    height: 90vh;
    background: #fff;
}

.catalogue .catalogue-dialog > div {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.catalogue .catalogue-dialog > div > div:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.catalogue #catalogue-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.catalogue #close-catalogue {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.catalogue #close-catalogue:hover {
    color: var(--danger);
}

.catalogue #catalogue-status {
    padding: 2.5rem 1.25rem;
    text-align: center;
    color: var(--muted);
}

.catalogue #catalogue-pages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    background: #e5e7eb;
    padding: 1rem 0.75rem;
}

.catalogue #catalogue-pages canvas {
    display: block;
    margin: 0 auto 1rem;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.2);
}

/* The card is a link, so keep its text colours instead of the link colour */
.catalogue a.product-card,
.catalogue a.product-card:hover {
    text-decoration: none;
    color: var(--text);
}

.catalogue a.product-card:hover .product-name {
    color: var(--royal);
}

.catalogue .product-card .product-footer .btn {
    text-decoration: none;
}

.catalogue .product-card img {
    width: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.catalogue .thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.catalogue .no-picture {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: #cbd5e1;
}

.catalogue .badge + .badge {
    margin-left: 0.25rem;
}

.catalogue .table td a {
    color: var(--royal);
}
