/* Sterbefälle (Liste, Detail, Formulare) – übernommen aus der alten Seite files/cto_layout/css/customize_v3.css.
 * Angepasst: #header → #header, Suche-Leeren als <button>, Einbindung über das Modul hb_sterbefaelle bzw. die Leser-Vorlage. */

.sterbefaelle {
    --fontColor: rgb(59, 60, 66);

    #sterbefaelle-suche {
        display: flex;
        justify-content: center;
        gap: 20px;
        margin-bottom: 40px;

        .input-wrapper {
            position: relative;
            max-width: 600px;
            width: 100%;

            input {
                border: 1px solid var(--fontColor);
                float: none;
                margin: 0;
            }

            svg {
                position: absolute;
                right: 0;
                top: 0;
                height: 50px;
                width: 50px;
                padding: 12px;
                color: var(--fontColor);
                ;
                cursor: pointer;
            }

            input[value=""] svg {
                display: none;
            }
        }

        button {
            height: 50px;
            padding: 0 20px;
            font-size: 15px;
            font-weight: bold;
            cursor: pointer;
            border: 1px solid var(--fontColor);
            background: #fff;
            color: var(--fontColor);
            transition: background 0.2s;

            &:hover {
                background: #000;
                color: #fff;
            }
        }
    }

    .sterbefaelle-liste-neu {
        position: static !important;
        height: auto !important;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
        gap: 40px;
        padding: 0 80px;

        /* Fix grid Problem IOS Chrome */
        display: flex;
        flex-wrap: wrap;

        @media (max-width: 730px) {
            padding: 0;
            gap: 12px;
        }

        >.item {
            position: static !important;
            box-shadow: 0 0 10px rgba(0, 0, 0, .1);
            padding: 1em 1em 0em 1em !important;
            transform: none !important;

            /* Fix grid Problem IOS Chrome */
            width: 100%;

            @media (min-width: 460px) {
                width: calc(100%/2 - 6px) !important;
            }

            @media (min-width: 731px) {
                width: calc(100%/2 - 20px) !important;
            }

            @media (min-width: 880px) {
                width: calc(100%/3 - 27px) !important;
            }

            @media (min-width: 1200px) {
                width: calc(100%/4 - 30px) !important;
            }

            &.dummy {
                box-shadow: none;
                padding: 0 !important;
            }

            .ce_text {
                display: flex;
                flex-direction: column;
                height: 100%;

                .text {
                    padding: 10px;
                    flex-grow: 1;
                    display: flex;
                    flex-direction: column;

                    h3 {
                        margin: 0;
                        font-size: 22.5px;
                        color: rgb(59, 60, 66);
                    }

                    p {
                        flex-grow: 1;
                        color: rgb(59, 60, 66);
                    }

                    .kerzen-count {
                        margin: 0;
                    }
                }

                figure {
                    img {
                        width: 100%;
                        min-height: 50%;
                        height: auto !important;
                        object-fit: cover;
                        aspect-ratio: 6 / 6;
                    }
                }
            }
        }
    }

    .pagination {
        font-size: 19.5px;
        display: flex;
        flex-direction: column;
        align-items: center;

        p,
        ul {
            float: none;
            text-align: center;
        }

        p {
            font-weight: bold;
        }

        ul {
            display: flex;
            justify-content: center;
            margin-bottom: 16px;
        }
    }
}

.sterbefall-zurueck {
    display: inline-block;
    padding: 10px 20px 10px 0;
    font-size: 18px;
    font-weight: bold;
    text-decoration: none;
    color: black;
    margin: 20px 0;
}

.mod_newsreader:has(.sterbefall-detail) {
    .back {
        display: none;
    }
}

