/**
 * WooCommerce Custom Styles - نسخه مستقل
 * بدون نیاز به کلاس .woocommerce روی parent
 */

/* ========================================
   1. Product Cards - مستقل از parent
   ======================================== */

li.product,
.product {
    list-style: none !important;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

li.product:hover,
.product:hover {
    transform: translateY(-8px);
}

/* تصاویر محصول */
li.product a img,
.product a img,
li.product img,
.product img {
    border-radius: 1rem !important;
    aspect-ratio: 3/4 !important;
    object-fit: cover !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

li.product:hover a img,
.product:hover a img {
    box-shadow: 0 20px 40px rgba(20, 83, 45, 0.2) !important;
}

/* عنوان محصول */
li.product .woocommerce-loop-product__title,
.product .woocommerce-loop-product__title,
li.product h2.woocommerce-loop-product__title,
.product h2.woocommerce-loop-product__title,
li.product h2,
.product h2 {
    font-size: 0.875rem !important;
    font-weight: 700 !important;
    color: #1c1917 !important;
    margin: 0.75rem 0 0.25rem !important;
    padding: 0 !important;
    line-height: 1.4 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

/* لینک عنوان */
li.product .woocommerce-loop-product__title a,
.product .woocommerce-loop-product__title a {
    color: #1c1917 !important;
    text-decoration: none !important;
}

li.product .woocommerce-loop-product__title a:hover,
.product .woocommerce-loop-product__title a:hover {
    color: #14532d !important;
}

/* قیمت محصول */
li.product .price,
.product .price {
    font-size: 0.875rem !important;
    font-weight: 900 !important;
    color: #14532d !important;
    margin: 0.5rem 0 !important;
    padding: 0 !important;
    display: block !important;
}

li.product .price del,
.product .price del {
    color: #a8a29e !important;
    font-weight: 400 !important;
    font-size: 0.75rem !important;
    margin-left: 0.5rem !important;
}

li.product .price ins,
.product .price ins {
    color: #14532d !important;
    font-weight: 900 !important;
    text-decoration: none !important;
    background: none !important;
}

li.product .price .amount,
.product .price .amount {
    font-weight: 900 !important;
}

/* دکمه افزودن به سبد خرید */
li.product .button,
li.product .add_to_cart_button,
.product .button,
.product .add_to_cart_button {
    background: #14532d !important;
    color: white !important;
    border: none !important;
    padding: 0.625rem 1rem !important;
    border-radius: 0.75rem !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    width: 100% !important;
    margin-top: 0.75rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    text-decoration: none !important;
}

li.product .button:hover,
li.product .add_to_cart_button:hover,
.product .button:hover,
.product .add_to_cart_button:hover {
    background: #166534 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 20px rgba(20, 83, 45, 0.2) !important;
    color: white !important;
}

li.product .added_to_cart,
.product .added_to_cart {
    background: #d97706 !important;
    color: white !important;
    padding: 0.625rem 1rem !important;
    border-radius: 0.75rem !important;
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    display: inline-block !important;
    margin-top: 0.5rem !important;
    width: 100% !important;
    text-align: center !important;
    text-decoration: none !important;
}

li.product .added_to_cart:hover,
.product .added_to_cart:hover {
    background: #b45309 !important;
    color: white !important;
}

/* بج تخفیف */
li.product .onsale,
.product .onsale,
span.onsale {
    background: #ef4444 !important;
    color: white !important;
    padding: 0.25rem 0.5rem !important;
    border-radius: 0.5rem !important;
    font-size: 0.625rem !important;
    font-weight: 700 !important;
    position: absolute !important;
    top: 0.75rem !important;
    left: 0.75rem !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    min-height: auto !important;
    min-width: auto !important;
    line-height: 1.5 !important;
    z-index: 10 !important;
    display: inline-block !important;
}

/* لینک محصول */
li.product a.woocommerce-LoopProduct-link,
.product a.woocommerce-LoopProduct-link {
    display: block;
    text-decoration: none;
}

/* ستاره‌های رتبه‌بندی */
li.product .star-rating,
.product .star-rating {
    color: #fbbf24 !important;
    font-size: 0.875rem !important;
    margin: 0.5rem 0 !important;
}

/* ========================================
   2. Star Rating
   ======================================== */

.star-rating {
    overflow: hidden;
    position: relative;
    height: 1em;
    line-height: 1;
    font-size: 1em;
    width: 5.4em;
    font-family: star;
}

.star-rating::before {
    content: "\73\73\73\73\73";
    color: #d6d3d1;
    float: left;
    top: 0;
    left: 0;
    position: absolute;
}

.star-rating span {
    overflow: hidden;
    float: left;
    top: 0;
    left: 0;
    position: absolute;
    padding-top: 1.5em;
}

.star-rating span::before {
    content: "\53\53\53\53\53";
    top: 0;
    position: absolute;
    left: 0;
    color: #fbbf24;
}

/* ========================================
   3. Single Product
   ======================================== */

div.product {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

div.product div.images {
    margin-bottom: 2rem;
}

div.product div.images img {
    border-radius: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

div.product .product_title {
    font-size: 2rem;
    font-weight: 900;
    color: #1c1917;
    margin-bottom: 1rem;
    line-height: 1.3;
}

div.product p.price {
    font-size: 1.5rem;
    font-weight: 900;
    color: #14532d;
    margin: 1.5rem 0;
}

div.product p.price del {
    color: #a8a29e;
    font-size: 1.125rem;
    font-weight: 400;
}

div.product p.price ins {
    color: #14532d;
    text-decoration: none;
    background: none;
}

div.product .single_add_to_cart_button {
    background: #14532d !important;
    color: white !important;
    border: none !important;
    padding: 1rem 2rem !important;
    border-radius: 0.75rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: all 0.3s ease !important;
    width: 100%;
    margin: 1.5rem 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.75rem !important;
}

div.product .single_add_to_cart_button:hover {
    background: #166534 !important;
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(20, 83, 45, 0.3);
}

div.product .woocommerce-product-details__short-description {
    font-size: 1rem;
    line-height: 1.8;
    color: #57534e;
    margin: 1.5rem 0;
}

div.product .woocommerce-tabs {
    margin-top: 3rem;
}

div.product .woocommerce-tabs ul.tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0;
    margin: 0 0 2rem;
    border-bottom: 2px solid #e7e5e4;
    list-style: none;
}

div.product .woocommerce-tabs ul.tabs li {
    margin: 0;
    padding: 0;
    border: none;
    background: none;
}

div.product .woocommerce-tabs ul.tabs li a {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #57534e;
    font-weight: 500;
    border-radius: 0.5rem 0.5rem 0 0;
    transition: all 0.3s ease;
}

div.product .woocommerce-tabs ul.tabs li a:hover {
    color: #14532d;
    background: #f0fdf4;
}

div.product .woocommerce-tabs ul.tabs li.active a {
    color: #14532d;
    background: #f0fdf4;
    font-weight: 700;
    border-bottom: 2px solid #14532d;
}

div.product .woocommerce-tabs .panel {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid #e7e5e4;
}

/* ========================================
   4. Cart Page
   ======================================== */

.woocommerce-cart .woocommerce,
.woocommerce-page .woocommerce {
    max-width: 1280px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

table.cart,
table.shop_table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

table.cart th,
table.shop_table th {
    background: #f5f5f4;
    padding: 1rem;
    text-align: right;
    font-weight: 700;
    color: #1c1917;
    font-size: 0.875rem;
    border: none;
}

table.cart td,
table.shop_table td {
    padding: 1rem;
    border-top: 1px solid #e7e5e4;
    vertical-align: middle;
}

table.cart td.product-thumbnail img {
    width: 80px;
    height: 100px;
    object-fit: cover;
    border-radius: 0.5rem;
}

table.cart td.product-name a {
    font-weight: 600;
    color: #1c1917;
    font-size: 0.875rem;
}

table.cart td.product-price .amount {
    font-weight: 700;
    color: #14532d;
}

table.cart td.product-quantity .quantity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

table.cart td.product-quantity .quantity input {
    width: 60px;
    padding: 0.5rem;
    border: 1px solid #d6d3d1;
    border-radius: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
}

table.cart td.product-subtotal .amount {
    font-weight: 900;
    color: #14532d;
    font-size: 1rem;
}

table.cart td.product-remove a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

table.cart td.product-remove a:hover {
    background: #dc2626;
    color: white;
}

/* Cart Totals */
.cart-collaterals {
    margin-top: 2rem;
}

.cart-collaterals .cart_totals {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.cart-collaterals .cart_totals h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #1c1917;
}

.cart-collaterals .cart_totals table {
    width: 100%;
    margin-bottom: 1.5rem;
}

.cart-collaterals .cart_totals th {
    text-align: right;
    padding: 0.75rem 0;
    font-weight: 500;
    color: #57534e;
}

.cart-collaterals .cart_totals td {
    text-align: left;
    padding: 0.75rem 0;
    font-weight: 700;
    color: #1c1917;
}

.cart-collaterals .cart_totals .order-total th,
.cart-collaterals .cart_totals .order-total td {
    font-size: 1.125rem;
    color: #14532d;
    border-top: 2px solid #e7e5e4;
    padding-top: 1rem;
}

.cart-collaterals .cart_totals .wc-proceed-to-checkout a.checkout-button {
    display: block;
    background: #14532d !important;
    color: white !important;
    padding: 1rem !important;
    border-radius: 0.75rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    text-align: center;
    transition: all 0.3s ease !important;
    border: none !important;
}

.cart-collaterals .cart_totals .wc-proceed-to-checkout a.checkout-button:hover {
    background: #166534 !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(20, 83, 45, 0.2);
}

/* ========================================
   5. Checkout Page
   ======================================== */

form.checkout_coupon,
form.login,
form.register {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid #e7e5e4;
    margin-bottom: 2rem;
}

form .form-row {
    margin-bottom: 1.5rem;
}

form .form-row label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #57534e;
    margin-bottom: 0.5rem;
}

form .form-row input.input-text,
form .form-row textarea,
form .form-row select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d6d3d1;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    background: white;
}

form .form-row input.input-text:focus,
form .form-row textarea:focus,
form .form-row select:focus {
    outline: none;
    border-color: #14532d;
    box-shadow: 0 0 0 3px rgba(20, 83, 45, 0.1);
}

#order_review_heading {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #1c1917;
}

#order_review {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid #e7e5e4;
}

#order_review table {
    width: 100%;
    margin-bottom: 1.5rem;
}

