/*
Theme Name: Kadiner Custom Theme
Theme URI: https://kadiner.ir
Author: Senior WP Developer
Description: قالب اختصاصی فروشگاه کادینر با Tailwind CSS و ووکامرس
Version: 1.0.0
Text Domain: kadiner
*/

/* Typography Styles for Content (از فایل rules.html شما) */
.entry-content h2 { 
    font-size: 1.5rem; 
    font-weight: 800; 
    color: #1a1816; 
    margin-top: 2.5rem; 
    margin-bottom: 1rem; 
    position: relative; 
    padding-right: 1rem; 
}
.entry-content h2::before { 
    content: ''; 
    position: absolute; 
    right: 0; 
    top: 0.25rem; 
    bottom: 0.25rem; 
    width: 4px; 
    background-color: #fdcf00; 
    border-radius: 4px; 
}
.entry-content h3 { 
    font-size: 1.25rem; 
    font-weight: 700; 
    color: #2d2a26; 
    margin-top: 2rem; 
    margin-bottom: 0.75rem; 
}
.entry-content p { 
    margin-bottom: 1.5rem; 
    line-height: 1.8; 
    color: #4b5563; 
    text-align: justify; 
}
.entry-content ul { 
    margin-bottom: 1.5rem; 
    list-style: disc; 
    padding-right: 1.5rem; 
    color: #4b5563; 
}
.entry-content li { 
    margin-bottom: 0.5rem; 
}
.entry-content strong { 
    color: #1a1816; 
    font-weight: 800; 
}
/* استایل لینک‌های داخل متن */
.entry-content a {
    color: #e6bc00;
    text-decoration: underline;
    text-decoration-style: dashed;
}
.entry-content a:hover {
    color: #fdcf00;
}
/* تگ‌های پست */
.entry-content + div a[rel="tag"] {
    display: inline-block;
    background: #f3f4f6;
    color: #4b5563;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    transition: all 0.2s;
}
.entry-content + div a[rel="tag"]:hover {
    background: #fdcf00;
    color: #000;
}

.entry-content + div a[rel="tag"] {
    display: inline-block;
    background-color: #f3f4f6; /* bg-gray-100 */
    color: #4b5563; /* text-gray-600 */
    padding: 0.25rem 0.75rem; /* py-1 px-3 */
    border-radius: 0.25rem; /* rounded */
    font-size: 0.875rem; /* text-sm */
    transition: background-color 0.2s, color 0.2s;
    margin-left: 0.5rem;
    margin-bottom: 0.5rem;
    text-decoration: none;
}

.entry-content + div a[rel="tag"]:hover {
    background-color: #fdcf00; /* bg-brand */
    color: #000000; /* text-black */
}

/* WooCommerce Form Field Styling Override */
.woocommerce-input-wrapper input,
.woocommerce-input-wrapper textarea,
.woocommerce-input-wrapper select {
    width: 100%;
    background-color: #f9fafb; /* bg-gray-50 */
    border: 1px solid #e5e7eb; /* border-gray-200 */
    border-radius: 0.75rem; /* rounded-xl */
    padding: 0.75rem 1rem; /* py-3 px-4 */
    outline: none;
    transition: all 0.2s;
}

.woocommerce-input-wrapper input:focus,
.woocommerce-input-wrapper textarea:focus {
    border-color: #fdcf00; /* border-brand */
    box-shadow: 0 0 0 1px #fdcf00; /* ring-brand */
}

/* مخفی کردن لیبل‌های اضافی اگر نیاز است */
.woocommerce-form__label-for-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}



/* =========================================
   WooCommerce Mini Cart - Fixed Layout (RTL)
   ========================================= */

/* کانتینر اصلی */
.widget_shopping_cart_content {
    @apply text-sm;
}

/* لیست آیتم‌ها */
.widget_shopping_cart_content .woocommerce-mini-cart {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-height: 350px;
    overflow-y: auto;
    @apply space-y-2 p-2;
}

/* آیتم تکی - تنظیم فضا برای تصویر */
.widget_shopping_cart_content .woocommerce-mini-cart-item {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important; /* متن‌ها زیر هم قرار بگیرند */
    justify-content: center !important;
    min-height: 80px; /* حداقل ارتفاع برابر با تصویر */
    padding: 12px 85px 12px 12px !important; /* 85px از راست خالی برای تصویر */
    @apply bg-gray-50 rounded-xl border border-gray-100 transition-colors hover:border-gray-300;
}

