/*
 * CADENAS configurator styled to match Gimota / Schoch store design system.
 */
.cns-configurator,
.cns-help-overlay,
.cns-help-modal,
.cns-download-dialog {
    --cns-blue: var(--primary-color, #03264A);
    --cns-border: #d9d9d9;
    --cns-select-bg: #ffffff;
    --cns-text: #1D2226;
    --cns-row-alt: #f5f5f5;
}

.cns-configurator {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 0;
    font-family: "AkkuratLLWebPan-Regular", sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: normal;
    color: var(--cns-text);
    text-align: left;
}

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

.cns-configurator button {
    font: inherit;
    color: inherit;
    letter-spacing: normal;
    text-transform: none;
    border-radius: 0;
}

.cns-configurator button:focus-visible,
.cns-configurator select:focus-visible,
.cns-configurator input:focus-visible,
.cns-select-label:focus-visible,
.cns-carousel-card:focus-visible,
.cns-mode-button:focus-visible,
.cns-tab:focus-visible {
    outline: 2px solid var(--cns-blue);
    outline-offset: 1px;
}

.cns-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 0;
    vertical-align: middle;
}

.cns-icon svg {
    width: 100%;
    height: 100%;
}

/* Loading bar */
.cns-loading-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.cns-configurator.is-loading .cns-loading-bar {
    opacity: 1;
}

.cns-loading-bar::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 40%;
    background: var(--cns-blue);
    animation: cns-loading 1s linear infinite;
}

@keyframes cns-loading {
    from { transform: translateX(-100%); }
    to { transform: translateX(250%); }
}

.cns-configurator.is-loading .cns-left {
    pointer-events: none;
}

/* ------------------------------------------------------------------ left */

.cns-left {
    flex: 0 0 58%;
    min-width: 0;
}

.cns-products-title {
    margin: 20px 10px 0 0;
    font-family: "AkkuratLLWebPan-Bold", sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--cns-blue);
    white-space: nowrap;
    text-transform: uppercase;
}

.cns-product {
    display: flex;
    align-items: center;
    margin: 10px 0 12px;
}

.cns-product-thumb {
    width: 52px;
    height: 52px;
    border: 1px solid var(--cns-border);
    border-radius: 0;
    object-fit: contain;
    background: #ffffff;
}

.cns-product-number {
    margin: 0 0 0 12px;
    font-family: "AkkuratLLWebPan-Bold", sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--cns-blue);
}

.cns-table {
    width: 100%;
    margin: 0;
    table-layout: fixed;
    border-collapse: collapse;
    border-spacing: 0;
    color: var(--cns-text);
}

.cns-col-label {
    width: 38%;
}

.cns-row.is-even {
    background: var(--cns-row-alt);
}

.cns-row.is-odd {
    background: #ffffff;
}

.cns-table th,
.cns-table td {
    border: 1px solid var(--cns-border);
    color: var(--cns-text);
    font-size: 13px;
    font-weight: 400;
}

.cns-label {
    padding: 8px 12px;
    vertical-align: middle;
    background: var(--cns-blue);
    text-align: left;
}

.cns-label-text {
    margin-right: 8px;
    color: #ffffff;
    font-family: "AkkuratLLWebPan-Bold", sans-serif;
    font-size: 13px;
    font-weight: normal;
}

.cns-configurator .cns-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: #ffffff;
    cursor: pointer;
    vertical-align: middle;
}

.cns-input {
    padding: 6px 10px;
    vertical-align: middle;
    background: #ffffff;
}

/* Dropdown */
.cns-select {
    position: relative;
    min-width: 76px;
}

