@use './_variables.scss';
@use './_mixin.scss';
@use './_notification.scss';
@use './_popup.scss';

.etafe-dashboard .etafe-items-grid .etafe-item.pro-item,
.etafe-dashboard .etafe-controls .control-wrapper .select-option-wrapper {
    display: none;
}

#toplevel_page_elentix-addons .wp-menu-image img,
#toplevel_page_elentix-addons-new .wp-menu-image img {
  opacity: 1 !important;
  padding: 7px 0 0;
  width: 20px;
  height: 20px;
}

.etafe-dashboard {
    background: var(--etafeShadeColor);
    border-radius: 10px;
    padding: 0;
    min-height: calc(100vh - 120px);
    width: calc(100% - 20px);
    margin-top: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;

    & * {
        margin: 0;
        padding: 0;
        z-index: 1;
        position: relative;
    }

    a {
        outline: none !important;
        box-shadow: unset !important;
    }

    p {
        font-size: 15px;
    }

    svg {
        width: 1em;
        height: 1em;
        fill: currentColor;
    }

    h4 {
        font-size: 20px;
        margin-bottom: 15px;
        color: var(--etafeTitleColor);
    }
    
    .etafe-d-none {
        display: none !important;
    }

    &:after {
        content: "";
        position: absolute;
        inset: 0;
        background: linear-gradient(135deg, #034EA2 0%, #00A99D 100%);
        opacity: 0.1;
    }

    // Dashboard Cards
    .etafe-card-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
        .etafe-cards {
            padding: 40px;
            background: rgba(255,255,255,0.5);
            border-radius: 10px;
            text-align: left;
            box-shadow: -4px 6px 20px rgba(0, 0, 0, 0.05);
            .etafe-icon-part {
                width: 60px;
                height: 60px;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 23px;
                background: var(--etafePrimaryColor);
                color: var(--etafePrimaryFgColor);
                border-radius: 10px;
                margin-bottom: 25px;
            }
            .etafe-btn-part {
                margin-top: 20px;
                font-weight: 500;
                font-size: 15px;
                a {
                    color: var(--etafeTitleColor);
                    display: flex;
                    align-items: center;
                    gap: 6px;
                    text-decoration: none;
                    svg {
                        transition: all 0.3s;
                    }
                    &:hover {
                        color: var(--etafePrimaryColor);
                        svg {
                            translate: 3px 0;
                        }
                    }
                }
            }
        }
    }

    .dashboard_tab_left {
        display: grid;
        grid-template-columns: 250px 1fr;
        flex-grow: 1;
        .components-tab-panel__tabs {
            display: flex;
            align-items: start;
            flex-direction: column;
            position: relative;
            button {
                @include mixin.flex-center {
                    justify-content: start;
                }

                height: auto !important;
                width: 100%;
                transition: all 200ms ease-in;
                border-radius: 0;
                position: relative;
                background-color: var(--etafePrimaryFgColor);
                overflow: hidden;

                &::after,
                &::before {
                    content: unset;
                }

                .tab_title {
                    font-size: 18px;
                    font-weight: 500;
                    padding: 15px;
                    width: 100%;
                    background-color: var(--etafeShadeColor);
                    transition: border 200ms ease-in, transform 200ms ease-in;
                    @include mixin.flex-center {
                        gap: 10px;
                        justify-content: start;
                    }
                }
                &.is-active {
                    .tab_title {
                        background: var(--etafePrimaryFgColor);
                        border-radius: 10px 0px 0px 10px;
                    }
                }
                &:hover,
                &.is-active {
                    svg path {
                        fill: var(--etafePrimaryColor) !important;
                    }

                    p {
                        color: var(--etafePrimaryColor);
                    }
                }
            }

            //next sibling
            button.is-active+button .tab_title {
                border-top-right-radius: var(--borderRadius);
            }

            //previous sibling
            button:has(+ button.is-active) .tab_title {
                border-bottom-right-radius: var(--borderRadius);
            }
        }

        .components-tab-panel__tab-content {
            background: var(--etafeWhiteColor);
            padding: 20px;
        }
    }

    .etafe-no-results {
        text-align: center;
        padding: 40px;
        color: rgba(11, 12, 21, 0.8);
        font-size: 14px;
        background: #ffffff;
        border-radius: 8px;
        border: 1px dashed #e5e5e5;
        grid-column: 1 / -1;
    }

    .etafe-section {
        h3 {
            font-size: 20px;
            font-weight: 500;
            color: var(--etafeTitleColor);
            margin: 0 0 25px 0;
            padding-bottom: 15px;
            border-bottom: 1px solid #e5e5e5;
        }

        .etafe-notice-wrapper {
            position: fixed;
            top: 103px;
            right: 30px;
            translate: 50px 0;
            transition: all 0.5s ease-in-out;
            pointer-events: none;
            opacity: 0;

            &.is-visible {
                translate: 0 0;
                pointer-events: auto;
                opacity: 1;

                .etafe-notice {
                    padding: 12px 16px;
                    border-radius: 6px;
                    font-weight: 500;
                    background: #a1cc60;
                    color: #fff;

                    &-error {
                        background: #C81B07;
                    }
                }
            }
        }
    }

    .etafe-controls {
        display: flex;
        align-items: center;
        gap: 15px;
        margin-bottom: 30px;
        background: #f4f4f4;
        padding: 20px;
        border-radius: 5px;

        .control-wrapper {
            display: flex;
            border: 1px solid #e5e5e5;
            border-radius: 5px;
            overflow: hidden;
            height: 45px;
            flex: 1 0 auto;

            .search-wrapper {
                flex: 1 0 auto;
                .etafe-search-input {
                    min-width: 250px;
                    padding: 10px 20px;
                    font-size: 14px;
                    transition: all 0.3s ease;
                    border: none;
                    height: 100%;
                    outline: none;
                    border-radius: 0;
                    box-shadow: none;
                    width: 100%;
                    font-size: 15px;
                }
            }

            .select-option-wrapper {
                border-left: 1px solid #e5e5e5;

                select {
                    height: 100%;
                    border: none;
                    outline: none;
                    border-radius: 0;
                    box-shadow: none;
                    padding: 8px 40px 10px 20px;
                    font-size: 15px;
                    background-position: center right 20px;
                }
            }
        }

        .action-btn-wrapper {
            display: flex;
            align-items: center;
            gap: 15px;
        }

        button {
            margin: 0 !important;
            height: 45px;
            padding: 0 20px;
            font-size: 14px;
            font-weight: 500;
            color: #0B0C15;
            background-color: #ffffff;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            transition: all 0.3s ease;

            &.etafe-btn-enable {
                color: #ffffff;
                background-color: #034EA2;
            }

            &.etafe-btn-disable {
                color: #ffffff;
                background-color: #C81B07;
            }

            &.etafe-btn-save {
                color: #ffffff;
                background: linear-gradient(135deg, #034EA2 0%, #00A99D 100%);
            }

            &:disabled {
                cursor: not-allowed;
                opacity: 0.5;
            }
        }
    }

    // Banner
    .etafe-banner {
        background: linear-gradient(135deg, var(--etafePrimaryColor) 0%, var(--etafeSecondaryColor) 100%);
        color: #ffffff;
        padding: 40px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 15px;
        border-radius: 10px 10px 0 0;
        h1 {
            color: #ffffff;
            margin: 0 0 10px 0;
            font-size: 42px;
            font-weight: 600;
            line-height: 1.2;
        }

        p {
            color: rgba(255, 255, 255, 0.9);
            font-size: 16px;
            margin: 0;
        }

        .etafe-version {
            padding: 3px 10px;
            border-radius: 3px;
            color: var(--etafePrimaryColor);
            background: var(--etafePrimaryFgColor);
        }
    }

    // Welcome
    .etafe-welcome {
        background: #ffffff;
        padding: 60px 40px 50px;
        text-align: center;
        border-radius: 10px;
        position: relative;
        z-index: 1;

        h2 {
            font-size: 28px;
            font-weight: 600;
            line-height: 1.2;
            color: #0B0C15;
            margin: 0 0 15px 0;
        }

        p {
            font-size: 16px;
            color: rgba(11, 12, 21, 0.7);
            max-width: 600px;
            margin: 0 auto;
            line-height: 1.6;
        }

        &:after {
            content: "";
            position: absolute;
            inset: 0;
            background: linear-gradient(135deg, #034EA2 0%, #00A99D 100%);
            z-index: -1;
            border-radius: 0 0 10px 10px;
            opacity: 0.1;
        }
    }

    // Items
    .etafe-items-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 20px;

        .etafe-item {
            background: #ffffff;
            border: 1px solid #e5e5e5;
            border-radius: 8px;
            padding: 20px;
            display: flex;
            align-items: center;
            gap: 16px;
            transition: all 0.3s ease;
            cursor: pointer;
            position: relative;
            z-index: 1;

            .etafe-item-content {
                flex: 1;
                display: flex;
                align-items: flex-end;
                justify-content: space-between;
                gap: 10px;
                flex-wrap: wrap;

                h4 {
                    font-size: 14px;
                    font-weight: 600;
                    line-height: 1.2;
                    color: #0B0C15;
                    margin: 0 0 6px 0;
                }

                .extra-links {
                    display: flex;
                    align-items: center;
                    gap: 10px;
                    font-size: 15px;

                    a {
                        color: var(--etafeBodyColor);
                        opacity: 0.7;

                        &:hover {
                            color: var(--etafePrimaryColor);
                            opacity: 1;
                        }
                    }
                }
            }

            .etafe-item-switch {
                position: relative;
                display: inline-block;
                width: 50px;
                height: 26px;
                margin: 0;
                cursor: pointer;

                input[type=checkbox] {
                    opacity: 0;
                    width: 0;
                    height: 0;
                }

                input[type=checkbox]:checked+.etafe-switch-slider {
                    background: var(--etafePrimaryColor);
                }

                input[type=checkbox]:checked+.etafe-switch-slider:before {
                    transform: translateX(24px);
                }

                input[type=checkbox]:disabled+.etafe-switch-slider {
                    background: #e5e5e5;
                    cursor: not-allowed;
                }

                .etafe-switch-slider {
                    position: absolute;
                    cursor: pointer;
                    top: 0;
                    left: 0;
                    right: 0;
                    bottom: 0;
                    background: #e5e5e5;
                    border-radius: 26px;
                    transition: all 0.3s ease;

                    &:before {
                        position: absolute;
                        content: "";
                        height: 20px;
                        width: 20px;
                        left: 3px;
                        bottom: 3px;
                        background: #ffffff;
                        border-radius: 50%;
                        transition: all 0.3s ease;
                        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
                    }
                }
            }

            .etafe-badge {
                display: inline-block;
                padding: 5px 10px;
                border-radius: 4px;
                font-size: 10px;
                font-weight: 600;
                line-height: 1;
                text-transform: uppercase;
                letter-spacing: 0.5px;
                background: rgba(3, 78, 162, 0.1);
                color: var(--etafePrimaryColor);
            }

            &.active,
            &:hover {
                background: rgba(3, 78, 162, 0.05);
                border-color: var(--etafePrimaryColor);
            }

            .etafe-item-hidden {
                display: none;
            }
            &.pro-item {
                .etafe-badge {
                    background: linear-gradient(135deg, #fbbf24, #f59e0b);
                    color: #ffffff;
                }
            }
        }
    }
}