#order_review table th {
    text-align: right;
    padding: 0.75rem 0;
    font-weight: 500;
    color: #57534e;
    border-bottom: 1px solid #e7e5e4;
}

#order_review table td {
    text-align: left;
    padding: 0.75rem 0;
    color: #1c1917;
    border-bottom: 1px solid #e7e5e4;
}

#place_order {
    width: 100%;
    background: #14532d !important;
    color: white !important;
    padding: 1rem !important;
    border-radius: 0.75rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    border: none !important;
    cursor: pointer;
    transition: all 0.3s ease !important;
    margin-top: 1.5rem !important;
}

#place_order:hover {
    background: #166534 !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(20, 83, 45, 0.2);
}

/* ========================================
   6. My Account Page
   ======================================== */

.woocommerce-MyAccount-navigation {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid #e7e5e4;
    margin-bottom: 2rem;
}

.woocommerce-MyAccount-navigation ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.woocommerce-MyAccount-navigation ul li {
    margin: 0;
    padding: 0;
    border: none;
}

.woocommerce-MyAccount-navigation ul li a {
    display: block;
    padding: 0.75rem 1rem;
    color: #57534e;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    margin-bottom: 0.25rem;
}

.woocommerce-MyAccount-navigation ul li a:hover {
    background: #f0fdf4;
    color: #14532d;
}

