:root{
    --cwc-bg: #f6f4f1;
    --cwc-surface: rgba(255,255,255,.72);
    --cwc-text: #3d2d25;
    --cwc-muted: #8f7d70;
    --cwc-primary: #b46b49;
    --cwc-primary-dark: #965437;
    --cwc-accent: #d9b89c;
    --cwc-border: rgba(125, 82, 57, 0.12);
    --cwc-danger: #b33232;
    --cwc-success: #2f8f5b;
    --cwc-shadow: 0 10px 30px rgba(82, 52, 35, 0.08);
    --cwc-radius-xl: 28px;
    --cwc-radius-lg: 20px;
    --cwc-radius-md: 14px;
    --cwc-container: 1280px;
    /* Font tokens fall back to the family/weight injected inline from settings */
    --cwc-general-font: var(--cwc-font-family, "iransans", sans-serif);
    --cwc-title-font: var(--cwc-font-family, "iransans", sans-serif);
    --cwc-title-size: 14px;
    /* Default column layout; overridden per-render via the inline --cwc-grid value */
    --cwc-grid: 72px minmax(0, 1.6fr) 0.8fr 120px 0.9fr 56px;
}

.cwc-page-wrap{
    max-width: var(--cwc-container);
    margin: 0 auto;
    padding: 64px 20px 60px;
    font-family: "iransans", sans-serif;
    direction: rtl;
    color: var(--cwc-text);
}

.cwc-page-wrap *{
    box-sizing: border-box;
}

.cwc-topbar{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.cwc-page-title{
    margin: 0;
    font-size: clamp(28px, 3vw, 42px);
    font-weight: 800;
    color: #8f563c;
}

.cwc-page-subtitle{
    margin: 16px 0 0;
    color: var(--cwc-muted);
    font-size: 15px;
}

.cwc-badge{
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255,255,255,.55);
    border: 1px solid var(--cwc-border);
    color: var(--cwc-muted);
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--cwc-shadow);
}

.cwc-dot{
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cwc-primary), var(--cwc-accent));
    box-shadow: 0 0 0 5px rgba(180,107,73,.10);
}

.cwc-hero-card{
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 22px;
}

.cwc-hero-card.cwc-no-summary{
    grid-template-columns: 1fr;
}

.cwc-glass-card{
    background: var(--cwc-surface);
    border: 1px solid rgba(255,255,255,.6);
    box-shadow: var(--cwc-shadow);
    border-radius: var(--cwc-radius-xl);
    backdrop-filter: blur(14px);
}

.cwc-cart-panel,
.cwc-summary-panel{
    padding: 18px;
    height: max-content;
}

.cwc-summary-panel{
    position: sticky;
    top: 20px;
    height: fit-content;
}

.cwc-panel-head{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 10px 10px 16px;
}

.cwc-panel-title{
    font-size: 20px;
    font-weight: 800;
    margin: 0;
}

.cwc-soft-chip{
    padding: 8px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(180,107,73,.12), rgba(217,184,156,.2));
    color: var(--cwc-primary-dark);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(180,107,73,.14);
}

.cwc-cart-table{
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cwc-cart-header{
    display: grid;
    grid-template-columns: var(--cwc-grid);
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    background: rgba(120, 92, 75, 0.07);
    border: 1px solid var(--cwc-border);
    border-radius: 18px;
    color: #6c5648;
    font-size: 14px;
    font-weight: 700;
}

.cwc-cart-item{
    display: grid;
    grid-template-columns: var(--cwc-grid);
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: rgba(255,255,255,.75);
    border: 1px solid var(--cwc-border);
    border-radius: 22px;
    transition: .25s ease;
}

.cwc-cart-header div{
    display: flex;
    justify-content: center;
    align-items: center;
}

.cwc-col-thumb,
.cwc-col-price,
.cwc-col-qty,
.cwc-col-subtotal,
.cwc-col-remove{
    display: flex;
    align-items: center;
    justify-content: center;
}

.cwc-col-product{
    justify-content: flex-start;
}
.cwc-thumb{
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, #f1dfd2, #e8c8af);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 30px;
}

.cwc-thumb img{
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cwc-col-product,
.cwc-col-price,
.cwc-col-qty,
.cwc-col-subtotal,
.cwc-col-remove{
    min-width: 0;
}

.cwc-product-title{
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 14px;
    color: var(--cwc-text);
}

.cwc-product-title a{
    color: inherit;
    text-decoration: none;
}

.cwc-product-meta{
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--cwc-muted);
    font-size: 13px;
}

.cwc-meta-pill{
    padding: 5px 10px;
    border-radius: 999px;
    background: #f7efe8;
    border: 1px solid rgba(180,107,73,.10);
}

.cwc-price,
.cwc-subtotal{
    font-weight: 700;
    color: #5f4538;
    font-size: 15px;
}

.cwc-qty-box{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--cwc-border);
    border-radius: 999px;
    padding: 8px 12px;
    min-width: 108px;
    max-width: 100%;
}

