/* ============================================
   Custom WooCommerce Cart - Frontend Styles
   Version 3.0
   ============================================ */

body.cwc-cart-page {
    margin: 0;
    padding: 0;
    background: #f5f5f5;
    font-family: Tahoma, Arial, sans-serif;
    color: var(--cwc-text-color, #333);
    font-size: var(--cwc-base-font, 16px);
}

body.cwc-cart-page header.site-header,
body.cwc-cart-page footer.site-footer,
body.cwc-cart-page #header,
body.cwc-cart-page #footer {
    display: none !important;
}

.cwc-cart-container {
    max-width: 100%;
    margin: 0 auto;
    padding-bottom: 120px;
    padding-top: 70px;
}

/* ============ هدر ============ */
.cwc-mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    height: 70px;
    transition: height 0.3s;
}

.cwc-mobile-header.shrink {
    height: 55px;
}

.cwc-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 15px;
    position: relative;
}

.cwc-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cwc-cart-title {
    font-size: 16px;
    font-weight: bold;
    color: #000;
}

.cwc-product-count {
    background: var(--cwc-button-bg, #007cba);
    color: var(--cwc-button-text, #fff);
    padding: 2px 10px;
    border-radius: 15px;
    font-size: 12px;
}

/* لوگو در مرکز */
.cwc-header-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    max-width: 120px;
    max-height: 50px;
}

.cwc-header-logo a {
    text-decoration: none;
    display: block;
}

.cwc-header-logo img {
    max-width: 120px;
    max-height: 50px;
    object-fit: contain;
}

.cwc-header-logo span {
    font-size: 16px;
    font-weight: bold;
    color: #000;
}

.cwc-menu-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
}

.cwc-mobile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: none;
    z-index: 1001;
}

.cwc-mobile-menu.active {
    display: block;
}

.cwc-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: #333;
}

/* ============ نوار اعتماد ============ */
.cwc-trust-bar {
    background: #fff;
    padding: 15px 0;
    margin-bottom: 20px;
}

.cwc-trust-slider {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 0 20px;
}

.cwc-trust-item {
    flex: 0 0 80px;
    text-align: center;
    cursor: pointer;
}

.cwc-trust-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-bottom: 5px;
}

.cwc-trust-title {
    font-size: 12px;
    display: block;
}

/* ============ محصولات ============ */
.cwc-products {
    padding: 0 15px;
}

.cwc-product-item {
    background: #fff;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.cwc-product-row {
    display: flex;
    gap: 15px;
    padding: 15px;
}

.cwc-product-image {
    flex: 0 0 100px;
}

.cwc-product-image img {
    width: 100%;
    border-radius: 4px;
}

.cwc-product-details {
    flex: 1;
}

.cwc-product-title {
    margin: 0 0 10px;
    font-size: var(--cwc-title-font, 18px);
    color: #000;
}