.woocommerce-MyAccount-navigation ul li.is-active a {
    background: #14532d;
    color: white;
    font-weight: 700;
}

.woocommerce-MyAccount-content {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid #e7e5e4;
}

.woocommerce-MyAccount-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #1c1917;
}

.woocommerce-MyAccount-content p {
    line-height: 1.8;
    color: #57534e;
    margin-bottom: 1rem;
}

/* ========================================
   7. Pagination
   ======================================== */

nav.woocommerce-pagination {
    margin: 3rem 0;
    text-align: center;
}

nav.woocommerce-pagination ul {
    display: inline-flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

nav.woocommerce-pagination ul li {
    margin: 0;
    padding: 0;
    border: none;
}

nav.woocommerce-pagination ul li a,
nav.woocommerce-pagination ul li span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    border: 1px solid #d6d3d1;
    border-radius: 0.5rem;
    color: #57534e;
    font-weight: 500;
    transition: all 0.3s ease;
}

nav.woocommerce-pagination ul li a:hover {
    background: #f0fdf4;
    border-color: #14532d;
    color: #14532d;
}

nav.woocommerce-pagination ul li span.current {
    background: #14532d;
    border-color: #14532d;
    color: white;
    font-weight: 700;
}

/* ========================================
   8. Messages & Notices
   ======================================== */

