/* ==========================================================================
   Datasheet Table & Filter Component Styles
   Used for Sicherheitsleuchten & Rettungszeichenleuchten
   ========================================================================== */

.datasheet-container {
    margin: 20px 0 60px 0;
}

.datasheet-container .toc-search-container {
    margin: 10px 0 25px 0;
}

/* ----------------- Filter Toolbar ------------------ */
.datasheet-filter-toolbar {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0 30px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.datasheet-filter-toolbar .search-wrapper {
    flex: 1 1 280px;
    max-width: 100%;
    min-width: 240px;
    position: relative;
    margin: 0;
}

.datasheet-select-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select-wrapper {
    position: relative;
    min-width: 205px;
}

/* Custom Select Dropdown Styling (identical to kontakt.php "Anrede") */
.custom-select-container {
    position: relative;
    width: 100%;
    font-family: inherit;
}

.custom-select-container select.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.custom-select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    line-height: 20px;
    background-color: #ffffff;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    user-select: none;
}

.custom-select-trigger:hover {
    border-color: #004B87;
}

.custom-select-trigger:focus,
.custom-select-container.is-open .custom-select-trigger {
    border-color: #004B87;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 75, 135, 0.15);
}

.custom-select-trigger-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 20px;
    flex: 1;
}

.custom-select-trigger-text.is-placeholder {
    color: #888;
}

.custom-select-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: #004B87;
    flex-shrink: 0;
    margin-left: 10px;
}

.custom-select-arrow svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
}

.custom-select-container.is-open .custom-select-arrow {
    transform: rotate(180deg);
}

.custom-select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background-color: #ffffff;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.04);
    z-index: 1000;
    max-height: 220px;
    overflow-y: auto;
    opacity: 0;
    transform: translateY(-6px) scale(0.99);
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 4px;
    box-sizing: border-box;
}

.custom-select-container.is-open .custom-select-options {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.custom-select-option {
    padding: 8px 12px;
    border-radius: 3px;
    font-size: 14px;
    color: #181818;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    user-select: none;
}

.custom-select-option:hover {
    background-color: rgba(0, 75, 135, 0.07);
    color: #004B87;
}

.custom-select-option.is-selected {
    background-color: #004B87;
    color: #ffffff;
    font-weight: bold;
}

.custom-select-option.is-placeholder {
    color: #888;
}

/* Fallback native select */
.datasheet-filter-select {
    width: 100%;
    padding: 10px 36px 10px 14px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23004B87' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    color: #1e293b;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.4;
    font-family: inherit;
}

.datasheet-filter-select:hover {
    border-color: #004B87;
}

.datasheet-filter-select:focus {
    outline: none;
    border-color: #004B87;
    box-shadow: 0 0 0 3px rgba(0, 75, 135, 0.15);
}

.datasheet-filter-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #004B87;
    background: #ffffff;
    border: 1px solid #d1d9e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.datasheet-filter-reset-btn:hover {
    background: #eff6ff;
    border-color: #004B87;
    color: #003366;
}

/* ----------------- Table Styling ------------------ */
.datasheet-table-responsive {
    width: 100%;
    overflow-x: auto;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

.datasheet-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 15px;
}

.datasheet-table thead th {
    background: #004B87;
    color: #ffffff;
    padding: 14px 20px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border: none;
}

/* Sortable column headers */
.datasheet-table thead th.is-sortable {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.datasheet-table thead th.is-sortable:hover {
    background-color: #003865;
}

.datasheet-table thead th.is-sortable:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: -2px;
}

.th-sort-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    vertical-align: middle;
}

.th-sort-wrapper.th-center {
    justify-content: center;
    width: 100%;
}