.cwc-product-prices {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cwc-regular-price {
    text-decoration: line-through;
    color: #999;
    font-size: 14px;
}

.cwc-sale-price,
.cwc-price {
    color: var(--cwc-price-color, #77a464);
    font-weight: bold;
    font-size: var(--cwc-price-font, 16px);
}

.cwc-discount-badge {
    background: var(--cwc-discount-color, #e2401c);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* ============ کنترل تعداد ============ */
.cwc-product-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
}

.cwc-quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.cwc-qty-btn {
    width: 30px;
    height: 30px;
    background: #f5f5f5;
    border: none;
    cursor: pointer;
    font-size: 18px;
}

.cwc-qty-input {
    width: 50px;
    height: 30px;
    text-align: center;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    font-size: 14px;
}

.cwc-remove-item {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    color: #e2401c;
}

/* متن حمل و نقل - بک گراند زرد */
.cwc-shipping-info {
    margin-left: auto;
    font-size: 12px;
    color: #333;
    background: #fff3cd;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #ffc107;
}

/* ============ لودینگ ============ */
.cwc-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cwc-loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--cwc-primary, #007cba);
    border-radius: 50%;
    animation: cwc-spin 1s linear infinite;
}

@keyframes cwc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============ HTML سفارشی ============ */
.cwc-custom-html {
    padding: 20px 15px;
    background: #fff;
    margin: 20px 0;
    border-radius: 8px;
}

/* ============ تگ‌های رنگی ============ */
.cwc-category-tags-section {
    padding: 20px 15px;
    background: #fff;
    margin: 20px 0;
}

.cwc-category-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cwc-category-tag {
    display: inline-block;
    padding: 8px 16px;
    color: #fff !important;
    text-decoration: none;
    border-radius: 20px;
    font-size: 14px;
    transition: opacity 0.3s;
}

.cwc-category-tag:hover {
    opacity: 0.8;
    color: #fff !important;
}

/* رنگ‌های رندوم برای تگ‌ها */
.cwc-tag-random-color:nth-child(8n+1) { background: #e74c3c; }
.cwc-tag-random-color:nth-child(8n+2) { background: #3498db; }
.cwc-tag-random-color:nth-child(8n+3) { background: #2ecc71; }
.cwc-tag-random-color:nth-child(8n+4) { background: #9b59b6; }
.cwc-tag-random-color:nth-child(8n+5) { background: #e67e22; }
.cwc-tag-random-color:nth-child(8n+6) { background: #1abc9c; }
.cwc-tag-random-color:nth-child(8n+7) { background: #d35400; }
.cwc-tag-random-color:nth-child(8n+8) { background: #c0392b; }

/* ============ کاروسل ============ */
.cwc-cross-sell,
.cwc-upsell {
    padding: 20px 15px;
    background: #fff;
    margin-bottom: 20px;
}

.cwc-cross-sell h2,
.cwc-upsell h2 {
    margin: 0 0 15px;
    font-size: 18px;
    color: #000;
}

.cwc-carousel {
    position: relative;
    overflow: hidden;
    padding: 0 40px;
}

.cwc-carousel-track {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 10px 0;
    -webkit-overflow-scrolling: touch;
}

.cwc-carousel-track::-webkit-scrollbar {
    display: none;
}

.cwc-carousel-item {
    flex: 0 0 180px;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.cwc-carousel-link {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.cwc-carousel-image {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cwc-carousel-image img {
    max-width: 100%;
    max-height: 150px;
    object-fit: contain;
}

.cwc-carousel-title {
    font-size: 14px;
    color: #000;
    line-height: 1.3;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cwc-carousel-price {
    font-size: 14px;
}

.cwc-view-product {
    width: 100%;
    padding: 10px;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.cwc-view-product:hover {
    background: var(--cwc-button-bg, #007cba);
    color: var(--cwc-button-text, #fff);
}

.cwc-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
}

.cwc-carousel-btn.prev {
    right: 5px;
}

.cwc-carousel-btn.next {
    left: 5px;
}

/* ============ سبد خالی ============ */
.cwc-empty-cart {
    text-align: center;
    padding: 50px 20px;
}

/* ============ فوتر فیکس ============ */
.cwc-fixed-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 10px 15px;
}

.cwc-footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.cwc-footer-right {
    flex: 1;
}

.cwc-footer-count {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 3px;
}

.cwc-footer-prices {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cwc-footer-total {
    font-weight: bold;
    font-size: 16px;
    color: #000;
}

.cwc-footer-discount {
    color: var(--cwc-discount-color, #e2401c);
    font-size: 12px;
}

/* دکمه ثبت سفارش - قرمز و بزرگتر */
.cwc-checkout-btn {
    display: inline-block;
    padding: 15px 30px;
    background: var(--cwc-checkout-button-bg, #e2401c);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 18px;
    white-space: nowrap;
    transition: all 0.3s;
}

.cwc-checkout-btn:hover {
    opacity: 0.8;
    color: #fff;
    transform: translateY(-2px);
}

/* ============ پاپ‌آپ نوار اعتماد ============ */
.cwc-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cwc-popup-overlay.active {
    display: flex;
}

.cwc-popup-content {
    background: #fff;
    border-radius: 8px;
    max-width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    padding: 20px;
}

.cwc-popup-close {
    background: #e2401c;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

/* ============ پاپ‌آپ محصول ============ */
.cwc-product-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cwc-product-popup-wrapper {
    background: #fff;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.cwc-product-popup-close {
    background: #e2401c;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
}

.cwc-product-popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-top: 50px;
    padding-bottom: 20px;
}

.cwc-product-popup-gallery img {
    width: 50%;
    height: auto;
    border-radius: 8px;
    margin: 0 auto 15px;
    display: block;
}

.cwc-product-popup-title {
    font-size: 18px;
    font-weight: bold;
    color: #000;
    margin: 15px 0;
    text-align: center;
}

/* قیمت بزرگتر و بولد */
.cwc-product-popup-price {
    font-size: 22px;
    font-weight: bold;
    margin: 15px 0;
    text-align: center;
}

.cwc-product-popup-short-desc {
    margin: 15px 0;
    color: #333;
    line-height: 1.8;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    font-size: 14px;
}

.cwc-toggle-full-desc {
    width: 100%;
    padding: 12px;
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}

.cwc-product-popup-full-desc {
    margin-top: 15px;
    color: #333;
    line-height: 1.8;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    font-size: 14px;
}

.cwc-product-popup-fixed-footer {
    flex-shrink: 0;
    background: #fff;
    padding: 15px 20px;
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.cwc-popup-footer-variations {
    margin-bottom: 10px;
    max-height: 150px;
    overflow-y: auto;
}

.cwc-variation-field {
    margin-bottom: 10px;
}

.cwc-variation-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
    font-size: 13px;
}

.cwc-variation-field select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

/* دکمه افزودن به سبد قرمز */
.cwc-product-popup-add-to-cart {
    width: 100%;
    padding: 15px;
    background: #e2401c;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
}

.cwc-product-popup-add-to-cart:hover {
    background: #c03517;
}

/* ============ Responsive ============ */
@media (min-width: 768px) {
    .cwc-cart-container {
        max-width: 800px;
        padding: 80px 20px 140px;
    }
}

@media (max-width: 767px) {
    .cwc-product-image {
        flex: 0 0 80px;
    }
    
    .cwc-product-title {
        font-size: 14px;
    }
    
    .cwc-checkout-btn {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .cwc-carousel-item {
        flex: 0 0 150px;
    }
    
    .cwc-product-popup-wrapper {
        max-width: 100%;
        height: 95vh;
    }
    
    .cwc-header-logo {
        max-width: 80px;
    }
    
    .cwc-header-logo img {
        max-width: 80px;
        max-height: 40px;
    }
    
    .cwc-cart-title {
        font-size: 14px;
    }
}
/* هدر - چیدمان با flex و ترتیب مشخص */
.cwc-mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 1000;
    height: 70px;
    transition: height 0.3s;
}

.cwc-header-content {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 15px;
    gap: 10px;
}

/* 1- دکمه ضربدر */
.cwc-back-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #333;
    padding: 5px;
    line-height: 1;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.cwc-back-btn:hover {
    transform: scale(1.2);
    color: #e2401c;
}

/* 2- سبد خرید و تعداد کالا */
.cwc-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.cwc-cart-title {
    font-size: 16px;
    font-weight: bold;
    color: #000;
}

.cwc-product-count {
    background: var(--cwc-button-bg, #007cba);
    color: var(--cwc-button-text, #fff);
    padding: 2px 10px;
    border-radius: 15px;
    font-size: 12px;
    white-space: nowrap;
}

/* 3- لوگو */
.cwc-header-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin: 0 5px;
}

.cwc-header-logo a {
    text-decoration: none;
    display: block;
    line-height: 0;
}

.cwc-header-logo img {
    display: block;
    height: auto;
    width: auto;
}

/* 4- فضای خالی */
.cwc-header-spacer {
    flex: 1;
}

/* 5- منوی تاگل */
.cwc-menu-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    color: #333;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.cwc-menu-btn:hover {
    transform: scale(1.1);
}

/* منوی کشویی */
.cwc-mobile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: none;
    z-index: 1001;
}

.cwc-mobile-menu.active {
    display: block;
}

.cwc-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: #333;
    transition: background 0.2s;
}

.cwc-menu-item:hover {
    background: #f5f5f5;
}

/* موبایل */
@media (max-width: 767px) {
    .cwc-header-logo img {
        max-width: 60px;
    }
    
    .cwc-cart-title {
        font-size: 13px;
    }
    
    .cwc-product-count {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .cwc-back-btn {
        font-size: 20px;
    }
    
    .cwc-menu-btn {
        font-size: 20px;
    }
}