.sterbefall-detail {
    --fontColor: rgb(59, 60, 66);

    .sterbefall-detail-header {
        display: flex;
        gap: 40px;
        margin-bottom: 80px;

        .image_container {
            flex: 0 0 250px;
            margin: 0;
            float: none;
            width: auto;

            img {
                width: 100%;
                height: auto;
            }
        }

        .sterbefall-detail-info {
            flex: 1;

            h1 {
                margin-top: 0;
                word-break: keep-all;
                hyphens: auto;
            }

            .enclosure {
                padding: 0;
                margin-top: 20px;
            }

            .enclosure p a {
                text-decoration: underline !important;
            }
        }

        .sterbefall-detail-pdf {
            flex: 0 0 250px;

            a {
                position: relative;
                display: block;
                text-decoration: none;
                border: 1px solid #ddd;
                overflow: hidden;
            }

            .pdf-thumbnail {
                width: 100%;
                height: auto;
                display: block;
            }

            .pdf-overlay-label {
                position: absolute;
                top: 0;
                left: 0;
                height: 100%;
                width: 100%;
                padding: 0 20px;
                font-size: 15px;
                font-weight: bold;
                cursor: pointer;
                border: 1px solid var(--fontColor);
                background: #fff;
                color: var(--fontColor);
                opacity: 0;
                transition: opacity 0.2s;

                &:hover {
                    opacity: 1;
                }
            }
        }

        @media (max-width: 960px) {
            flex-direction: column;
            gap: 20px;

            .image_container {
                flex: none;
                max-width: 300px;
                margin: 0 auto;
            }

            .sterbefall-detail-pdf {
                flex: none;
                height: 400px;
                max-width: 300px;
                margin: 0 auto;
            }
        }

        @media (max-width: 400px) {
            // display: block;

            .sterbefall-detail-pdf {
                height: auto;
                width: 100%;

                .pdf-thumbnail {
                    max-width: 80vw;
                }
            }
        }
    }

    .pdf-lightbox-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.8);
        z-index: 9999;
        align-items: center;
        justify-content: center;

        .pdf-lightbox-content {
            position: relative;
            width: 90%;
            max-width: 900px;
            height: 80vh;
            background: #fff;
            border-radius: 8px;
            display: flex;
            flex-direction: column;
            overflow: hidden;

            @media (max-width: 400px) {
                position: absolute;
                height: calc(90vh - 80px);
                width: 100%;
                top: 80px;
            }
        }

        .pdf-lightbox-close {
            position: absolute;
            top: 10px;
            right: 14px;
            background: none;
            border: none;
            font-size: 30px;
            color: #333;
            cursor: pointer;
            z-index: 1;
            line-height: 1;

            &:hover {
                color: #000;
            }
        }

        .pdf-lightbox-viewer {
            flex: 1;
            width: 100%;
            overflow-y: auto;
            background: #888;
            text-align: center;

            canvas {
                display: block;
                margin: 0 auto;
                max-width: 100%;
            }
        }

        .pdf-lightbox-loading {
            padding: 40px;
            color: #fff;
            font-size: 16.5px;
        }

        .pdf-lightbox-actions {
            padding: 12px 20px;
            text-align: center;
            background: #f5f5f5;
            border-top: 1px solid #ddd;
        }

        .pdf-lightbox-download {
            display: inline-block;
            padding: 10px 24px;
            background: #333;
            color: #fff;
            text-decoration: none;
            border-radius: 4px;
            font-size: 14.25px;

            &:hover {
                background: #555;
            }
        }
    }

    .sterbefall-detail-forms {
        margin-bottom: 80px;

        .formnavigation {
            display: flex;
            gap: 0;
            margin-bottom: 0;

            button {
                flex: 1;
                padding: 12px 20px;
                font-size: 15px;
                font-weight: bold;
                cursor: pointer;
                border: 1px solid var(--fontColor);
                background: #f0f0f0;
                color: var(--fontColor);
                height: 50px;
                transition: background 0.2s;


                &.active {
                    background: #000;
                    color: #fff;
                }
            }
        }

        .tabnavigation-forms {
            border: 1px solid var(--fontColor);
            border-top: none;
            padding: 20px;

            label {
                display: inline-block;
                margin: 0;
            }

            input,
            textarea {
                font-size: 15px;
                color: var(--fontColor);
                float: none;
                border: 1px solid var(--fontColor);
            }

            .widget-submit button {
                cursor: pointer;
                height: 50px;
                padding: 0 20px;
                font-size: 15px;
                font-weight: bold;
                cursor: pointer;
                border: 1px solid var(--fontColor);
                background: #fff;
                color: var(--fontColor);
                transition: background 0.2s;

                &:hover {
                    background: #000;
                    color: #fff;
                }
            }
        }
    }

    .sterbefall-detail-kerzen {
        margin-top: 40px;

        h2 {}

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

        .kerze-item {
            position: relative;
            padding: 0;
            padding-bottom: 70px;
            background: rgba(0, 0, 0, 1);
            text-align: center;

            .kerze {
                width: 100%;
                border: none;
            }

            .kerzenBeschreibung {
                position: absolute;
                bottom: 0;
                width: 100%;
                color: white;
                padding: 10px;
                font-size: 18px;
                line-height: 1.2;
                margin: 0;
                min-height: 3em;
            }
        }

        @media (max-width: 550px) {
            .kerzen-grid {
                grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
                gap: 10px;
            }
        }
    }
}

body:has(.pdf-lightbox-overlay.open) #header {
    display: none;
}

