/**
 * KAP Add To Cart Widget Styles
 */

.kap-atc {
    direction: rtl;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ─── Variations ─────────────────────────── */
.kap-atc__variations {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kap-atc__variation-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.kap-atc__variation-label {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    min-width: 80px;
    flex-shrink: 0;
}

.kap-atc__variation-select {
    flex: 1;
    padding: 10px 14px;
    border: 1.5px solid #e5e7eb;
    background: #ffffff;
    font-size: 14px;
    font-family: inherit;
    color: #111827;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%236b7280'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    direction: rtl;
}

.kap-atc__variation-select:focus {
    outline: none;
    border-color: #111827;
}

/* ─── Quantity ───────────────────────────── */
.kap-atc__qty-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f3f4f6;
    padding: 6px;
    gap: 0;
    user-select: none;
}

.kap-atc__qty-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
    color: #111827;
}

.kap-atc__qty-btn:hover {
    background: #e5e7eb;
}

.kap-atc__qty-btn:active {
    background: #d1d5db;
}

.kap-atc__qty-btn svg {
    width: 16px;
    height: 16px;
}

.kap-atc__qty-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 8px;
}

.kap-atc__qty-number {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    min-width: 24px;
    text-align: center;
    line-height: 1;
}

.kap-atc__qty-unit {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
}

/* ─── Add Button ─────────────────────────── */
.kap-atc__btn-add {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: #111827;
    color: #ffffff;
    border: none;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.kap-atc__btn-add:hover {
    background: #374151;
}

.kap-atc__btn-add:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.kap-atc__btn-add svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.kap-atc__btn-add.is-loading svg {
    animation: kap-atc-spin 0.8s linear infinite;
}

/* ─── Popup ──────────────────────────────── */
.kap-atc__popup {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}

.kap-atc__popup.is-open {
    display: flex;
}

.kap-atc__popup-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    animation: kap-atc-fade 0.25s ease;
}

/* Desktop: وسط صفحه */
.kap-atc__popup-box {
    position: relative;
    z-index: 1;
    background: #ffffff;
    padding: 32px 28px 28px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    animation: kap-atc-zoom 0.25s ease;
    direction: rtl;
}

.kap-atc__popup-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.kap-atc__popup-close:hover {
    background: #e5e7eb;
}

.kap-atc__popup-close svg {
    width: 16px;
    height: 16px;
    stroke: #374151;
}

.kap-atc__popup-icon {
    width: 56px;
    height: 56px;
    background: #f0fdf4;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.kap-atc__popup-icon svg {
    width: 28px;
    height: 28px;
    stroke: #16a34a;
}

.kap-atc__popup-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 24px;
    line-height: 1.5;
}

.kap-atc__popup-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kap-atc__popup-btn {
    display: block;
    width: 100%;
    padding: 13px 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
    border: none;
}

.kap-atc__popup-btn--cart {
    background: #111827;
    color: #ffffff;
}

.kap-atc__popup-btn--cart:hover {
    background: #374151;
    color: #ffffff;
}

.kap-atc__popup-btn--checkout {
    background: #f3f4f6;
    color: #111827;
    border: 1.5px solid #e5e7eb;
}

.kap-atc__popup-btn--checkout:hover {
    background: #e5e7eb;
    color: #111827;
}

/* ─── Mobile: slide from bottom ─────────── */
@media (max-width: 768px) {
    .kap-atc__popup {
        align-items: flex-end;
        justify-content: center;
    }

    .kap-atc__popup-overlay {
        backdrop-filter: none;
    }

    .kap-atc__popup-box {
        max-width: 100%;
        width: 100%;
        padding: 28px 20px 36px;
        animation: kap-atc-slide-up 0.3s cubic-bezier(0.32, 0.72, 0, 1);
        border-radius: 0;
    }
}

/* ─── Animations ─────────────────────────── */
@keyframes kap-atc-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes kap-atc-zoom {
    from {
        opacity: 0;
        transform: scale(0.94);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes kap-atc-slide-up {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes kap-atc-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ─── Contact Box ────────────────────────── */
.kap-atc__contact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: #fef9ec;
    border: 1.5px solid #f59e0b;
    text-align: center;
    direction: rtl;
}

.kap-atc__contact-status {
    width: 100%;
    padding: 8px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.kap-atc__contact-icon {
    width: 48px;
    height: 48px;
    background: #fef3c7;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kap-atc__contact-icon svg {
    width: 24px;
    height: 24px;
    stroke: #d97706;
}

.kap-atc__contact-text {
    font-size: 14px;
    font-weight: 600;
    color: #92400e;
    margin: 0;
    line-height: 1.6;
}

.kap-atc__contact-phone {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    text-decoration: none;
    direction: ltr;
    letter-spacing: 0.5px;
}

.kap-atc__contact-phone:hover {
    text-decoration: underline;
}

/* ─── Variation message ──────────────────── */
.kap-atc__variation-msg {
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

.kap-atc__variation-msg.is-unavailable {
    background: #ddffea;
    color: #25D366;
    border: 1px solid #fecaca;
}

/* error select */
.kap-atc__variation-select.kap-atc--error {
    border-color: #dc2626;
}