/* تصویر محصول - ثابت در سمت راست */
.widget_shopping_cart_content .woocommerce-mini-cart-item img {
    position: absolute !important;
    right: 10px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 60px !important;
    height: 60px !important;
    object-fit: cover;
    margin: 0 !important;
    float: none !important;
    @apply rounded-lg border border-gray-200 shadow-sm;
}

/* عنوان محصول */
.widget_shopping_cart_content .woocommerce-mini-cart-item a:not(.remove) {
    display: block !important;
    font-weight: 800;
    color: #1f2937;
    text-decoration: none;
    line-height: 1.4;
    margin-bottom: 4px;
    font-size: 0.9rem;
    padding-left: 20px; /* فاصله از دکمه حذف اگر متن طولانی شد */
}

/* قیمت و تعداد (زیر عنوان) */
.widget_shopping_cart_content .woocommerce-mini-cart-item .quantity {
    display: block !important;
    font-size: 0.8rem;
    color: #6b7280;
    font-family: sans-serif; /* برای نمایش بهتر اعداد انگلیسی/فارسی */
}

/* رنگ قیمت */
.widget_shopping_cart_content .woocommerce-mini-cart-item .quantity .amount {
    font-weight: 700;
    color: #1a1816; /* رنگ تیره */
    @apply bg-white px-2 py-0.5 rounded border border-gray-200 text-xs shadow-sm;
}

/* دکمه حذف (×) - سمت چپ */
.widget_shopping_cart_content .woocommerce-mini-cart-item .remove {
    position: absolute !important;
    left: 10px !important;
    top: 50% !important;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: #fee2e2 !important; /* قرمز روشن */
    color: #ef4444 !important; /* قرمز تیره */
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s;
}

.widget_shopping_cart_content .woocommerce-mini-cart-item .remove:hover {
    background-color: #ef4444 !important;
    color: white !important;
}

/* بخش جمع کل */
.widget_shopping_cart_content .woocommerce-mini-cart__total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 5px;
    border-top: 2px dashed #e5e7eb;
    margin-top: 10px !important;
    margin-bottom: 5px !important;
}

.widget_shopping_cart_content .woocommerce-mini-cart__total strong {
    font-weight: 800;
    font-size: 1rem;
}

.widget_shopping_cart_content .woocommerce-mini-cart__total .amount {
    font-weight: 900;
    font-size: 1.2rem;
    color: #eab308; /* رنگ زرد برند */
}

/* دکمه‌ها */
.widget_shopping_cart_content .woocommerce-mini-cart__buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.widget_shopping_cart_content .woocommerce-mini-cart__buttons .button {
    text-align: center;
    padding: 12px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.widget_shopping_cart_content .woocommerce-mini-cart__buttons .button:not(.checkout) {
    background-color: #f3f4f6;
    color: #374151;
}
.widget_shopping_cart_content .woocommerce-mini-cart__buttons .button:not(.checkout):hover {
    background-color: #e5e7eb;
}

.widget_shopping_cart_content .woocommerce-mini-cart__buttons .button.checkout {
    background-color: #fdcf00;
    color: #000;
    box-shadow: 0 4px 6px -1px rgba(253, 207, 0, 0.4);
}
.widget_shopping_cart_content .woocommerce-mini-cart__buttons .button.checkout:hover {
    background-color: #e6bc00;
    transform: translateY(-2px);
}

.woocommerce-cart-form table {
    width: 100%;
    border-collapse: collapse;
}
.woocommerce-cart-form th {
    text-align: right;
    padding: 15px;
    background-color: #f9fafb; /* gray-50 */
    font-weight: 800;
}
.woocommerce-cart-form td {
    padding: 15px;
    border-bottom: 1px solid #f3f4f6; /* gray-100 */
}
.woocommerce-cart-form img {
    width: 60px;
    border-radius: 8px;
}
.woocommerce-cart-form .actions .button {
    background-color: #1a1816 !important; /* dark-900 */
    color: white !important;
    padding: 10px 20px;
    border-radius: 10px;
}
.cart_totals {
    margin-top: 30px;
}
.wc-proceed-to-checkout .checkout-button {
    background-color: #fdcf00 !important; /* brand */
    color: black !important;
    display: block;
    text-align: center;
    padding: 15px;
    border-radius: 12px;
    font-weight: 800;
}

/* =========================================
   WooCommerce Checkout Custom Styling
   ========================================= */

/* استایل‌دهی به فیلدهای ورودی */
.woocommerce-input-wrapper input,
.woocommerce-input-wrapper textarea,
.select2-selection--single {
    background-color: #f9fafb !important; /* bg-gray-50 */
    border: 1px solid #e5e7eb !important; /* border-gray-200 */
    border-radius: 0.75rem !important; /* rounded-xl */
    padding: 12px 16px !important;
    font-size: 0.875rem !important;
    color: #1f2937 !important;
    transition: all 0.2s;
    height: auto !important;
    min-height: 48px;
}

.woocommerce-input-wrapper input:focus,
.woocommerce-input-wrapper textarea:focus {
    border-color: #fdcf00 !important; /* brand */
    box-shadow: 0 0 0 1px #fdcf00 !important;
    background-color: #fff !important;
}

/* اصلاح سلکت باکس‌ها (Select2) */
.select2-container .select2-selection--single {
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 46px !important;
    left: 10px !important;
    right: auto !important;
}

/* لیبل فیلدها */
.woocommerce-form-row label {
    font-weight: 700;
    color: #374151; /* text-gray-700 */
    margin-bottom: 8px;
    font-size: 0.875rem;
}
.required {
    color: #ef4444; /* text-red-500 */
    text-decoration: none;
}

/* باکس "اشتراک طلایی" (سایدبار چپ) */
#order_review_heading {
    display: none; /* مخفی کردن تیتر پیش‌فرض */
}