.woocommerce-message,
.woocommerce-info,
.woocommerce-error,
.woocommerce-nocache {
    background: #f0fdf4;
    border: 1px solid #16a34a;
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    color: #14532d;
    font-weight: 500;
}

.woocommerce-info {
    background: #dbeafe;
    border-color: #2563eb;
    color: #1e40af;
}

.woocommerce-error {
    background: #fee2e2;
    border-color: #dc2626;
    color: #991b1b;
}

.woocommerce-message::before,
.woocommerce-info::before,
.woocommerce-error::before {
    display: none;
}

/* ========================================
   9. Widgets - مستقل از .woocommerce
   ======================================== */

.widget {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    border: 1px solid #e7e5e4;
    margin-bottom: 1.5rem;
}

.widget h3,
.widget .widget-title,
.widget h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #1c1917;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #f0fdf4;
}

.widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.widget ul li {
    margin: 0;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f5f5f4;
}

.widget ul li:last-child {
    border-bottom: none;
}

.widget ul li a {
    color: #57534e;
    font-size: 0.875rem;
    transition: color 0.3s ease;
    text-decoration: none;
}

.widget ul li a:hover {
    color: #14532d;
}

/* Product Categories Widget */
.widget_product_categories ul li .count {
    color: #a8a29e;
    font-size: 0.75rem;
}

/* Price Filter Widget */
.widget_price_filter .price_slider {
    margin-bottom: 1rem;
}

.widget_price_filter .ui-slider {
    background: #e7e5e4;
    border: none;
    border-radius: 0.5rem;
}

.widget_price_filter .ui-slider .ui-slider-range {
    background: #14532d;
}

