.apt-elementor-widget {
    --apt-accent: #BD0062;
    font-family: inherit;
}

.apt-widget-wrap {
    display: flex;
    flex-direction: column;
}

.apt-toolbar {
    display: flex;
    width: max-content;
    max-width: 100%;
    gap: 7px;
    padding: 7px;
    border: 1px solid rgba(0,0,0,.08);
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 26px rgba(0,0,0,.09);
}

.apt-layout-vertical {
    flex-direction: column;
}

.apt-layout-horizontal {
    flex-direction: row;
    flex-wrap: wrap;
}

.apt-tool {
    width: 42px;
    height: 42px;
    border: 0;
    outline: 0;
    border-radius: 10px;
    background: transparent;
    color: #333;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    text-decoration: none !important;
    transition: transform .16s ease, background .16s ease, color .16s ease;
    padding: 0 10px;
    font: inherit;
    box-sizing: border-box;
    position: relative;
}

.apt-tool:hover,
.apt-tool:focus-visible,
.apt-tool.is-active {
    color: var(--apt-accent);
    background: rgba(189,0,98,.07);
    transform: translateY(-1px);
}

.apt-report {
    color: #b42318;
}

.apt-icon {
    flex: 0 0 auto;
    font-size: 21px;
    line-height: 1;
    font-weight: 700;
}

.apt-label {
    font-size: 12px;
    line-height: 1.3;
    white-space: nowrap;
}

.apt-hide-labels .apt-label {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    background: #222;
    color: #fff;
    padding: 6px 8px;
    border-radius: 7px;
    right: calc(100% + 7px);
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    transition: opacity .15s ease;
}

.apt-hide-labels .apt-tool:hover .apt-label,
.apt-hide-labels .apt-tool:focus-visible .apt-label {
    opacity: 1;
}

.apt-show-labels .apt-tool {
    width: auto;
    min-width: 42px;
}

.apt-layout-horizontal .apt-label {
    right: auto;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
}

.apt-show-labels .apt-label {
    position: static;
    opacity: 1;
    transform: none;
    background: transparent;
    color: inherit;
    padding: 0;
}

.apt-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.apt-modal.is-open {
    display: flex;
}

.apt-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.52);
}

.apt-modal-dialog {
    position: relative;
    width: min(520px, 100%);
    max-height: 90vh;
    overflow: auto;
    background: #fff;
    border-radius: 19px;
    padding: 24px;
    box-shadow: 0 28px 80px rgba(0,0,0,.24);
    color: #222;
}

.apt-modal-dialog h3 {
    margin: 0 0 5px;
    font-size: 20px;
}

.apt-modal-subtitle {
    margin: 0 0 18px;
    color: #666;
    font-size: 13px;
}

.apt-modal-close {
    position: absolute;
    left: 12px;
    top: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #f2f2f2;
    color: #222;
    font-size: 24px;
    cursor: pointer;
}

.apt-field-label {
    display: block;
    margin: 14px 0 7px;
    font-size: 13px;
    font-weight: 700;
}

.apt-field-label span {
    color: #777;
    font-weight: 400;
}

.apt-modal select,
.apt-modal textarea {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #d7d7d7;
    border-radius: 10px;
    background: #fff;
    color: #222;
    font-family: inherit;
}

.apt-modal textarea {
    resize: vertical;
}

.apt-submit {
    width: 100%;
    margin-top: 16px;
    border: 0;
    border-radius: 11px;
    padding: 12px 16px;
    background: var(--apt-accent);
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
}

.apt-submit:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.apt-feedback {
    margin-top: 10px;
    font-size: 13px;
    line-height: 1.7;
}

.apt-feedback.is-success {
    color: #18794e;
}

.apt-feedback.is-error {
    color: #b42318;
}

.apt-editor-note {
    margin: 10px 0 14px;
    padding: 9px 11px;
    border-radius: 8px;
    background: #fff8e5;
    font-size: 12px;
    line-height: 1.7;
}

.apt-modal-open {
    overflow: hidden;
}

.apt-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 18px);
    z-index: 1000000;
    background: #222;
    color: #fff;
    border-radius: 10px;
    padding: 10px 14px;
    opacity: 0;
    pointer-events: none;
    transition: .2s;
    font-size: 13px;
    direction: rtl;
}

.apt-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}



.apt-tool.is-loading {
    opacity: .55;
    cursor: wait;
    pointer-events: none;
}

@media (max-width: 767px) {

    /* The Elementor widget itself becomes a full-width mobile row. */
    .elementor-widget-animeshop_product_toolbar,
    .elementor-widget-animeshop_product_toolbar > .elementor-widget-container,
    .apt-elementor-widget,
    .apt-widget-wrap {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
    }

    .elementor-widget-animeshop_product_toolbar {
        flex: 0 0 100% !important;
        align-self: stretch !important;
    }

    .apt-widget-wrap {
        align-items: stretch !important;
    }

    /*
     * Even if "vertical" is selected on desktop, mobile always becomes
     * a safe horizontal grid to prevent overflow beside Product Images.
     */
    .apt-toolbar,
    .apt-layout-vertical,
    .apt-layout-horizontal {
        display: grid !important;
        grid-template-columns: repeat(auto-fit, minmax(48px, 1fr));
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        gap: 5px !important;
        padding: 6px !important;
        box-sizing: border-box;
        overflow: visible;
    }

    .apt-tool,
    .apt-show-labels .apt-tool {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 44px !important;
        padding: 0 4px !important;
        margin: 0 !important;
        box-sizing: border-box;
    }

    .apt-icon {
        font-size: 20px;
    }

    /* Text labels are hidden on small screens to guarantee no overflow. */
    .apt-label,
    .apt-show-labels .apt-label,
    .apt-hide-labels .apt-label {
        display: none !important;
    }

    .apt-modal {
        padding: 0;
        align-items: flex-end;
    }

    .apt-modal-dialog {
        width: 100%;
        max-width: none;
        max-height: min(88vh, 760px);
        border-radius: 20px 20px 0 0;
        padding: 22px 16px calc(18px + env(safe-area-inset-bottom));
        overscroll-behavior: contain;
    }

    .apt-toast {
        bottom: calc(18px + env(safe-area-inset-bottom));
        max-width: calc(100vw - 28px);
        text-align: center;
    }
}

/*
 * If the toolbar was placed in a narrow sibling column beside Product Images,
 * modern browsers can wrap the Elementor parent container on mobile.
 */
@supports selector(:has(*)) {
    @media (max-width: 767px) {
        .e-con:has(> .elementor-widget-animeshop_product_toolbar),
        .e-con-inner:has(> .elementor-widget-animeshop_product_toolbar) {
            flex-wrap: wrap !important;
        }
    }
}

@media (max-width: 380px) {
    .apt-toolbar,
    .apt-layout-vertical,
    .apt-layout-horizontal {
        grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
        gap: 4px !important;
        padding: 5px !important;
    }

    .apt-tool,
    .apt-show-labels .apt-tool {
        height: 42px !important;
    }
}