/* استایل اختصاصی برای باکس "سفارش شما" */
.woocommerce-checkout-review-order-table {
    border: none !important;
    margin-bottom: 20px !important;
}
.woocommerce-checkout-review-order-table th,
.woocommerce-checkout-review-order-table td {
    border: none !important;
    padding: 10px 0 !important;
    border-bottom: 1px solid #f3f4f6 !important;
}
.woocommerce-checkout-review-order-table thead {
    display: none; /* مخفی کردن هدر جدول */
}

/* دکمه پرداخت */
#place_order {
    background-color: #fdcf00 !important;
    color: #000 !important;
    font-weight: 800 !important;
    border-radius: 12px !important;
    padding: 16px !important;
    width: 100%;
    font-size: 1rem;
    transition: all 0.2s;
    margin-top: 20px;
    box-shadow: 0 4px 6px -1px rgba(253, 207, 0, 0.4);
}
#place_order:hover {
    background-color: #e6bc00 !important;
    transform: translateY(-2px);
}

/* حذف حاشیه‌های اضافی جدول پرداخت */
.woocommerce-checkout #payment {
    background: transparent !important;
    border-radius: 0 !important;
}
.woocommerce-checkout #payment ul.payment_methods {
    border-bottom: none !important;
    padding: 0 !important;
}
.wc_payment_method {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 15px !important;
    margin-bottom: 10px !important;
}
.wc_payment_method.input-radio:checked + label {
    font-weight: bold;
}

/* اسکرول بار لیست محصولات در سایدبار */
.product-name {
    font-size: 0.85rem;
    color: #4b5563;
}
.product-total {
    font-weight: bold;
    color: #1f2937;
}

/* اصلاح گرید فرم تسویه حساب */
.woocommerce-billing-fields__field-wrapper,
.woocommerce-shipping-fields__field-wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* دو ستونه */
    gap: 1rem;
}

/* فیلدها تمام عرض */
.form-row {
    width: 100% !important;
    float: none !important;
    margin: 0 !important;
}

/* فیلدهای خاصی که باید تمام عرض باشند (مثل آدرس و توضیحات) */
#billing_address_1_field,
#billing_address_2_field,
#billing_email_field,
#order_comments_field {
    grid-column: span 2;
}

/* موبایل: همه چیز تک ستونه */
@media (max-width: 768px) {
    .woocommerce-billing-fields__field-wrapper,
    .woocommerce-shipping-fields__field-wrapper {
        grid-template-columns: 1fr;
    }
    #billing_address_1_field,
    #billing_address_2_field {
        grid-column: span 1;
    }
}