.sort-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.sort-icon .icon-sort-arrow {
    display: block;
    opacity: 0;
    color: #ffffff;
    transform: rotate(0deg);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Subtle hint on hover for inactive sortable columns */
.datasheet-table thead th.is-sortable:hover:not(.is-sorted-asc):not(.is-sorted-desc) .sort-icon .icon-sort-arrow {
    opacity: 0.4;
}

/* Active sorting arrow states: only displayed on the active column */
.datasheet-table thead th.is-sorted-asc .sort-icon .icon-sort-arrow {
    opacity: 1;
    transform: rotate(0deg);
}

.datasheet-table thead th.is-sorted-desc .sort-icon .icon-sort-arrow {
    opacity: 1;
    transform: rotate(180deg);
}

.datasheet-table thead th.col-image {
    width: 120px;
    text-align: center;
}

.datasheet-table thead th.col-product {
    min-width: 220px;
}

.datasheet-table thead th.col-protection {
    width: 120px;
    text-align: center;
}

.datasheet-table thead th.col-range {
    width: 150px;
    text-align: center;
}

.datasheet-table thead th.col-action {
    width: 280px;
    text-align: right;
    white-space: nowrap;
}

.datasheet-table td.col-action .document-actions {
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
    white-space: nowrap;
}

.datasheet-table tbody tr.datasheet-row {
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.2s ease;
}

.datasheet-table tbody tr.datasheet-row.is-even {
    background-color: #fafbfd;
}

.datasheet-table tbody tr.datasheet-row:hover {
    background-color: #f0f7fc;
}

.datasheet-table td {
    padding: 14px 20px;
    vertical-align: middle;
}

.datasheet-table td.col-image {
    text-align: center;
}

.datasheet-table td.col-protection {
    text-align: center;
}

.datasheet-table td.col-range {
    text-align: center;
}

.datasheet-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.badge-ip {
    background-color: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

/* Schutzart: Dezent abgestimmte Farbtöne (Grau -> Blau, hell -> dunkel) */
.badge-ip-ip32 {
    background-color: #f8fafc;
    color: #64748b;
    border-color: #e2e8f0;
}

.badge-ip-ip40 {
    background-color: #f1f5f9;
    color: #334155;
    border-color: #cbd5e1;
}

.badge-ip-ip43 {
    background-color: #e0f2fe;
    color: #0369a1;
    border-color: #bae6fd;
}

.badge-ip-ip54 {
    background-color: #dbeafe;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.badge-ip-ip65 {
    background-color: #bfdbfe;
    color: #1e3a8a;
    border-color: #60a5fa;
}

.badge-range {
    background-color: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* Erkennungsweite: Dezent abgestimmte Grüntöne (hell -> dunkel) */
.badge-range-10m {
    background-color: #f0fdf4;
    color: #166534;
    border-color: #dcfce7;
}

.badge-range-22m {
    background-color: #ecfdf5;
    color: #065f46;
    border-color: #a7f3d0;
}

.badge-range-23m {
    background-color: #e6f9f0;
    color: #047857;
    border-color: #86efac;
}

.badge-range-30m {
    background-color: #dcfce7;
    color: #15803d;
    border-color: #4ade80;
}

.badge-range-32m {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #34d399;
}

.badge-range-40m {
    background-color: #bbf7d0;
    color: #14532d;
    border-color: #22c55e;
}

.badge-range-60m {
    background-color: #86efac;
    color: #052e16;
    border-color: #16a34a;
}

.datasheet-table td.col-action {
    text-align: right;
}

/* ----------------- Image Styling ------------------ */
.product-image-box {
    width: 100px;
    height: 75px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    padding: 4px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.product-image-box:hover {
    border-color: #004B87;
    transform: scale(1.03);
    box-shadow: 0 4px 12px rgba(0, 75, 135, 0.12);
}

.product-thumb {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.product-thumb-placeholder {
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ----------------- Product Title ------------------ */
.product-name-wrapper {
    display: flex;
    flex-direction: column;
}

.product-title {
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.4;
    word-break: break-word;
}

/* ----------------- Download Button & Badges ------------------ */
.btn-datasheet-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #004B87;
    color: #ffffff !important;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0, 75, 135, 0.22);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-datasheet-download:hover {
    background: #003366;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
}

.btn-datasheet-download svg {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.btn-datasheet-download:hover svg {
    transform: translateY(2px);
}

.file-size-badge {
    font-size: 11px;
    font-weight: normal;
    opacity: 0.85;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

/* ----------------- Lightbox Modal ------------------ */
.datasheet-lightbox-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.datasheet-lightbox-modal.is-open {
    display: flex;
}

.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.82);
    backdrop-filter: blur(4px);
}

.lightbox-content {
    position: relative;
    z-index: 2;
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-image {
    max-width: 80vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 6px;
}

.lightbox-caption {
    margin-top: 12px;
    font-size: 15px;
    font-weight: 700;
    color: #004B87;
    text-align: center;
}

.lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    background: #004B87;
    color: #ffffff;
    border: 2px solid #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.lightbox-close:hover {
    background: #e11d48;
}

/* ----------------- Table Mobile Responsive (Cards < 1100px) ------------------ */
@media (max-width: 1100px) {
    .datasheet-table-responsive {
        border: none;
        box-shadow: none;
        background: transparent;
        overflow-x: visible;
    }

    .datasheet-table,
    .datasheet-table tbody {
        display: block;
        width: 100%;
    }

    .datasheet-table thead {
        display: none;
    }

    .datasheet-table tbody tr.datasheet-row {
        display: grid;
        grid-template-columns: 80px auto 1fr;
        gap: 8px 10px;
        align-items: center;
        background: #fdfdfd;
        border: 1px solid #eee;
        border-radius: 6px;
        padding: 16px;
        margin-bottom: 12px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
        box-sizing: border-box;
        width: 100%;
        transition: all 0.3s ease;
    }

    .datasheet-table tbody tr.datasheet-row:hover {
        border-color: #004B87;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    }

    .datasheet-table td {
        padding: 0;
        border: none;
    }

    .datasheet-table td.col-image {
        grid-column: 1;
        grid-row: 1 / span 2;
        text-align: left;
        align-self: start;
    }

    .product-image-box {
        width: 80px;
        height: 60px;
    }

    .datasheet-table td.col-product {
        grid-column: 2 / -1;
        grid-row: 1;
        align-self: end;
    }

    .product-title {
        font-size: 15px;
        word-break: break-word;
    }

    .datasheet-table td.col-protection {
        grid-column: 2;
        grid-row: 2;
        text-align: left;
        display: flex;
        align-items: center;
        width: fit-content;
        align-self: start;
    }

    .datasheet-table td.col-range {
        grid-column: 3;
        grid-row: 2;
        text-align: left;
        display: flex;
        align-items: center;
        width: fit-content;
        align-self: start;
    }

    .datasheet-table td.col-action {
        grid-column: 1 / -1;
        grid-row: 3;
        width: 100%;
        text-align: center;
    }

    .datasheet-table td.col-action .document-actions {
        width: 100%;
        justify-content: center;
        border-top: 1px solid #eee;
        padding-top: 15px;
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 15px 25px;
        box-sizing: border-box;
    }

    .datasheet-table td.col-action .document-actions a {
        font-size: 14px;
        gap: 8px;
    }

    .datasheet-table td.no-data-cell {
        display: block;
        width: 100%;
        text-align: center;
        padding: 20px;
    }
}

/* ----------------- Filter Toolbar Mobile Adjustments (<= 768px) ------------------ */
@media (max-width: 768px) {
    .datasheet-filter-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 15px;
        gap: 15px;
    }

    .datasheet-filter-toolbar .search-wrapper {
        flex: 0 0 auto;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .datasheet-select-filters {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 10px;
    }

    .filter-select-wrapper {
        width: 100%;
        min-width: 0;
    }

    .datasheet-filter-reset-btn {
        justify-content: center;
        width: 100%;
    }
}


/* ==========================================================================
   Sticky Contact Widget for Datasheets (Pure Blue Expanding Element)
   ========================================================================== */

.datasheet-sticky-contact {
    position: fixed;
    right: 0;
    top: 32%;
    transform: translateY(-50%) translateX(100%);
    z-index: 990;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: linear-gradient(180deg, #004B87 0%, #003366 100%);
    box-shadow: -4px 4px 18px rgba(0, 50, 100, 0.28);
    border-radius: 9px 0 0 9px;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                background 0.3s ease,
                box-shadow 0.3s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* After 5 seconds, slides into view directly against the right viewport edge */
.datasheet-sticky-contact.is-ready {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}

.datasheet-sticky-contact:hover,
.datasheet-sticky-contact.is-open {
    box-shadow: -6px 6px 26px rgba(0, 50, 100, 0.38);
    background: linear-gradient(180deg, #005294 0%, #003870 100%);
}

/* Individual Link Item */
.sticky-contact-item {
    display: flex;
    align-items: center;
    color: #ffffff;
    text-decoration: none;
    padding: 8px 6px;
    border-radius: 6px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

.sticky-contact-item:hover,
.sticky-contact-item:focus-visible {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.sticky-contact-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.sticky-contact-item:hover .sticky-contact-icon {
    transform: scale(1.08);
}

.sticky-contact-icon svg {
    display: block;
    width: 20px;
    height: 20px;
    color: #ffffff;
}

/* Text label: hidden in collapsed tab, expands smoothly on hover / .is-open */
.sticky-contact-label {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    margin-left: 0;
    transition: max-width 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.25s ease,
                margin-left 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                padding-right 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.datasheet-sticky-contact:hover .sticky-contact-label,
.datasheet-sticky-contact.is-open .sticky-contact-label {
    max-width: 170px;
    opacity: 1;
    margin-left: 10px;
    padding-right: 8px;
}

/* Subtle separator between the two items */
.sticky-contact-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.22);
    margin: 0 4px;
}

/* Hide on screens where the collapsed element (approx. 48px + 15px gap) would overlap or be closer than 15px to the 1200px content area */
@media (max-width: 1326px) {
    .datasheet-sticky-contact {
        display: none !important;
    }
}


