/* ساختار اصلی */
.dk-atc {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px;
    width: 100%;
    font-family: inherit;
    position: relative;
}

/* افکت لودینگ */
.dk-atc.is-busy {
    cursor: wait;
}

.dk-atc.is-busy .dk-atc__actions,
.dk-atc.is-busy .dk-atc__options-list {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.2s;
}

/* بخش اکشن‌ها */
.dk-atc__actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: 100%;
    min-height: 42px;
}

.dk-atc.has-items .dk-atc__actions {
    max-width: max-content;
}

/* --- استایل جدید دکمه‌های انتخاب (Swatches) --- */
.dk-atc__variations {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    margin-bottom: 5px;
}

.dk-atc__group-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.dk-atc__label-row {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.dk-atc__select-label {
    font-weight: 500;
    color: #81858b;
}

.dk-atc__selected-val {
    font-weight: 700;
    color: #3f4064;
}

.dk-atc__options-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dk-atc__option-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 40px;
    padding: 0 12px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    color: #3f4064;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    user-select: none;
}

.dk-atc__option-btn:hover {
    border-color: #81858b;
}

/* حالت انتخاب شده: حاشیه ضخیم مشکی */
.dk-atc__option-btn.is-selected {
    border: 2px solid #000;
    /* یا رنگ مشکی برند */
    color: #000;
    font-weight: 700;
    background: #fff;
}

/* دکمه افزودن */
.dk-atc__btn {
    width: 100% !important;
    background-color: #ef4d5a !important;
    color: #fff !important;
    border: 0;
    border-radius: 0.5rem !important;
    font-size: 15px !important;
    cursor: pointer !important;
    height: 42px;
    font-weight: 500;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 100%;
    gap: 0.5rem;
}

.dk-atc__btn:hover {
    background-color: #d63d4a !important;
}

.dk-atc__btn.is-hidden {
    display: none;
}

.dk-atc__btn .spinner {
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* کنترل تعداد */
.dk-atc__qty {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid #eee;
    border-radius: 0.5rem;
    padding: 0.2rem;
    position: relative;
    background: #fff;
    height: 42px;
    box-sizing: border-box;
}

.dk-atc__qty.is-hidden {
    display: none;
}

.dk-atc__minus,
.dk-atc__plus,
.dk-atc__trash {
    width: 32px !important;
    height: 32px;
    border-radius: 0.5rem !important;
    background-color: #EF4056 !important;
    cursor: pointer !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
}

.dk-atc__minus img,
.dk-atc__plus img,
.dk-atc__trash img {
    margin: auto;
    width: 14px;
    height: 14px;
    display: block;
    filter: brightness(0) invert(1);
}

.dk-atc__trash {
    border: 1px solid #ef4d5a !important;
}

.dk-atc__trash img {
    filter: none;
}

.dk-atc__plus.is-disabled {
    opacity: .5;
    cursor: not-allowed;
    background-color: #ccc !important;
}

.dk-atc__count {
    font-family: 'vazir-fd', inherit !important;
    min-width: 30px;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    color: #333;
    display: flex;
    flex-direction: column;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, .5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: dkspin 0.8s linear infinite;
    display: none;
}

.dk-atc__qty .spinner {
    border-color: rgba(239, 77, 90, .3);
    border-top-color: #ef4d5a;
    position: absolute;
    left: 50%;
    margin-left: -10px;
}

.is-loading .spinner {
    display: inline-block;
}

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

.dk-atc__oos {
    display: inline-block;
    padding: 0 12px;
    border-radius: 8px;
    background: #f9f9f9;
    color: #666;
    font-weight: 500;
    width: 100%;
    text-align: center;
    border: 1px dashed #ccc;
    line-height: 40px;
    height: 42px;
}

.dk-atc__oos.is-hidden {
    display: none;
}

/* دکمه تسویه */
.dk-atc .dk-chckt__btn {
    display: none;
}

.dk-atc.has-items .dk-chckt__btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: max-content;
    background: #2c3e50;
    color: #fff;
    border-radius: 0.5rem;
    font-size: 14px !important;
    padding: 0 16px;
    height: 42px;
    text-decoration: none;
    font-weight: 500;
    flex: 1 1 max-content;
}

.dk-chckt__btn:hover {
    background: #34495e;
    color: #fff;
}

.dk-atc__qty:has(> .dk-atc__plus.is-disabled) .dk-atc__count::after {
    content: 'حداکثر';
    font-size: 9px;
    font-weight: 500;
    color: #999;
    margin-top: -2px;
}

.dk-atc__qty:has(.spinner:not([hidden])) .dk-atc__count {
    visibility: hidden;
}

.dk-atc.is-busy .dk-atc__btn,
.dk-atc.is-busy .dk-atc__minus,
.dk-atc.is-busy .dk-atc__plus,
.dk-atc.is-busy .dk-atc__trash {
    pointer-events: none;
    opacity: .6;
}

.dk-atc.dk-atc--variable.has-items .dk-atc__actions {
    width: max-content;
}