@media (max-width: 400px) {
    .sterbefall-detail-pdf .pdf-thumbnail {
        max-width: 85vw !important;
    }
    .sterbefall-detail .pdf-lightbox-overlay  .pdf-lightbox-viewer canvas {
        max-width: 100vw !important;
    }
}

.pagination {
    max-width: 700px;
    margin: 0 auto;
}

.pagination li a:hover {
    color: #555;
}

.pagination li span.current {
    color: #555;
}

.kerzenBeschreibung {
    font-family: 'PT sans', cursive;
}

.formnavigation button {
    font-size: 14px;
    background-color: transparent;
    color: #555;
    font-size: 14px;
    background-color: #efefef;
    color: #555;
    padding: 10px;
    cursor: grab;
}

.tabnavigation-forms .widget-submit button {
    font-size: 14px;
    background-color: #efefef;
    color: #555;
    padding: 10px;
    cursor: grab;
}

.share-buttons {}

.share-button.whatsapp {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background-color: #25d366;
    background-color: #000;
    text-decoration: none;
    color: white;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 10px;
    gap: 5px;
}

@media only screen and (max-width: 1110px) {
    .sterbefall .candles-list ul {
        grid-template-columns: 33.333333% 33.333333% 33.333333% !important;
    }
}

@media only screen and (max-width: 768px) {
    .sterbefall .tabnavigation-button button {
        margin-right: auto;
        margin-left: auto;
        width: 100%;
        margin-top: 3em;

    }

    .kerzenSeite {
        width: 100%;
    }

    .sterbefall-bg .mod_newslist {
        -ms-grid-columns: 1fr;
        grid-template-columns: 100%;
    }

    .sterbefall-bg .layout_full h1 {
        font-size: 22.5px;
        margin-bottom: 15px;
        text-align: center;
        -webkit-box-ordinal-group: 2;
        -ms-flex-order: 1;
        order: 1;
    }

    .sterbefaelle-liste .ce_text .image_container.float_right,
    .sterbefaelle-liste .ce_text .image_container.float_left {
        width: 100%;
        text-align: center;
        padding: 0 10vw;
    }

    .sterbefall.odd {
        border-left: unset;
    }

    .kerzenliste {
        -ms-grid-columns: 50% 50%;
        grid-template-columns: 50% 50%;
    }

    .ce_tabnavigation .tabnavigation-forms.active {
        padding: 3em 1em;
    }

    .kerzenSeite form {
        -webkit-box-orient: vertical;
        -webkit-box-direction: normal;
        -ms-flex-direction: column;
        flex-direction: column;
    }

    #main .sterbefall-bg .ce_bgimage-outer .ce_bgimage-inside {
        padding-left: 1em !important;
        padding-right: 1em !important;
    }

    .sterbefall .candles-list ul {
        grid-template-columns: 50% 50% !important;
    }
}

@media only screen and (max-width: 550px) {
    .candles-list ul li {
        width: 99% !important;
        padding-bottom: 0.5em;
        height: min-content;
        margin-right: 1% !important;
    }
}

@media only screen and (max-width: 430px) {
    .kerzenliste {
        grid-template-columns: 100%;
    }

    .kerzenliste li {
        display: flex;
        height: 6em !important
    }

    .kerze {
        max-width: 99%;
        height: 85%;
    }

    .sterbefall .candles-list ul {
        grid-template-columns: 100% !important;
    }
}

/* Neu: Suche-Leeren als Schaltfläche (alt: nacktes SVG), Lade-Anzeige (alt im Template) */
.sterbefaelle #sterbefaelle-suche .input-wrapper .sterbefaelle-suche-leeren {
    position: absolute;
    right: 0;
    top: 0;
    width: 50px;
    height: 50px;
    padding: 12px;
    margin: 0;
    border: 0;
    background: none;
    color: var(--fontColor);
    cursor: pointer;
}

.sterbefaelle #sterbefaelle-suche .input-wrapper .sterbefaelle-suche-leeren[hidden] {
    display: none;
}

.sterbefaelle #sterbefaelle-suche .input-wrapper .sterbefaelle-suche-leeren svg {
    position: static;
    width: 24px;
    height: 24px;
    padding: 0;
}

.loading-spinner {
    grid-column: 1 / -1;
    width: 100%;
    padding: 4em 0;
    text-align: center;
}

.loading-spinner .spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 3px solid #ddd;
    border-top-color: #555;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Neu: Grundwerte der alten Seite für Liste und Leser (Theme hat 20 px, Links unterstrichen, Formularfelder ungestaltet).
 * rem-Werte der alten CSS sind in px umgerechnet (alt 1rem = 15 px, Theme 20 px). */
