/* Tabcordions */
.custom-section.tabcordion.v1 {
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
    position: relative;
    isolation: isolate;
    width: 100%;
    overflow: hidden;
    background: var(--section-bg-color, #FFF);
    color: var(--section-title-color, var(--primary-color));

    @media only screen and (min-width: 1280px) {
        padding-block: 50px;
    }

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

    &.has-tabs .tabcordion--tabs {
        opacity: 1;
        height: auto;
        visibility: visible;
        position: relative;
        isolation: isolate;
        z-index: 1;
        padding-inline: 30px;
        width: 100%;
        max-width: 100%;
        justify-content: center;

        &::after {
            position: absolute;
            height: 50%;
            width: 100%;
            bottom: 0;
            left: 0;
            background-color: var(--panel-background-color, var(--primary-color));
            content: '';
            z-index: -1;
            border-radius: 62px 62px 0 0;
        }

        .tab {
            max-width: 18%;
        }
    }

    &.has-tabs .tabcordion--entry {
        min-height: 0;
    }

    &.has-tabs .tabcordion--entry::before {
        display: none;
    }

    &.has-tabs .tabcordion--entry.is-active .tabcordion--entry-content {
        opacity: 1;
        transition: opacity 400ms ease-in-out;
    }

    &.has-tabs .tabcordion--entry .tabcordion--entry-content {
        opacity: 0;
        transition: opacity 400ms ease-in-out;
    }

    .tabcordion-container {
        width: var(--tabs-container-width, 1280px);
        max-width: 90%;
        margin-inline: auto;
    }

    .tabcordion--tabs {
        opacity: 0;
        height: 0;
        visibility: hidden;
        display: flex;
        flex-flow: nowrap;
        margin: 0;
        list-style: none;
        padding: 0;
        justify-content: center;
        gap: clamp(1.25rem, -1.667rem + 4.762vw, 2.5rem);
    }

    .tabcordion--tabs .tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        background: transparent;
        color: var(--tab-text-icon-color, var(--secondary-color-contrast));
        border: 0;
        border-radius: 50%;
        cursor: pointer;
        transition: all 0.3s ease;
        text-align: center;
        line-height: 1.2;
        position: relative;
        padding: 0;

        &:focus-visible {
            outline: 6px solid #000 !important;
        }

        &.is-active:focus-visible {
            outline-width: 10px !important;
        }
    }

    .tabcordion--tabs .tab:hover,
    .tabcordion--tabs .tab:focus {
        outline: none;
        transform: translateY(-4px) scale(1.05);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    }

    .tabcordion--tabs .tab.is-active {
        background: transparent;
        transform: translateY(-4px);
        z-index: 10;

        .tab-image,
        .tab-icon {
            filter: drop-shadow(5.409px 15.147px 10.927px rgba(0, 0, 0, 0.29));
            transform: scale(1.15);
            transform-origin: top center;

            &::after {
                opacity: 1;
            }
        }
    }

    .tabcordion--tabs .tab.is-active:hover,
    .tabcordion--tabs .tab.is-active:focus {
        transform: translateY(-4px);
    }

    /* Tab with icon and title */
    .tabcordion-container .tab .tab-image,
    .tabcordion-container .tab .tab-icon {
        width: var(--tab-image-width, 150px);
        max-width: 100%;
        height: auto;
        aspect-ratio: 1/1;
        object-fit: contain;
        transition: all 0.3s ease;
        border-radius: 50%;
        position: relative;
        isolation: isolate;
        background-color: var(--tab-background-color, var(--secondary-color));
        color: var(--tab-text-icon-color, var(--secondary-color-contrast));
        display: block;
        font-size: 0;

        &::after {
            position: absolute;
            width: calc(100% + var(--tab-border-width, 4px));
            height: calc(100% + var(--tab-border-width, 4px));
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            border: var(--tab-border-width, 4px) solid var(--tab-border-color, #FFF);
            content: '';
            z-index: -1;
            display: block;
            border-radius: 50%;
            opacity: 0.7;
            transition: all .35s ease-in-out;
        }

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

    .tabcordion-container .is-active .tab .tab-image::after,
    .tabcordion-container .is-active .tab .tab-icon::after,
    .tabcordion-container .tab.is-active .tab-image::after,
    .tabcordion-container .tab.is-active .tab-icon::after {
        border-color: var(--panel-background-color, var(--primary-color));
    }

    .tabcordion-container .is-active .tab .tab-image::after,
    .tabcordion-container .is-active .tab .tab-icon::after {
        opacity: 1;
    }

    .tabcordion-container .tab .tab-image {
        display: flex;
        align-items: center;
        justify-content: center;

        img {
            object-fit: cover;
            width: 100%;
            height: 100%;
        }
    }

    .tabcordion-container .tab .tab-icon {

        &>span {
            display: block;
            width: 100%;
            height: 100%;
        }

        svg {
            position: absolute;
            left: 50%;
            top: 50%;
            height: 70%;
            width: 70%;
            transform: translate(-50%, -50%);
            fill: currentColor;
            transition: all .3s ease-in-out;

            * {
                fill: currentColor;
            }
        }
    }

    .tabcordion-container .tabcordion--entry .tab .tab-icon {
        &>span {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        svg {
            position: relative;
            transform: none;
            inset: 0;
            display: block;
            max-width: 60%;
            max-height: 60%;
        }
    }

    .tabcordion-container .tab .tab-image:not(:has(img[src^="http"])),
    .tabcordion-container .tab .icons-container:not(:has(svg)),
    .tabcordion-container .tab .tab-image:has(img[src^="http"])~.icons-container {
        display: none !important;
    }

    .tabcordion-container .tab .icons-container {
        max-width: 100%;
    }

    /* General image sizing for all tab images */
    .tabcordion--tabs .tab .tab-image,
    .tabcordion--panels .tab .tab-image img,
    .tabcordion-moving-image {
        max-width: 100%;
        height: auto;
    }

    .tabcordion--tabs .tab .tab-title {
        font-size: 12px;
        font-weight: 700;
        text-align: center;
        line-height: 1.1;
        color: var(--tab-text-icon-color, var(--secondary-color-contrast));
        transition: all 0.3s ease;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-top: 8px;
    }

    /* Hide tab title when tabTitlePosition is belowPanel and image exists */
    &.tabTitlePosition-belowPanel .tabcordion--tabs .tab:has(.tab-image img[src^="http"], .tab-icon svg) {
        .tab-title {
            opacity: 0;
            display: block;
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            text-align: center;
            top: 100%;
            background-color: #FFF;
            color: var(--primary-color);
            font-weight: 700;
            padding: 5px 10px;
            border-radius: 25px;
            width: auto;
            margin-top: 10px;
            transition: all .35s ease-in-out;
            font-size: 13px;
            line-height: 1.1;
            white-space: nowrap;

            &::after {
                content: '';
                width: 0;
                height: 0;
                border-left: 9px solid transparent;
                border-right: 9px solid transparent;
                border-bottom: 9px solid #FFF;
                position: absolute;
                top: -8px;
                left: 50%;
                transform: translateX(-50%);
                display: block;
            }
        }

        &:not(.is-active):hover {
            .tab-title {
                opacity: 1;
            }
        }
    }

    .has-tabs .tabcordion--panels {
        border-top: none;
        margin-top: 0;
    }

    .tabcordion--entry {
        overflow: visible;
        position: relative;
        background: var(--panel-background-color, var(--primary-color));
        color: var(--panel-text-color, var(--primary-color-contrast));
        border-radius: 0 0 62px 62px;
        text-align: center;
    }

    .panel-content-text p {
        font-size: clamp(1.125rem, 0.592rem + 0.87vw, 1.375rem);
        line-height: 1.4;
        font-weight: 400;

        @media only screen and (max-width: 460px) {
            font-size: 16px;
        }
    }

    &:not(.has-tabs) .tabcordion--entry:not(:first-child) {
        border-top: 1px solid #ddd;
    }

    .tabcordion--entry::before {
        position: relative;
        content: attr(data-title);
        z-index: 1;
        display: block;
    }

    &:not(.has-tabs) .tabcordion--entry::before {
        background: color-mix(in srgb, var(--primary-color) 3%, transparent);
        color: var(--primary-color);
        padding: 10px 20px;
        cursor: pointer;
    }

    &:not(.has-tabs) .tabcordion--entry:not(.is-active):before {
        padding-right: 35px;
    }

    &:not(.has-tabs) .tabcordion--entry:hover,
    &:not(.has-tabs) .tabcordion--entry:focus {
        outline: none;
    }

    &:not(.has-tabs) .tabcordion--entry:hover::before,
    &:not(.has-tabs) .tabcordion--entry:focus::before {
        background: color-mix(in srgb, var(--primary-color) 12%, transparent);
    }

    &:not(.has-tabs) .tabcordion--entry:not(.is-active):after {
        content: '';
        position: absolute;
        right: 15px;
        top: 15px;
        width: 12px;
        height: 12px;
        background-color: var(--primary-color);
        mask-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 14 14' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14 6H8V0H6V6H0V8H6V14H8V8H14V6Z' fill='%23002F6C'/%3E%3C/svg%3E%0A");
        mask-repeat: no-repeat no-repeat;
        mask-position: center center;
        mask-size: contain;
    }

    .tabcordion--entry.is-active .tabcordion--entry-content {
        margin-top: 0;
        height: auto;
        opacity: 1;
        transition: margin 400ms ease-out -100ms;
    }

    &:not(.has-tabs) .tabcordion--entry.is-active::before {
        background: color-mix(in srgb, var(--primary-color) 18%, transparent);
        font-weight: 700;
    }

    &:not(.has-tabs) .tabcordion--entry.is-active:hover::before,
    &:not(.has-tabs) .tabcordion--entry.is-active:focus::before {
        background: color-mix(in srgb, var(--primary-color) 20%, transparent);
    }

    .tabcordion--entry-container {
        overflow: hidden;
        position: relative;
    }

    .tabcordion--entry-content {
        position: relative;
        margin-top: -100%;
        height: 0;
        opacity: 0;
        transition: margin 500ms ease-in;
        color: var(--panel-text-color, var(--primary-color-contrast));
        width: 1050px;
        max-width: 85%;
        margin-inline: auto;
    }

    /* Add bottom title section - only for active panels */
    &.tabTitlePosition-belowPanel .tabcordion--entry.is-active::after {
        content: attr(data-title);
        display: block;
        background: var(--tab-background-color, var(--secondary-color));
        color: var(--tab-text-icon-color, var(--secondary-color-contrast));
        padding-block: 13px;
        padding-left: 90px;
        padding-right: 30px;
        font-weight: 700;
        font-size: clamp(1.25rem, 0.185rem + 1.739vw, 1.75rem);
        line-height: 1.3;
        text-transform: uppercase;
        text-align: left;
        border-radius: 50vw;
        filter: drop-shadow(0 -1px 8px rgba(0, 0, 0, 0.39));
        animation: slideUp 0.7s ease-out;
    }

    .tabcordion--entry.is-active .tabcordion--entry-content {
        padding: clamp(1.875rem, -2.5rem + 7.143vw, 3.75rem) 30px 42px;
    }

    .tabcordion--entry-content {
        display: flex;
        flex-direction: column;
        gap: 24px;
        font-size: 16px;
        line-height: 1.6;
    }

    .tabcordion--entry-content p {
        margin: 0 0 20px 0;
        color: var(--panel-text-color, #FFF);

        a {
            color: currentColor;
        }
    }

    .tabcordion--entry-content p:last-child {
        margin-bottom: 0;
    }

    .tabcordion--entry-content .panel-button {
        display: flex;
        justify-content: flex-end;
    }

    .tabcordion--entry-content .panel-button a {
        margin-top: 20px;
        text-decoration: none;
        font-weight: 700;
        color: var(--panel-read-more-button-color, var(--panel-text-color, #FFF));
        display: inline-flex;
        align-items: center;
        gap: 5px;
        position: relative;
        font-size: 18px;
        line-height: 1.1;

        &::after {
            content: '»';
            transition: all .35s ease-in-out;
            font-size: 18px;
        }
    }

    .tabcordion--entry-content .panel-button a:hover::after {
        -webkit-animation: wobble 2s ease infinite;
        animation: wobble 2s ease infinite;
    }

    .tabcordion--entry-content .panel-button:not(:has(a)) {
        display: none;
    }

    .tabcordion--entry-content .panel-content-image img {
        display: block;
        max-width: 100%;
        height: auto;
        object-fit: contain;
        border-radius: 12px;
    }

    &.has-tabs.tabsPosition-left,
    &.has-tabs.tabsPosition-right {
        .tabcordion-container {
            display: flex;
        }

        .tabcordion--tabs {
            flex-direction: column;
            align-items: flex-start;
            width: 300px;
            opacity: 1;
            visibility: visible;
            height: auto;
            gap: 0;
            padding: 0;
            background: color-mix(in srgb, var(--primary-color) 1%, transparent);
        }

        .tabcordion--tabs .tab {
            width: 100%;
            text-align: left;
            border-radius: 0;
            border-right: 1px solid #ddd;
            border-bottom: 1px solid #ddd;
            flex-direction: row;
            justify-content: flex-start;
            gap: 12px;
            padding: 20px;
            background: color-mix(in srgb, var(--primary-color) 4%, transparent);
            min-width: auto;
            min-height: auto;
        }

        .tabcordion--tabs .tab:last-child {
            border-bottom: 0;
        }

        .tabcordion--tabs .tab {

            .tab-image,
            tab-icon {
                width: 40px;
                height: 40px;
            }
        }

        .tabcordion--tabs .tab .tab-title {
            text-align: left;
            font-size: 16px;
            display: block !important;
            /* Override the hide rule for vertical tabs */
        }

        .tabcordion--panels {
            width: calc(100% - 300px);
        }

        .tabcordion--entry-content {
            padding: 0;
            background: transparent;
            color: inherit;
        }

        .tabcordion--entry.is-active {
            padding: 15px 20px;
            overflow: visible;
            background: transparent;
        }

        .tabcordion--entry.is-active .tabcordion--entry-container {
            overflow: visible;
        }

        .tabcordion--entry.is-active::before {
            display: block;
            font-weight: 700;
            color: var(--tab-text-icon-color, var(--secondary-color-contrast));
            font-size: clamp(1.313rem, 0.226rem + 1.774vw, 2rem);
            line-height: 1.1;
            margin-bottom: 20px;
        }
    }

    @media only screen and (min-width: 1280px) {

        &.has-tabs.tabsPosition-left .tabcordion--entry.is-active,
        &.has-tabs.tabsPosition-right .tabcordion--entry.is-active {
            padding: 25px 30px;
        }
    }

    &.has-tabs.tabsPosition-right .tabcordion--tabs .tab {
        border-right: 0;
        border-left: 1px solid rgb(221, 221, 221);
    }

    &.has-tabs.tabsPosition-right .tabcordion--panels {
        order: -1;
    }

    /* Hide the original tab elements since they're cloned to the tabs container */
    .tabcordion--panels .tab {
        display: none;
        margin-inline: auto;
        outline: none;
    }

    /* Show panel tabs when tabs overflow for image animation when tabTitlePosition is belowPanel */
    &.tabs-overflow.tabTitlePosition-belowPanel .tabcordion--entry.is-active .tab {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        padding: 0;
        width: 93px;
        height: 93px;
        transform: translateY(-50%);
        margin-bottom: -40px;

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

    &.tabs-overflow.tabTitlePosition-belowPanel .tabcordion--entry .tab {

        .tab-image,
        .tab-icon {
            border-radius: 50%;
            transform: scale(0);
            overflow: hidden;
            display: block;
        }

    }

    &.tabs-overflow.tabTitlePosition-belowPanel .tabcordion--entry.is-active .tab {

        .tab-image,
        .tab-icon {
            animation: scaleUp 0.4s ease-in-out 0.3s both;
            transform: scale(1);
        }

        .icons-container {

            &,
            .tab-icon {
                width: 100%;
                height: 100%;
            }
        }
    }

    &.tabs-overflow.tabTitlePosition-belowPanel .tabcordion--entry .tab {

        .tab-image,
        .tab-icon {
            max-width: 100%;
            height: auto;
            border-radius: 50%;
            display: block;
        }

    }

    /* Hide panel tab title when tabs overflow */
    &.tabs-overflow.tabTitlePosition-belowPanel .tabcordion--entry.is-active .tab .tab-title {
        display: none;
    }

    /* Overflow-based responsive styles (replaces media queries) */
    &.tabs-overflow .tabcordion--tabs {
        gap: 0;
        flex-wrap: nowrap;
        overflow: visible;
        justify-content: center;
        display: block;
        text-align: center;
        white-space: nowrap;
    }

    &.tabs-overflow .tabcordion--tabs .tab {
        flex-shrink: 0;
        padding: 0;
        gap: 8px;
        display: inline-block;
        vertical-align: middle;
        width: 75px;
        height: 75px;
        transition: all 0.6s ease-in-out !important;

        &.is-active {
            inset: 0 !important;
            opacity: 1;
            border: 0;
            outline: none;
            position: relative !important;
            left: 0 !important;
            top: 0 !important;
            transform: none !important;
            width: 0px !important;
            height: 0px !important;
            overflow: hidden;

            .tab-image::after,
            .tab-icon::after {
                border-color: var(--tab-border-color, #FFF);
            }
        }
    }

    &.tabs-overflow .tabcordion--tabs .tab {

        .tab-image,
        .tab-icon {
            width: 100%;
            height: auto;
        }

    }

    &.tabs-overflow .tabcordion--tabs .tab.is-active {

        .tab-image,
        .tab-icon {
            display: block;
        }
    }

    &.tabs-overflow .tabcordion--tabs .tab .tab-title {
        font-size: 11px;
    }


    /* Animation for tab switching */
    .tabcordion--entry.is-active .tabcordion--entry-container {
        animation: fadeInUp 0.4s ease-out;
    }

    .panel-button:not(:has(a)) {
        display: none;
    }

    /* Custom scrollbar for mobile tab overflow */
    .tabcordion--tabs::-webkit-scrollbar {
        display: none;
    }

    .tabcordion--tabs {
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    &.tabs-overflow.has-tabs {
        &.tabTitlePosition-belowPanel .tabcordion--entry.is-active::after {
            padding-inline: 15px;
            text-align: center;
            border-radius: 10px;
        }

        .tabcordion--entry {
            border-radius: 32px;
        }

        .tabcordion--entry.is-active .tabcordion--entry-content {
            padding: 30px 0;
        }

        .tabcordion--tabs {
            padding-inline: 0;
            justify-content: center;
            padding-bottom: 60px;

            .tab {
                flex: 1;
                max-width: calc(100% - 20px);

                &:not(.is-active) {
                    margin-inline: 10px;
                }

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

        .tabcordion--tabs::after {
            display: none;
        }

    }

    @media only screen and (max-width: 600px) {
        .tabcordion-container {
            max-width: 100%;
            padding-inline: 30px;
        }

        .tabcordion--entry.is-active .tabcordion--entry-content {
            max-width: 100%;
            padding: 20px 20px 30px !important;
        }

        .panel-content-text p {
            font-size: 16px;
        }
    }

    @media only screen and (max-width: 440px) {
        &.tabs-overflow.has-tabs {
            .tabcordion--tabs {

                .tab {
                    width: calc(100%/4 - 10px);
                }

                .tab:not(.is-active) {
                    box-shadow: none;
                    margin-inline: 5px;
                }
            }
        }
    }

    /* different tabs color */
    .tabcordion-container [id*="tab1"] {

        &.tabcordion--entry.is-active::after,
        .tab-image,
        .tab-icon {
            background: var(--first-tab-background-color, var(--tab-background-color, var(--secondary-color)));
            color: var(--first-tab-text-icon-color, var(--tab-text-icon-color, var(--secondary-color-contrast)));
        }
    }

    .tabcordion-container [id*="tab2"] {

        &.tabcordion--entry.is-active::after,
        .tab-image,
        .tab-icon {
            background: var(--second-tab-background-color, var(--tab-background-color, var(--secondary-color)));
            color: var(--second-tab-text-icon-color, var(--tab-text-icon-color, var(--secondary-color-contrast)));
        }
    }

    .tabcordion-container [id*="tab3"] {

        &.tabcordion--entry.is-active::after,
        .tab-image,
        .tab-icon {
            background: var(--third-tab-background-color, var(--tab-background-color, var(--secondary-color)));
            color: var(--third-tab-text-icon-color, var(--tab-text-icon-color, var(--secondary-color-contrast)));
        }
    }

    .tabcordion-container [id*="tab4"] {

        &.tabcordion--entry.is-active::after,
        .tab-image,
        .tab-icon {
            background: var(--fourth-tab-background-color, var(--tab-background-color, var(--secondary-color)));
            color: var(--fourth-tab-text-icon-color, var(--tab-text-icon-color, var(--secondary-color-contrast)));
        }
    }

    .tabcordion-container [id*="tab5"] {

        &.tabcordion--entry.is-active::after,
        .tab-image,
        .tab-icon {
            background: var(--fifth-tab-background-color, var(--tab-background-color, var(--secondary-color)));
            color: var(--fifth-tab-text-icon-color, var(--tab-text-icon-color, var(--secondary-color-contrast)));
        }
    }

    .tabcordion-container [id*="tab6"] {

        &.tabcordion--entry.is-active::after,
        .tab-image,
        .tab-icon {
            background: var(--sixth-tab-background-color, var(--tab-background-color, var(--secondary-color)));
            color: var(--sixth-tab-text-icon-color, var(--tab-text-icon-color, var(--secondary-color-contrast)));
        }
    }
}

/* Keyframe animation */
@keyframes slideUp {
    from {
        transform: translateY(20px);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes wobble {
    0% {
        transform: translateX(0%);
    }

    15% {
        transform: translateX(-25%) rotate(-5deg);
    }

    30% {
        transform: translateX(20%) rotate(3deg);
    }

    45% {
        transform: translateX(-15%) rotate(-3deg);
    }

    60% {
        transform: translateX(10%) rotate(2deg);
    }

    75% {
        transform: translateX(-5%) rotate(-1deg);
    }

    100% {
        transform: translateX(0%);
    }
}

@keyframes scaleUp {
    0% {
        transform: scale(0);
    }

    100% {
        transform: scale(1);
    }
}

/* END Tabcordions */