/* ساختار اصلی */
.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__select-wrap select {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.2s;
}

.dk-atc.is-busy select {
    background-color: #f4f4f4;
    border-color: #ccc;
    color: #888;
}

/* اسپینر مخصوص فیلدهای سلکت */
.dk-atc__field-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: #ef4d5a;
    border-radius: 50%;
    animation: dkspin 0.8s linear infinite;
    position: absolute;
    left: 10px;
    top: 50%;
    margin-top: -8px;
    display: none;
    z-index: 2;
}

.dk-atc.is-busy .dk-atc__field-spinner {
    display: block;
}

/* بخش اکشن‌ها */
.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;
}

/* بخش متغیرها */
.dk-atc__variations {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.dk-atc__select-wrap {
    display: flex;
    flex-direction: row; 
    align-items: center;
    gap: 10px;
    position: relative;
    width: 100%;
}

.dk-atc__select-label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
    min-width: 60px;
}

/* استایل مدرن برای Select Box */
.dk-atc__select-wrap select {
    width: 100%;
    padding: 10px 14px;
    padding-left: 35px;
    font-size: 14px;
    color: #333;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9L12 15L18 9' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 8px center;
    background-size: 18px;
}

.dk-atc__select-wrap select:focus {
    border-color: #ef4d5a;
    box-shadow: 0 0 0 3px rgba(239, 77, 90, 0.1);
    outline: none;
}

/* دکمه افزودن */
.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' !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; }

/* دکمه تسویه: فقط وقتی کلاس has-items روی والد وجود دارد */
.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;
}