/* ==========================================================================
   Flex Panels (Standorte) Component
   Inspired by Wes Bos Flex Panels & customized for TYPO3 Content Blocks
   ========================================================================== */

.flex-panels-wrapper {
    width: 100%;
    position: relative;
    box-sizing: border-box;
    margin-bottom: 2.5rem;
}

.flex-panels-header {
    margin-bottom: 2rem;
    text-align: center;
}

.flex-panels-header h1,
.flex-panels-header h2,
.flex-panels-header h3,
.flex-panels-header h4,
.flex-panels-header h5 {
    color: #106a9a;
    margin-bottom: 0.5rem;
}

.flex-panels-subheader {
    font-size: 1.15rem;
    color: #555555;
    margin-top: 0;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* --------------------------------------------------------------------------
   Flex Container
   -------------------------------------------------------------------------- */
.flex-panels {
    display: flex;
    flex-direction: row;
    width: 100%;
    min-height: 540px;
    height: 560px;
    /*border-radius: 16px;*/
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.04);
    background-color: #0c4e72;
    position: relative;
}

/* --------------------------------------------------------------------------
   Individual Flex Panel
   -------------------------------------------------------------------------- */
.flex-panel {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2.5rem 1.5rem;
    text-align: center;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    transition: flex 0.7s cubic-bezier(0.25, 1, 0.35, 1), box-shadow 0.3s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.flex-panel:last-child {
    border-right: none;
}

.flex-panel:focus-visible {
    outline: 3px solid #ffffff;
    outline-offset: -3px;
    z-index: 10;
}

/* --------------------------------------------------------------------------
   Panel Background & Overlay
   -------------------------------------------------------------------------- */
.flex-panel__bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform: scale(1);
    filter: brightness(0.75);
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.35, 1), filter 0.8s ease;
    z-index: 1;
}

/* Fallback Farbverläufe wenn kein Bild gewählt wurde */
.flex-panel__bg--default.flex-panel__bg--color-1 {
    background: linear-gradient(135deg, #106a9a 0%, #0c4e72 100%);
}
.flex-panel__bg--default.flex-panel__bg--color-2 {
    background: linear-gradient(135deg, #0e5b84 0%, #083750 100%);
}
.flex-panel__bg--default.flex-panel__bg--color-3 {
    background: linear-gradient(135deg, #1479af 0%, #0f5479 100%);
}
.flex-panel__bg--default.flex-panel__bg--color-4 {
    background: linear-gradient(135deg, #1b87c1 0%, #106a9a 100%);
}
.flex-panel__bg--default.flex-panel__bg--color-5 {
    background: linear-gradient(135deg, #0d5074 0%, #072a3e 100%);
}

.flex-panel__overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(16, 106, 154, 0.5) 0%, rgba(12, 40, 60, 0.8) 100%);
    transition: background 0.6s ease, opacity 0.6s ease;
    z-index: 2;
}

/* --------------------------------------------------------------------------
   Panel Content (Title, Subtitle, Richtext, Button)
   -------------------------------------------------------------------------- */
.flex-panel__content {
    position: relative;
    z-index: 3;
    color: #ffffff;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    pointer-events: none;
}

.flex-panel__intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.35, 1);
    transform: translateY(0);
}

.flex-panel__subtitle {
    display: inline-block;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 0.5rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    transition: opacity 0.4s ease, transform 0.5s ease;
}

.flex-panel__title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    line-height: 1.25;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    word-break: break-word;
    transition: font-size 0.5s cubic-bezier(0.25, 1, 0.35, 1), transform 0.5s ease;
}

.flex-panel__indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    margin-top: 1rem;
    position: relative;
    transition: transform 0.4s ease, background-color 0.3s ease;
}

.flex-panel__indicator::before,
.flex-panel__indicator::after {
    content: '';
    position: absolute;
    background-color: #ffffff;
    transition: transform 0.4s ease;
}