.cns-select-label {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 34px;
    padding: 6px 30px 6px 10px;
    border: 1px solid #CCCCCC;
    border-radius: 0;
    background: var(--cns-select-bg, #ffffff);
    color: #1D2226;
    font-family: "AkkuratLLWebPan-Regular", sans-serif;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.cns-select-label:hover {
    border-color: #1D2226;
}

.cns-select-label:focus-visible,
.cns-select.is-open .cns-select-label {
    outline: none;
    border-color: #1D2226;
}

.cns-select-trigger {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    padding: 0 4px;
    color: #1D2226;
}

.cns-select-trigger .cns-icon {
    width: 14px;
    height: 14px;
}

.cns-select-list {
    position: absolute;
    z-index: 30;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    max-height: 220px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
    border: 1px solid #1D2226;
    border-top: 0;
    border-radius: 0;
    background: #ffffff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.cns-select.is-open .cns-select-list {
    display: block;
}

.cns-select-item {
    padding: 6px 10px;
    color: #1D2226;
    font-family: "AkkuratLLWebPan-Regular", sans-serif;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.cns-select-item.is-highlighted {
    background: var(--cns-blue);
    color: #ffffff;
}

.cns-select-item.is-selected {
    font-family: "AkkuratLLWebPan-Bold", sans-serif;
    font-weight: 700;
}

/* Image selection (Carousel) */
.cns-carousel-header {
    padding: 8px 12px;
    margin-bottom: 14px;
    border-radius: 0;
    background: var(--cns-blue);
    color: #ffffff;
    font-family: "AkkuratLLWebPan-Bold", sans-serif;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cns-carousel-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    width: 16px;
    height: 16px;
    line-height: 0;
}

.cns-carousel-check .cns-icon {
    width: 14px;
    height: 14px;
}

.cns-carousel-content {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 14px;
}

.cns-carousel.is-single-page .cns-carousel-content {
    margin: 10px 0 10px;
}

.cns-carousel-nav {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #1D2226;
    cursor: pointer;
    line-height: 0;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.cns-carousel-nav .cns-icon {
    width: 20px;
    height: 20px;
}

.cns-carousel-nav:hover:not(:disabled) {
    color: var(--cns-blue);
}

.cns-carousel-nav:disabled {
    opacity: 0.25;
    cursor: default;
    pointer-events: none;
}

.cns-carousel-viewport {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.cns-carousel-track {
    --cns-slots: 3;
    display: flex;
    transition: transform 0.3s ease;
}

.cns-carousel-item {
    display: flex;
    flex: 0 0 calc(100% / var(--cns-slots));
    justify-content: center;
    min-width: 0;
}

.cns-carousel-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    width: calc(100% * var(--cns-slots) / 3);
    margin: 2px 4px;
    padding: 0;
    border: 1px solid #E5E7EB;
    border-radius: 0;
    background: #ffffff;
    text-align: center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cns-carousel-card.is-selected {
    border: 2px solid var(--cns-blue);
    cursor: default;
}

.cns-carousel-card.is-selectable {
    cursor: pointer;
}

.cns-carousel-card.is-selectable:hover {
    border-color: #1D2226;
}

.cns-carousel-caption {
    display: block;
    padding: 5px 6px;
    line-height: 18px;
    font-family: "AkkuratLLWebPan-Regular", sans-serif;
    font-size: 12px;
    white-space: nowrap;
    border-bottom: 1px solid #E5E7EB;
}

.cns-carousel-caption > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cns-carousel-card.is-selected .cns-carousel-caption {
    background: var(--cns-blue);
    color: #ffffff;
    font-family: "AkkuratLLWebPan-Bold", sans-serif;
    border-bottom-color: var(--cns-blue);
}

.cns-carousel-card.is-selectable .cns-carousel-caption {
    background: #F9FAFA;
    color: #1D2226;
    opacity: 0.9;
}

.cns-carousel-image {
    display: block;
    height: 100px;
    margin: 12px 8px; /* Increased margin between image and the caption bar & borders */
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
}

/* Slider indicators matching the site standard */
.cns-carousel-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin: 12px 0 6px;
    padding: 0;
    list-style: none;
}

.cns-carousel-dots li {
    margin: 0;
    display: flex;
    align-items: center;
}

.cns-carousel-dots button {
    display: block;
    width: 10px;
    height: 10px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.25);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.cns-carousel-dots button:hover {
    background: rgba(0, 0, 0, 0.5);
}

.cns-carousel-dots li.is-active button {
    background: #000000;
    transform: scale(1.2);
}

/* Enlarged image on hover */
.cns-popover {
    position: absolute;
    z-index: 40;
    display: none;
    width: 220px;
    box-sizing: border-box;
    padding: 0 4px 4px;
    border-radius: 0;
    background: var(--cns-blue);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    pointer-events: none;
    font-family: "AkkuratLLWebPan-Regular", sans-serif;
}

.cns-popover.is-visible {
    display: flex;
    flex-direction: column;
}

.cns-popover::after {
    content: "";
    position: absolute;
    top: 100%;
    left: var(--cns-arrow-left, 50%);
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--cns-blue);
}

.cns-popover.is-below::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: var(--cns-blue);
}

.cns-popover-title {
    box-sizing: border-box;
    width: 100%;
    padding: 6px 8px;
    color: #ffffff;
    font-family: "AkkuratLLWebPan-Bold", sans-serif;
    font-weight: 400;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
    white-space: normal;
    word-break: break-word;
}

.cns-popover-image {
    display: block;
    width: 100%;
    height: 140px;
    object-fit: contain;
    background: #ffffff;
    box-sizing: border-box;
}

/* Help modal */
.cns-help-overlay {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.45);
    animation: cns-fade-in 0.2s ease;
}

@keyframes cns-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.cns-help-modal {
    position: relative;
    width: min(520px, 100%);
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    padding: 28px 32px;
    border: 1px solid #1D2226;
    border-radius: 0;
    background: #ffffff;
    color: #1D2226;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    animation: cns-modal-in 0.2s ease;
}

@keyframes cns-modal-in {
    from { transform: scale(0.97); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.cns-help-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #E5E7EB;
}

.cns-help-title {
    margin: 0;
    font-family: "AkkuratLLWebPan-Bold", sans-serif;
    font-size: 18px;
    line-height: 24px;
    font-weight: 700;
    color: #1D2226;
    text-transform: uppercase;
}

.cns-help-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    margin: -2px -4px 0 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #1D2226;
    cursor: pointer;
    line-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s ease;
}

.cns-help-close:hover {
    opacity: 0.6;
}

.cns-help-close .cns-icon {
    width: 18px;
    height: 18px;
}

.cns-help-content {
    overflow-y: auto;
    font-family: "AkkuratLLWebPan-Regular", sans-serif;
    font-size: 15px;
    line-height: 24px;
    color: #1D2226;
}

.cns-help-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 14px;
    border-top: 1px solid #E5E7EB;
}