.cwc-qty-btn{
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #f3e7de;
    color: #7f513a;
    font-size: 18px;
    cursor: pointer;
}

.cwc-remove-btn{
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 14px;
    background: rgba(179,50,50,.08);
    color: var(--cwc-danger);
    font-size: 18px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cwc-coupon-box{
    margin-top: 18px;
    display: flex;
    padding: 12px 0 32px 0;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,.6), rgba(255,255,255,.35));
}

.cwc-coupon-box #cwc-coupon-code{
    flex: 1;
    border: 1px solid var(--cwc-border);
    background: rgba(255,255,255,.85);
    border-radius: 14px !important;
    padding: 14px 16px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    color: var(--cwc-text);
}

.cwc-btn , #cwc-apply-coupon{
    color: #fff;
    border: none;
    border-radius: 16px;
    padding: 14px 18px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: .25s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cwc-btn-primary{
    background: linear-gradient(135deg, var(--cwc-primary), var(--cwc-primary-dark));
    color: #fff;
    box-shadow: 0 10px 18px rgba(180,107,73,.22);
}

.cwc-btn-soft{
    background: #f4ebe4 !important;
    color: #7f513a !important;
    border: 1px solid rgba(180,107,73,.14) !important;
}

.cwc-summary-card{
    border-radius: 24px;
    padding: 0px;
}

.cwc-summary-top{
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.cwc-summary-title{
    margin: 0;
    font-size: 20px;
    font-weight: 800;
}

.cwc-summary-icon{
    width: 48px;
    height: 48px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(180,107,73,.16), rgba(217,184,156,.22));
    color: var(--cwc-primary-dark);
    font-size: 22px;
    overflow: hidden;
}

.cwc-summary-icon img{
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.cwc-summary-list{
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

.cwc-summary-row{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: #6b5548;
    font-size: 15px;
}

.cwc-divider{
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(120,92,75,.18), transparent);
    margin: 24px 0;
}

.cwc-summary-total{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(180,107,73,.05), rgba(217,184,156,.08));
    border: 1px solid rgba(180,107,73,.14);
}

.cwc-label{
    font-weight: 800;
    font-size: 16px;
    color: #6d4633;
}

.cwc-amount{
    font-weight: 900;
    font-size: 24px;
    color: var(--cwc-primary-dark);
}

.cwc-summary-actions{
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 18px;
}

.cwc-full{
    width: 100%;
}