.flex-panel__indicator::before {
    width: 14px;
    height: 2px;
}

.flex-panel__indicator::after {
    width: 2px;
    height: 14px;
}

/* --------------------------------------------------------------------------
   Panel Details (Adresse & Richtext)
   -------------------------------------------------------------------------- */
.flex-panel__details {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transform: translateY(24px);
    transition: opacity 0.4s cubic-bezier(0.25, 1, 0.35, 1),
                transform 0.5s cubic-bezier(0.25, 1, 0.35, 1),
                max-height 0.6s cubic-bezier(0.25, 1, 0.35, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 520px;
    pointer-events: none;
}

.flex-panel__bodytext {
    color: #ffffff;
    font-size: 1.05rem;
    line-height: 1.65;
    margin-top: 1.25rem;
    width: 100%;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    text-align: center;
}

.flex-panel__bodytext p {
    margin-top: 0;
    margin-bottom: 0.6rem;
}

.flex-panel__bodytext p:last-child {
    margin-bottom: 0;
}

.flex-panel__bodytext a {
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: opacity 0.2s ease;
}

.flex-panel__bodytext a:hover {
    color: #eaece6;
    opacity: 0.85;
}

.flex-panel__action {
    margin-top: 1.25rem;
}

.btn-flex-panel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    color: #106a9a !important;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.7rem 1.6rem;
    border-radius: 6px;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-flex-panel:hover {
    background-color: #eaece6;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

/* --------------------------------------------------------------------------
   Hover & Open / Active States
   -------------------------------------------------------------------------- */
.flex-panel:hover:not(.is-open) .flex-panel__bg {
    transform: scale(1.04);
    filter: brightness(0.85);
}

.flex-panel:hover:not(.is-open) .flex-panel__indicator {
    background-color: rgba(255, 255, 255, 0.35);
    transform: scale(1.1);
}

/* AKTIVER / GEÖFFNETER ZUSTAND */
.flex-panel.is-open {
    flex: 4;
    cursor: default;
}

.flex-panel.is-open .flex-panel__bg {
    transform: scale(1.06);
    filter: brightness(0.5);
}

.flex-panel.is-open .flex-panel__overlay {
    background: linear-gradient(180deg, rgba(16, 106, 154, 0.75) 0%, rgba(6, 24, 38, 0.92) 100%);
}

.flex-panel.is-open .flex-panel__title {
    font-size: 2.1rem;
}

.flex-panel.is-open .flex-panel__indicator {
    background-color: rgba(255, 255, 255, 0.4);
    transform: rotate(45deg);
    cursor: pointer;
    pointer-events: auto;
}

.flex-panel.is-open .flex-panel__details {
    opacity: 1;
    max-height: 400px;
    transform: translateY(0);
    pointer-events: auto;
}

.flex-panel.is-open .flex-panel__content {
    pointer-events: auto;
}

/* --------------------------------------------------------------------------
   Responsive (Tablets & Mobile Devices)
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .flex-panels {
        flex-direction: column;
        height: auto;
        min-height: auto;
        /*border-radius: 12px;*/
        background-color: transparent;
        box-shadow: none;
        gap: 12px;
    }

    .flex-panel {
        width: 100%;
        min-height: 110px;
        /*border-radius: 12px;*/
        border-right: none;
        border: 1px solid rgba(16, 106, 154, 0.2);
        padding: 1.5rem 1.25rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        transition: min-height 0.6s cubic-bezier(0.25, 1, 0.35, 1), flex 0.4s ease;
    }

    .flex-panel.is-open {
        flex: none;
        min-height: 380px;
    }

    .flex-panel__title {
        font-size: 1.35rem;
    }

    .flex-panel.is-open .flex-panel__title {
        font-size: 1.65rem;
    }

    .flex-panel__details {
        max-width: 100%;
    }

    .flex-panel__bodytext {
        font-size: 0.95rem;
    }
}