/* استایل اینپوت‌ها */
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea {
    padding: 12px 16px;
    background-color: #f9fafb; /* bg-gray-50 */
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem; /* rounded-xl */
    line-height: 1.5;
}
.woocommerce form .form-row input.input-text:focus {
    border-color: #fdcf00;
    background-color: #fff;
    outline: none;
    box-shadow: 0 0 0 1px #fdcf00;
}

/* تمیز کردن جدول خلاصه سفارش در سایدبار */
#order_review table.shop_table {
    border: none;
    margin: 0;
}
#order_review table.shop_table th,
#order_review table.shop_table td {
    border: none;
    border-bottom: 1px dashed #e5e7eb;
    padding: 15px 0;
    background: transparent;
}
#order_review table.shop_table tr:last-child th,
#order_review table.shop_table tr:last-child td {
    border-bottom: none;
}
#order_review .product-name {
    font-weight: 500;
    color: #4b5563;
}
#order_review .product-total {
    font-weight: 800;
    color: #1f2937;
}
#order_review .order-total .amount {
    font-size: 1.25rem;
    color: #fdcf00; /* رنگ برند */
}

/* استایل ویژگی‌های اشتراک طلایی در سایدبار */
.vip-features-list ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.vip-features-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #d1d5db; /* text-gray-300 */
}

/* اضافه کردن آیکون تیک سبز قبل از هر li */
.vip-features-list li::before {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234ade80' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M5 13l4 4L19 7'%3E%3C/path%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    flex-shrink: 0;
}

/* اصلاح جهت نمایش قیمت‌ها در جدول فاکتور */
.woocommerce-checkout-review-order-table .amount {
    direction: ltr !important;
    unicode-bidi: embed !important;
    display: inline-block;
}

/* اصلاح چیدمان ردیف‌های جدول */
.woocommerce-checkout-review-order-table th,
.woocommerce-checkout-review-order-table td {
    vertical-align: middle;
}

/* رنگ و فونت قیمت نهایی */
.woocommerce-checkout-review-order-table .order-total .amount {
    font-weight: 900;
    color: #fdcf00; /* رنگ زرد برند */
    font-size: 1.3rem;
}


/* =========================================
   Modern Checkout Error Styling
   ========================================= */

/* 1. استایل باکس خطای کلی (بالای صفحه) */
.woocommerce-error {
    background-color: #ffffff !important;
    border: 1px solid #fee2e2 !important; /* red-200 */
    border-right: 4px solid #ef4444 !important; /* red-500 (نوار قرمز سمت راست) */
    border-radius: 12px !important;
    padding: 20px !important;
    margin-bottom: 30px !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05) !important;
    list-style: none !important;
    position: relative;
}

/* آیکون خطا قبل از باکس */
.woocommerce-error::before {
    content: '!';
    position: absolute;
    right: -15px; /* تنظیم موقعیت برای RTL */
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-weight: bold;
    font-family: sans-serif;
    border: 2px solid white;
    display: none; /* اگر دوست داشتید فعال کنید */
}

/* متن آیتم‌های خطا */
.woocommerce-error li {
    font-size: 0.9rem !important;
    color: #b91c1c !important; /* red-700 */
    font-weight: 700 !important;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px !important;
}

.woocommerce-error li:last-child {
    margin-bottom: 0 !important;
}

/* اضافه کردن آیکون کوچک کنار هر خط خطا */
.woocommerce-error li::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #ef4444;
    border-radius: 50%;
}


/* 2. استایل فیلدهای قرمز شده (Inline Validation) */
/* ووکامرس وقتی فیلدی خالی باشد کلاس woocommerce-invalid را به آن می‌دهد */

.woocommerce-invalid input,
.woocommerce-invalid select,
.woocommerce-invalid textarea {
    border-color: #ef4444 !important; /* قرمز */
    background-color: #fef2f2 !important; /* پس‌زمینه قرمز خیلی روشن */
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1) !important; /* سایه قرمز */
    animation: shake 0.3s ease-in-out; /* انیمیشن لرزش */
}

.woocommerce-invalid label {
    color: #ef4444 !important;
}

/* انیمیشن لرزش برای جلب توجه */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* آیکون خطا داخل فیلد (اختیاری - پیشرفته) */
.woocommerce-invalid .woocommerce-input-wrapper::after {
    content: '!';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #ef4444;
    font-weight: bold;
    font-family: sans-serif;
    pointer-events: none;
}
.woocommerce-input-wrapper {
    position: relative; /* برای اینکه آیکون بالا کار کند */
}