.cwc-trust-box{
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.cwc-trust-item{
    text-align: center;
    padding: 12px 10px;
    border-radius: 18px;
    background: rgba(255,255,255,.65);
    border: 1px solid var(--cwc-border);
}

.cwc-icon{
    font-size: 20px;
    margin-bottom: 6px;
}

.cwc-text{
    font-size: 12px;
    color: var(--cwc-muted);
    line-height: 1.7;
}

.cwc-note-box{
    margin-top: 18px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(47,143,91,.08);
    border: 1px solid rgba(47,143,91,.16);
    color: #2d6c49;
    font-size: 13px;
    line-height: 1.9;
}

.cwc-success{
    color: var(--cwc-success);
}

.cwc-message{
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
    display: none !important;
}

.cwc-message.success{
    background: rgba(47,143,91,.08);
    color: #2d6c49;
    border: 1px solid rgba(47,143,91,.16);
}

.cwc-message.error{
    background: rgba(179,50,50,.08);
    color: #8e2828;
    border: 1px solid rgba(179,50,50,.16);
}

.cwc-empty-cart{
    text-align: center;
    padding: 50px 20px;

}

.cwc-empty-icon{
    font-size: 54px;
    margin-bottom: 12px;
}

.cwc-admin-wrap{
    max-width: 1400px;
}

.cwc-admin-form{
    margin-top: 20px;
}

.cwc-admin-grid{
    display: grid;
    grid-template-columns: repeat(2, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.cwc-admin-card{
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 6px 18px rgba(0,0,0,.04);
}

.cwc-admin-card h2{
    margin-top: 0;
    margin-bottom: 16px;
}

.cwc-admin-card .form-table{
    margin-top: 0;
}

.cwc-admin-card .form-table th{
    width: 180px;
}


/* ۱. استایل و هاور دکمه‌های اصلی و "ذخیره برای بعد" (.cwc-btn-soft) */
.cwc-btn {
    font-family: var(--cwc-general-font);
    transition: all 0.3s ease;
    cursor: pointer;
}
.cwc-btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.cwc-btn-soft {
    transition: all 0.3s ease;
}
.cwc-btn-soft:hover {
    background-color: #e5d5c9; /* کمی تیره‌تر از پس‌زمینه فعلی */
    color: #5c3a27;
    transform: translateY(-2px);
}

/* ۲. استایل و هاور دکمه حذف (.cwc-remove-btn) */
.cwc-remove-btn {
    transition: all 0.3s ease !important;
    color: #5c3a27 !important;
    border: 1px solid #fadbd8 !important;
    border-radius: 12px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
}
.cwc-remove-btn:hover {
    background-color: #e74c3c !important;
    color: #ffffff !important;
    transform: scale(1.05) !important;
}

/* ۳. استایل ورودی کد تخفیف و دکمه اعمال */
.cwc-coupon-box input {
    font-family: var(--cwc-general-font);
    padding: 10px 15px;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.3s ease;
}
.cwc-coupon-box input:focus {
    border-color: var(--cwc-primary);
}
#cwc-apply-coupon {
    border-radius: 12px;
    margin-right: 10px; /* فاصله بین اینپوت و دکمه در فارسی (RTL) */
}

/* ۵. اعمال متغیرهای فونت روی عنوان محصول */
.cwc-product-title {
    font-family: var(--cwc-title-font);
    font-weight: 600;
    font-size: var(--cwc-title-size);
}
.cwc-summary-actions a.cwc-btn-primary:active,
.cwc-summary-actions a.cwc-btn-primary:hover{
    color: #fff !important;
}

.cwc-empty-actions{
    margin-top: 22px;
}


/* =========================================================
   Responsive rules — kept last so they win over the
   single-class declarations above at equal specificity.
   ========================================================= */
@media (max-width: 1024px){
    .cwc-hero-card{
        grid-template-columns: 1fr;
    }

    .cwc-summary-panel{
        position: static;
    }

    .cwc-admin-grid{
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px){
    .cwc-page-wrap{
        padding: 48px 14px 40px;
    }

    .cwc-topbar{
        flex-direction: column;
        align-items: flex-start;
    }

    /* Header labels are hidden; each stacked cell carries its own label */
    .cwc-cart-header{
        display: none;
    }

    /* Stack as a card: thumbnail + title share the top row, the rest below */
    .cwc-cart-item{
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 12px;
    }

    .cwc-col-thumb{
        flex: 0 0 auto;
        justify-content: flex-start;
    }

    .cwc-col-product{
        flex: 1 1 0;
        min-width: 0;
    }

    .cwc-col-price,
    .cwc-col-qty,
    .cwc-col-subtotal{
        flex: 1 1 100%;
        justify-content: space-between;
    }

    .cwc-col-price::before,
    .cwc-col-qty::before,
    .cwc-col-subtotal::before{
        content: attr(data-label);
        color: var(--cwc-muted);
        font-size: 13px;
        font-weight: 600;
    }

    .cwc-col-remove{
        flex: 1 1 100%;
        justify-content: flex-end;
    }

    .cwc-thumb{
        width: 72px;
        height: 72px;
    }

    .cwc-cart-panel,
    .cwc-summary-panel{
        padding: 14px;
    }

    .cwc-coupon-box{
        flex-direction: column;
        gap: 16px;
    }

    .cwc-btn{
        width: 100%;
    }

    #cwc-apply-coupon{
        margin-right: 0;
    }
}

@media (max-width: 420px){
    .cwc-trust-box{
        grid-template-columns: 1fr;
    }

    .cwc-amount{
        font-size: 20px;
    }
}