.sterbefaelle,
.sterbefall-leser {
    font-family: 'PT Sans', sans-serif;
    font-size: 15px;
    line-height: 27px;
    color: #555;
}

.sterbefaelle a,
.sterbefaelle a:hover,
.sterbefall-leser .sterbefall-detail-header a {
    color: inherit;
    text-decoration: none;
}

.sterbefaelle #sterbefaelle-suche input {
    box-sizing: border-box;
    width: 100%;
    height: 51px;
    padding: 15px;
    font-family: Arial, sans-serif;
    font-size: 16px;
    line-height: normal;
    color: #555;
    background: #fff;
    border-radius: 0;
}

.sterbefaelle #sterbefaelle-suche button[type=submit] {
    font-family: Arial, sans-serif;
    font-size: 15px;
    line-height: normal;
    border-radius: 0;
}

.sterbefaelle .sterbefaelle-liste-neu > .item .ce_text .text h3 {
    font-family: 'Arimo', sans-serif;
    font-size: 22.5px;
    font-weight: 400;
    line-height: 29.25px;
    letter-spacing: normal;
    text-transform: none;
}

.sterbefaelle .sterbefaelle-liste-neu > .item .ce_text .text p {
    margin: 0 0 15px;
    font-size: 15px;
    line-height: 27px;
}

.sterbefaelle .sterbefaelle-liste-neu > .item .ce_text .text .kerzen-count {
    display: block;
    font-size: 12.5px;
    line-height: 27px;
}

.sterbefaelle .sterbefaelle-liste-neu > .item figure {
    margin: 0;
}

.sterbefaelle .sterbefaelle-liste-neu > .item figure img {
    display: block;
}

.sterbefaelle .pagination {
    font-size: 19.5px;
    line-height: 27px;
}

.sterbefaelle .pagination ul {
    list-style: none;
    padding: 0;
}

.sterbefaelle .pagination li a,
.sterbefaelle .pagination li span.current {
    display: block;
    margin: 0 1px 0 0;
    padding: 3px 10px;
}

.sterbefaelle .pagination li span.current {
    background: #eee;
}

/* alt (Eclipse-Raster): Karten mobil mit 30 px Abstand unten */
@media (max-width: 767px) {
    .sterbefaelle .sterbefaelle-liste-neu > .item {
        margin-bottom: 30px;
    }
}

.sterbefaelle .pagination p {
    margin: 0 0 15px;
    font-size: 19.5px;
    font-weight: 700;
    line-height: 27px;
}

.sterbefaelle .pagination li {
    margin: 0;
    font-size: 19.5px; /* Theme setzt li auf --p* */
    line-height: 27px;
}

.sterbefaelle .pagination ul {
    margin-top: 0;
}

.sterbefall-leser .sterbefall-detail h1 {
    margin: 0 0 25px;
}

@media (max-width: 430px) {
    .sterbefall-leser .sterbefall-detail h1 {
        margin-bottom: 15px;
    }
}

.sterbefall-leser .sterbefall-detail-header figure img {
    display: block;
}

.sterbefall-leser .sterbefall-detail p {
    margin: 0 0 15px;
    font-size: 15px;
    line-height: 27px;
}

/* Neu: Formularfelder wie alt (Eclipse: Beschriftung über dem Feld, Arial), Theme-Raster der Widgets aufheben */
html body .sterbefall-detail-forms .ce_form .widget {
    display: block;
    margin: 0 0 20px;
}

html body .sterbefall-detail-forms .ce_form .widget > label {
    display: inline-block;
    width: auto;
    font-size: 15px;
    line-height: 27px;
    color: #555;
}

html body .sterbefall-detail-forms .ce_form .widget input.text,
html body .sterbefall-detail-forms .ce_form .widget textarea {
    display: inline-block;
    box-sizing: border-box;
    width: 100%;
    margin: 10px 10px 20px 0;
    padding: 15px;
    font-family: Arial, sans-serif;
    font-size: 15px;
    letter-spacing: normal;
    border-radius: 0;
}

html body .sterbefall-detail-forms .ce_form .widget input.text {
    height: 50px;
}

html body .sterbefall-detail-forms .ce_form .widget-submit button {
    display: inline-block;
    width: auto;
    min-width: 0;
    height: 50px;
    font-family: Arial, sans-serif;
    letter-spacing: normal;
    border-radius: 0;
}

/* Theme-Linkfarbe (#555) überschreibt sonst die weiße Schrift */
html body .sterbefall-detail .share-button.whatsapp,
html body .sterbefall-detail .share-button.whatsapp:hover,
html body .sterbefall-detail .share-button.whatsapp:focus {
    color: #fff;
}