.widget_price_filter .ui-slider .ui-slider-handle {
    background: #14532d;
    border: 2px solid white;
    border-radius: 50%;
    width: 1rem;
    height: 1rem;
    top: -0.375rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.widget_price_filter .price_label {
    font-size: 0.75rem;
    color: #57534e;
}

/* Search Widget */
.widget_search .search-form {
    display: flex;
    gap: 0.5rem;
}

.widget_search .search-field {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #d6d3d1;
    border-radius: 0.75rem;
    font-size: 0.875rem;
}

.widget_search .search-submit {
    background: #14532d;
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 0.75rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.widget_search .search-submit:hover {
    background: #166534;
}

/* ========================================
   10. Responsive
   ======================================== */

@media (max-width: 1024px) {
    .grid-cols-5 { grid-template-columns: repeat(4, 1fr) !important; }
    div.product .product_title { font-size: 1.75rem; }
    div.product p.price { font-size: 1.25rem; }
}

@media (max-width: 768px) {
    li.product .woocommerce-loop-product__title,
    .product .woocommerce-loop-product__title {
        font-size: 0.75rem !important;
    }

    li.product .price,
    .product .price {
        font-size: 0.75rem !important;
    }

    li.product .button,
    li.product .add_to_cart_button,
    .product .button,
    .product .add_to_cart_button {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.625rem !important;
    }

    div.product { padding: 1rem 0.5rem; }
    div.product .product_title { font-size: 1.5rem; }
    div.product p.price { font-size: 1.125rem; }

    div.product .single_add_to_cart_button {
        padding: 0.875rem 1.5rem !important;
        font-size: 0.875rem !important;
    }

    table.cart,
    table.shop_table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    table.cart th,
    table.shop_table th {
        font-size: 0.75rem;
        padding: 0.75rem 0.5rem;
    }

    table.cart td,
    table.shop_table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }

    table.cart td.product-thumbnail img {
        width: 60px;
        height: 75px;
    }

    form.checkout_coupon,
    form.login,
    form.register {
        padding: 1.5rem;
    }

    #order_review { padding: 1.5rem; }

    .woocommerce-MyAccount-navigation { padding: 1rem; }
    .woocommerce-MyAccount-content { padding: 1.5rem; }
    .woocommerce-MyAccount-content h2 { font-size: 1.25rem; }
}

@media (max-width: 480px) {
    li.product a img,
    .product a img {
        border-radius: 0.75rem !important;
    }

    li.product .woocommerce-loop-product__title,
    .product .woocommerce-loop-product__title {
        font-size: 0.6875rem !important;
        margin: 0.5rem 0 0.125rem !important;
    }

    li.product .price,
    .product .price {
        font-size: 0.6875rem !important;
        margin: 0.25rem 0 !important;
    }

    li.product .button,
    li.product .add_to_cart_button,
    .product .button,
    .product .add_to_cart_button {
        padding: 0.375rem 0.5rem !important;
        font-size: 0.5625rem !important;
        margin-top: 0.5rem !important;
    }

    div.product .product_title { font-size: 1.25rem; }
    div.product p.price { font-size: 1rem; }

    div.product .single_add_to_cart_button {
        padding: 0.75rem 1rem !important;
        font-size: 0.8125rem !important;
    }

    table.cart td.product-thumbnail img {
        width: 50px;
        height: 62.5px;
    }
}

/* ========================================
   11. RTL
   ======================================== */

html[dir="rtl"] li.product .onsale,
html[dir="rtl"] .product .onsale,
html[dir="rtl"] span.onsale {
    left: auto !important;
    right: 0.75rem !important;
}

html[dir="rtl"] table.cart th,
html[dir="rtl"] table.shop_table th {
    text-align: right;
}

html[dir="rtl"] table.cart td,
html[dir="rtl"] table.shop_table td {
    text-align: right;
}

html[dir="rtl"] .cart-collaterals .cart_totals th {
    text-align: right;
}

html[dir="rtl"] .cart-collaterals .cart_totals td {
    text-align: left;
}

html[dir="rtl"] #order_review table th {
    text-align: right;
}

html[dir="rtl"] #order_review table td {
    text-align: left;
}

/* ========================================
   12. Loading & Accessibility
   ======================================== */

.blockUI.blockOverlay {
    background: rgba(255, 255, 255, 0.9) !important;
    z-index: 1000 !important;
}

.blockUI.blockOverlay::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3rem;
    height: 3rem;
    margin: -1.5rem 0 0 -1.5rem;
    border: 3px solid #14532d;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

li.product a:focus,
li.product button:focus,
.product a:focus,
.product button:focus {
    outline: 2px solid #14532d;
    outline-offset: 2px;
}

.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}