/* ==========================================================================
   GK Cart Action – Styles
   ========================================================================== */

/* احترام به hidden */
[hidden] {
    display: none !important;
}

.gk-cart-widget {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
    position: relative;
    min-height: 70px; /* برای جلوگیری از پرش در زمان لودینگ */
}

/* --- Skeleton Loader --- */
@keyframes gk-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.shimmer-bg {
    background-color: #e9eef2;
    position: relative;
    overflow: hidden;
}
.shimmer-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: gk-shimmer 1.5s infinite;
}

.gk-cart-skeleton {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    opacity: 1;
    transition: opacity 0.3s;
}
.skeleton-line {
    height: 1.5em;
    width: 80%;
    border-radius: 6px;
    margin-bottom: 8px;
}
.skeleton-button {
    height: 44px;
    width: 180px;
    border-radius: 10px;
}

/* کنترل نمایش محتوای واقعی و اسکلت */
.gk-cart-widget.is-loading .gk-cart-skeleton { display: flex; }
.gk-cart-widget:not(.is-loading) .gk-cart-skeleton { display: none; }

.gk-cart-widget.is-loading > *:not(.gk-cart-skeleton) {
    visibility: hidden;
    opacity: 0;
}


/* --- Real Content --- */
.gk-cart-selection {
    font-size: 13px;
    color: #555;
    min-height: 1.5em;
    transition: opacity 0.2s;
}
.gk-cart-selection:empty {
    opacity: 0;
    margin-bottom: 0;
}
.gk-cart-selection:not(:empty) {
    margin-bottom: 8px;
}

.gk-cart-add {
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    height: 44px;
    padding: 0 16px;
    border-radius: 10px;
    border: 0;
    background: #ec5664;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s, transform .06s;
    width: 100%;
}
.gk-cart-add:hover { filter: brightness(0.98); }
.gk-cart-add:active { transform: translateY(1px); }
.gk-cart-add.is-disabled, .gk-cart-add:disabled { opacity: .5; cursor: not-allowed; }
.gk-cart-add.is-loading { opacity: .7; pointer-events: none; }

.gk-cart-qty {
    display: flex; align-items: center; gap: 10px;
    background: #fff; border: 1px solid #e3e6ea; border-radius: 12px;
    padding: 6px 10px; min-height: 40px;
}
.gk-cart-qty.is-loading { opacity: .6; pointer-events: none; }
.gk-cart-num { min-width: 20px; text-align: center; font-weight: 700; }
html[dir="rtl"] .gk-cart-qty { flex-direction: row-reverse; }

.gk-cart-minus, .gk-cart-plus, .gk-cart-remove {
    width: 28px; height: 28px; border-radius: 6px; background: #fff;
    font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    transition: opacity .15s, transform .15s, border-color .15s;
}
.gk-cart-plus, .gk-cart-minus { border: 1px solid #cfd6dc; }
.gk-cart-plus.is-disabled { opacity: .5; cursor: not-allowed; }

.gk-cart-action-toggle { position: relative; width: 28px; height: 28px; }
.gk-cart-minus, .gk-cart-remove { position: absolute; inset: 0; }
.gk-cart-remove { border: 1px dashed #ec5664; color: #ec5664; }

.gk-cart-minus { opacity: 0; transform: scale(0.7); pointer-events: none; }
.gk-cart-remove { opacity: 1; transform: scale(1); pointer-events: auto; }
.gk-cart-qty.is-multiple .gk-cart-minus { opacity: 1; transform: scale(1); pointer-events: auto; }
.gk-cart-qty.is-multiple .gk-cart-remove { opacity: 0; transform: scale(0.7); pointer-events: none; }

.gk-cart-max { color: #9aa1a7; font-size: 12px; }
.gk-cart-note { color: #4a4f55; font-size: 14px; }
.gk-cart-note a { color: #06a2c1; text-decoration: none; }
.gk-cart-note a:hover { text-decoration: underline; }

/* ========================= Toast =========================
   – سنتر دقیق در پایین صفحه
   – انیمیشن فقط روی محتوای داخلی تا ترنسفورم افقی به هم نخورد
   – آیکن SVG با افکت draw
   ======================================================== */

#gk-toast{
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
    transform: translateX(-50%);
    z-index: 99999;
    pointer-events: none; /* کلیک‌ها فقط روی اینر فعال است */
    width: max-content;
    max-width: min(92vw, 620px);
}

#gk-toast .gk-toast-inner{
    pointer-events: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.12);
    padding: 10px 12px;
    display: flex; align-items: center; gap: 12px;
    border: 1px solid #e2e6ea;

    /* انیمیشن ورود/خروج (فقط عمودی) */
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .22s ease, transform .22s ease;
}
#gk-toast.show .gk-toast-inner{
    opacity: 1;
    transform: translateY(0);
}

/* محتوای داخل توست */
.gk-toast-msg { color: #15803d; font-weight: 700; white-space: nowrap; }
.gk-toast-link {
    margin-inline-start: 8px; white-space: nowrap;
    color: #374151; text-decoration: none;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 8px; border-radius: 8px;
    background: #f3f4f6; border: 1px solid #e5e7eb;
}
.gk-toast-link:hover { background: #eef2ff; border-color: #dbeafe; }
.gk-toast-link::before { content: '‹'; font-size: 16px; line-height: 1; }

.gk-toast-close {
    margin-inline-start: 8px;
    background: transparent; border: 0;
    font-size: 18px; line-height: 1;
    color: #6b7280; cursor: pointer; padding: 2px;
    border-radius: 6px;
}
.gk-toast-close:hover { background: #f3f4f6; color: #111827; }

/* آیکن draw */
.gk-ico { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; }
.gk-ico svg{ width:22px; height:22px; display:block; }
.gk-ico .gk-circ{
    stroke:#16a34a; stroke-width:2; fill:none; opacity:.22;
    stroke-dasharray:160; stroke-dashoffset:160;
    animation:gk-draw 600ms ease forwards;
}
.gk-ico .gk-tick{
    stroke:#16a34a; stroke-width:3; fill:none; stroke-linecap:round; stroke-linejoin:round;
    stroke-dasharray:48; stroke-dashoffset:48;
    animation:gk-draw 450ms 150ms ease-out forwards;
}
@keyframes gk-draw { to { stroke-dashoffset: 0; } }

/* فرم سایه */
.gk-shadow-form {
    position: absolute !important; width: 1px !important; height: 1px !important;
    padding: 0 !important; margin: -1px !important; overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important; clip-path: inset(50%) !important;
    border: 0 !important; white-space: nowrap !important;
}

/* وضعیت‌های باکس تعداد */
.gk-cart-qty.is-pending { opacity: .7; pointer-events: none; }
.gk-cart-qty.is-loading::after {
    content: ''; display: inline-block; width: .9em; height: .9em;
    margin-inline-start: .5em; border-radius: 50%;
    border: 2px solid currentColor; border-top-color: transparent;
    animation: gkspin .7s linear infinite;
}
@keyframes gkspin { to { transform: rotate(360deg); } }

/* کانتینر برای عدد تعداد و متن "حداکثر" */
.gk-cart-qty .gk-cart-num-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-width: 40px;
    margin: 0 4px;
}

/* متن "حداکثر" */
.gk-cart-max {
    font-size: 10px;
    font-weight: bold;
    color: #e53935;
    line-height: 1.2;
    margin-top: 4px;
    display: block;
}

/* دکمه مثبت غیرفعال */
.gk-cart-plus.is-disabled { opacity: 0.5; cursor: not-allowed; }
