:root {
    --wcaph-primary: #0F1E2F;
    --wcaph-primary-soft: #162B43;
    --wcaph-secondary: #FF8A00;
    --wcaph-secondary-dark: #E67600;
    --wcaph-bg: #FFFFFF;
    --wcaph-border: rgba(15, 30, 47, 0.12);
    --wcaph-text: #0F1E2F;
    --wcaph-muted: #6B7280;
    --wcaph-shadow: 0 28px 80px rgba(15, 30, 47, 0.28);
    --wcaph-radius: 20px;
}

.wcaph-wrapper {
    align-items: center;
    margin: 0;
    direction: rtl;
    font-family: inherit;
    flex-grow: 1;
    display: flex;
}

.wcaph-open-chart {
    position: relative;
    display: inline-flex !important;
    align-items: center;
    justify-content: flex-start;
    flex-direction: row;
    gap: 10px;
    min-height: 44px;
    padding: 15px 20px !important;
    border: 1px solid transparent !important;
    border-radius: 10px !important;
    background:var(--wcaph-primary-soft) !important;
    color: #FFFFFF !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.6 !important;
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 30, 47, 0.10);
    transition: all 0.25s ease;
    overflow: hidden;
}

.wcaph-open-chart::before {
    content: "";
    width: 18px;
    height: 18px;
    display: inline-block;
    flex: 0 0 18px;
    background-color: var(--wcaph-secondary);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 3v18h18'/%3E%3Cpath d='m19 9-5 5-4-4-3 3'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg width='24' height='24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 3v18h18'/%3E%3Cpath d='m19 9-5 5-4-4-3 3'/%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

.wcaph-open-chart:hover, .wcaph-open-chart:focus {
    color: #FFFFFF !important;
    border-color: #FF8A00 !important;
    box-shadow: 0 12px 28px rgba(15, 30, 47, 0.20);
    transform: translateY(-2px);
    outline: none;
}

.wcaph-open-chart:active {
    transform: translateY(0);
}

.wcaph-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    width: 100vw;
    height: 100vh;
    padding: 20px;
    box-sizing: border-box;
    direction: rtl;
    font-family: inherit;
}

.wcaph-modal[style*="display: block"] {
    display: flex !important;
}

.wcaph-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1;
    background: rgba(15, 30, 47, 0.76);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: wcaphBackdropFade 0.22s ease forwards;
}

.wcaph-modal-content {
    position: relative;
    z-index: 2;
    width: min(920px, calc(100vw - 32px));
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    background: var(--wcaph-bg);
    color: var(--wcaph-text);
    border-radius: var(--wcaph-radius);
    box-shadow: var(--wcaph-shadow);
    overflow: hidden;
    animation: wcaphModalZoom 0.28s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}


.wcaph-close {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 5;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(15, 30, 47, 0.10);
    border-radius: 50%;
    background: #FFFFFF;
    color: var(--wcaph-primary);
    font-family: inherit;
    font-size: 26px;
    font-weight: 400;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 30, 47, 0.10);
    transition: all 0.25s ease;
}

.wcaph-close:hover,
.wcaph-close:focus {
    background: var(--wcaph-secondary);
    color: #FFFFFF;
    border-color: var(--wcaph-secondary);
    transform: rotate(90deg);
    outline: none;
}

.wcaph-chart-holder {
    position: relative;
    margin: 34px;
    padding: 22px;
    min-height: 390px;
    border: 1px solid var(--wcaph-border);
    border-radius: 18px;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.wcaph-chart-holder::before {
    content: "";
    position: absolute;
    inset: 14px;
    border-radius: 16px;
    background:
        linear-gradient(rgba(15, 30, 47, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 30, 47, 0.035) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

.wcaph-chart-holder canvas,
canvas.wcaph-chart {
    position: relative;
    z-index: 2;
    width: 100% !important;
    height: 350px !important;
    max-height: 350px !important;
    font-family: inherit !important;
}

.wcaph-message,
.wcaph-stats,
.wcaph-status,
.wcaph-modal-header,
.wcaph-product-title {
    display: none !important;
}

.wcaph-wrapper.is-loading .wcaph-open-chart,
.wcaph-open-chart.is-loading {
    pointer-events: none;
    opacity: 0.78;
}

.wcaph-wrapper.is-loading .wcaph-open-chart::after,
.wcaph-open-chart.is-loading::after {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: wcaphSpin 0.7s linear infinite;
}

.wcaph-lowest-30-badge {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 32px;
    padding: 15px 20px;
    border-radius: 10px;
    background: rgba(255, 138, 0, 0.12);
    color: #e97316;
    border: 1px solid rgba(255, 138, 0, 0.28);
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.7;
    flex-direction: row;
    gap: 10px;
    width: 100%;
    margin-top: 10px;
}

.wcaph-lowest-30-badge::before {
    content: "";
    width: 8px;
    height: 8px;
    margin-left: 7px;
    border-radius: 50%;
    background: var(--wcaph-secondary);
    box-shadow: 0 0 0 4px rgba(255, 138, 0, 0.14);
}

body.wcaph-modal-open {
    overflow: hidden;
}

.single-product .wcaph-wrapper {
    margin-top: 12px;
    margin-bottom: 12px;
}

.woocommerce div.product .wcaph-open-chart.button {
    margin: 0;
}

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

.wcaph-modal button {
    font-family: inherit;
}

@media (max-width: 900px) {
    .wcaph-modal {
        padding: 16px;
    }

    .wcaph-modal-content {
        width: min(760px, calc(100vw - 24px));
        max-height: calc(100vh - 32px);
    }

    .wcaph-chart-holder {
        min-height: 330px;
    }

    .wcaph-chart-holder canvas,
    canvas.wcaph-chart {
        height: 310px !important;
        max-height: 310px !important;
    }
}

@media (max-width: 600px) {
    .wcaph-wrapper {
        display: flex;
    }

    .wcaph-open-chart {
        min-height: 46px;
        padding: 15px 18px !important;
        font-size: 14px !important;
    }

    .wcaph-modal {
        padding: 10px;
        align-items: center;
    }

    .wcaph-modal-content {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        border-radius: 18px;
    }

    .wcaph-close {
        top: 12px;
        left: 12px;
        width: 36px;
        height: 36px;
        font-size: 23px;
    }

    .wcaph-chart-holder {
        margin: 24px 16px 18px;
        padding: 14px;
        min-height: 290px;
        border-radius: 16px;
    }

    .wcaph-chart-holder::before {
        inset: 10px;
        background-size: 22px 22px;
    }

    .wcaph-chart-holder canvas,
    canvas.wcaph-chart {
        height: 265px !important;
        max-height: 265px !important;
    }
}

@media (max-width: 390px) {
    .wcaph-modal {
        padding: 8px;
    }

    .wcaph-modal-content {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
    }

    .wcaph-chart-holder canvas,
    canvas.wcaph-chart {
        height: 235px !important;
        max-height: 235px !important;
    }
}

@keyframes wcaphBackdropFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes wcaphModalZoom {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }

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

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

@media (prefers-reduced-motion: reduce) {
    .wcaph-open-chart,
    .wcaph-close,
    .wcaph-modal-backdrop,
    .wcaph-modal-content,
    .wcaph-wrapper.is-loading .wcaph-open-chart::after,
    .wcaph-open-chart.is-loading::after {
        animation: none !important;
        transition: none !important;
    }
}