.cns-help-button {
    min-width: 120px;
    padding: 10px 24px;
    border: 1px solid var(--cns-blue, #03264A);
    border-radius: 0;
    background: var(--cns-blue, #03264A);
    color: #ffffff !important;
    font-family: "AkkuratLLWebPan-Bold", sans-serif;
    font-size: 14px;
    line-height: 20px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

.cns-help-button:hover {
    opacity: 0.9;
}

/* ----------------------------------------------------------------- right */

.cns-right {
    flex: 1 1 auto;
    min-width: 0;
}

.cns-mode {
    display: inline-flex;
    margin: 5px 0 18px;
    border: 1px solid var(--cns-blue);
    border-radius: 0;
    white-space: nowrap;
    overflow: hidden;
}

.cns-mode-button {
    padding: 6px 24px;
    min-height: 38px;
    border: 0;
    border-right: 1px solid var(--cns-blue);
    border-radius: 0;
    background: #ffffff;
    color: var(--cns-blue) !important;
    font-family: "AkkuratLLWebPan-Bold", sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.cns-mode-button:last-child {
    border-right: 0;
}

.cns-mode-button:hover:not(.is-active) {
    background: #f0f4f8;
}

.cns-mode-button.is-active {
    background: var(--cns-blue);
    color: #ffffff !important;
}

.cns-pane[hidden],
.cns-view[hidden],
.cns-viewer[hidden] {
    display: none !important;
}

.cns-tabs {
    display: flex;
    margin-bottom: 0;
    border-bottom: 2px solid #E5E7EB;
    white-space: nowrap;
}

.cns-tab {
    padding: 7px 18px;
    min-height: 36px;
    border: 0;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 0;
    background: transparent;
    color: #6B7280;
    font-family: "AkkuratLLWebPan-Regular", sans-serif;
    font-size: 14px;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.cns-tab:hover:not(.is-active) {
    color: #1D2226;
    border-bottom-color: #9CA3AF;
}

.cns-tab.is-active {
    border-bottom-color: var(--cns-blue);
    color: var(--cns-blue);
    font-family: "AkkuratLLWebPan-Bold", sans-serif;
}

.cns-tabs,
.cns-view,
.cns-download {
    margin-left: 8px;
}

.cns-view {
    padding-top: 10px;
}

.cns-viewer {
    position: relative;
    width: 100%;
    height: 400px;
}

/* 2D (derivation views) */
.cns-2d-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 18px 0 10px;
}

.cns-2d-select-wrap {
    position: relative;
    width: 220px;
}

.cns-2d-select {
    width: 100%;
    height: 34px;
    padding: 0 24px 0 8px;
    border: 1px solid #1D2226;
    border-radius: 0;
    background: #ffffff;
    font-family: "AkkuratLLWebPan-Regular", sans-serif;
    font-size: 13px;
    color: #1D2226;
    appearance: none;
}

.cns-2d-select-wrap .cns-icon {
    position: absolute;
    top: 9px;
    right: 8px;
    width: 16px;
    height: 16px;
    pointer-events: none;
    color: #1D2226;
}

.cns-2d-refresh {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 4px 14px;
    border: 1px solid var(--cns-blue);
    border-radius: 0;
    background: var(--cns-blue);
    color: #ffffff !important;
    font-family: "AkkuratLLWebPan-Bold", sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.cns-2d-refresh:hover {
    opacity: 0.9;
}

.cns-2d-refresh .cns-icon {
    width: 14px;
    height: 14px;
}

.cns-2d-hint {
    display: inline-flex;
    flex: 1 1 260px;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid #D9D9D9;
    border-radius: 0;
    color: var(--cns-blue);
    font-size: 12px;
}

.cns-2d-hint .cns-icon {
    width: 14px;
    height: 14px;
    color: var(--cns-blue);
}

.cns-2d-hint .cns-icon svg path {
    fill: #ffffff;
}

.cns-viewer-2d .psol-comp-webviewer2D-header {
    display: none;
}

/* CAD download */
.cns-download {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cns-download-button {
    display: flex;
    flex: 1 1 0;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    padding: 6px 14px;
    border: 1px solid #1D2226;
    border-radius: 0;
    background: #ffffff;
    color: #1D2226 !important;
    font-family: "AkkuratLLWebPan-Bold", sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.cns-download-button:hover {
    background: #f5f5f5;
    border-color: #1D2226;
    color: #1D2226 !important;
}

.cns-download-button.is-primary {
    border-color: var(--cns-blue);
    background: var(--cns-blue);
    color: #ffffff !important;
}

.cns-download-button.is-primary:hover {
    background: #1D2226;
    border-color: #1D2226;
    color: #ffffff !important;
}

.cns-download-button .cns-icon {
    width: 16px;
    height: 16px;
}

.cns-download-formats {
    flex: 0 0 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #1D2226;
    border-radius: 0;
    background: #ffffff;
    color: #1D2226 !important;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.cns-download-formats:hover {
    background: #f5f5f5;
    border-color: #1D2226;
}

.cns-download-dialog {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0;
}

.cns-download-dialog-panel {
    width: min(960px, 100%);
    max-height: 100%;
    overflow: auto;
    border-radius: 0;
}

.cns-error {
    margin: 10px 0;
    color: #b00020;
}

@media (max-width: 1023px) {
    .cns-configurator {
        flex-direction: column;
        align-items: stretch;
    }

    .cns-left {
        flex-basis: auto;
    }
}

@media (max-width: 767px) {
    .cns-configurator {
        padding: 0;
    }

    .cns-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 6px 8px;
    }

    .cns-product-number {
        margin: 0;
        font-size: 14px;
        word-break: break-all;
    }

    /* Keep side-by-side table layout on mobile, but much more compact */
    .cns-col-label {
        width: 28%;
    }

    .cns-table th,
    .cns-table td {
        font-size: 12px;
    }

    .cns-label {
        padding: 6px 4px;
        vertical-align: middle;
    }

    .cns-label-text {
        font-size: 11px;
        line-height: 14px;
        margin-right: 2px;
        word-break: break-word;
    }

    .cns-configurator .cns-help {
        width: 16px;
        height: 16px;
        margin-left: 2px;
    }

    .cns-input {
        padding: 4px 6px;
        vertical-align: middle;
        font-size: 12px;
    }

    /* Compact selects on mobile */
    .cns-select {
        min-width: 0;
    }

    .cns-select-label {
        min-height: 30px;
        padding: 4px 22px 4px 6px;
        font-size: 12px;
        line-height: 15px;
    }

    .cns-select-trigger {
        width: 20px;
        padding: 0 2px;
    }

    .cns-select-trigger .cns-icon {
        width: 12px;
        height: 12px;
    }

    /* Compact carousel on mobile */
    .cns-carousel-header {
        padding: 4px 6px;
        font-size: 11px;
        line-height: 14px;
        margin-bottom: 4px;
        white-space: normal;
        word-break: break-word;
    }

    .cns-carousel-content {
        gap: 2px;
        margin: 4px 0 6px;
    }

    .cns-carousel.is-single-page .cns-carousel-content {
        margin: 4px 0 4px;
    }

    .cns-carousel-nav {
        flex: 0 0 18px;
        width: 18px;
        height: 24px;
        padding: 0;
    }

    .cns-carousel-nav .cns-icon {
        width: 14px;
        height: 14px;
    }

    .cns-carousel-card {
        margin: 1px;
    }

    .cns-carousel-caption {
        white-space: normal;
        padding: 2px 2px;
        font-size: 10px;
        line-height: 12px;
        min-height: 24px;
    }

    .cns-carousel-caption > span {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        word-break: break-word;
        max-height: 24px;
    }

    .cns-carousel-image {
        height: 48px;
        margin: 3px 2px;
    }

    .cns-carousel-dots {
        margin: 4px 0 2px;
        gap: 5px;
    }

    .cns-carousel-dots button {
        width: 6px;
        height: 6px;
    }

    .cns-tabs {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .cns-tab {
        padding: 6px 10px;
        font-size: 12px;
    }

    .cns-viewer {
        height: 320px;
    }

    .cns-popover {
        max-width: calc(100vw - 24px);
    }
}
