/*
Theme Name: میوه
Description: قالب پایه خالی برای پیاده‌سازی اختصاصی سایت میوه و تره‌بار
Author: Saeed
Version: 0.25
Text Domain: mive
*/

@font-face {
    font-family: 'Vazirmatn';
    src: url('assets/fonts/vazirmatn/Vazirmatn.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* استایل‌های سایت از اینجا به بعد اضافه می‌شن */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    direction: rtl;
    background: var(--store-page);
    color: var(--store-text);
}

a {
    text-decoration: none;
    color: inherit;
}

button, input, select, textarea {
    font-family: inherit;
}

/* آیکون سبد خرید تو فوتر */
.footer-cart-icon-wrap {
    position: relative;
    display: inline-flex;
}
.header-cart-badge {
    position: absolute;
    top: -6px;
    left: -10px;
    background: var(--mive-primary);
    color: var(--store-surface);
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 3px;
}
.header-cart-badge.hide {
    display: none;
}

.container {
    width: 100%;
    max-width: 480px; /* موبایل‌فرست */
    margin-inline: auto;
    padding: 0 12px;
    background: var(--store-page);
}

/* نوار جستجو */
.search-bar {
    margin: 12px 0;
}
.search-bar input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 20px;
    border: 1px solid var(--store-border);
    font-size: 14px;
}

/* تب‌های دسته‌بندی */
.category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-bottom: 14px;
    padding-bottom: 4px;
    position: sticky;
    top: 0;
    background: var(--store-page);
    padding-top: 8px;
    z-index: 50;
}
.category-section {
    scroll-margin-top: 56px; /* جا برای تب‌های چسبیده هنگام اسکرول */
    margin-bottom: 16px;
}
.category-section-title {
    font-size: 15px;
    margin: 0 0 10px;
}
.tab-btn {
    white-space: nowrap;
    padding: 8px 16px;
    border-radius: 16px;
    border: 1px solid var(--store-border);
    background: var(--store-surface);
    font-size: 13px;
    cursor: pointer;
}
.tab-btn.active {
    background: var(--store-primary);
    color: var(--store-surface);
    border-color: var(--store-primary);
}

/* گرید محصولات */
.product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding-bottom: 0;
}
.product-card {
    display: flex;
    min-width: 0;
    height: 100%;
    flex-direction: column;
    background: var(--store-surface);
    border-radius: 12px;
    padding: 0;
    position: relative;
    text-align: right;
    overflow: hidden;
}
.product-card.is-updating {
    opacity: 0.65;
    pointer-events: none;
}
.product-img img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0;
}
.product-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    flex: 1;
}
.product-title {
    display: -webkit-box;
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.7;
    min-width: 0;
    min-height: 44px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}
.product-weight {
    overflow: hidden;
    color: var(--store-muted);
    font-size: 11px;
    line-height: 1.6;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.product-price-action {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    min-width: 0;
}
.product-price {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    font-size: 12px;
    font-weight: bold;
    color: var(--mive-primary);
    line-height: 1.65;
    direction: rtl;
    white-space: normal;
}
.product-price del {
    display: block;
    color: var(--store-muted);
    font-size: 10px;
    font-weight: 500;
    line-height: 1.4;
}
.product-price ins {
    display: block;
    color: var(--mive-primary);
    font-weight: 800;
    text-decoration: none;
}
.product-price .woocommerce-Price-amount {
    white-space: nowrap;
}
.product-price .woocommerce-Price-currencySymbol {
    margin-right: 2px;
}
.mive-price-from {
    color: var(--store-muted);
    font-size: 11px;
    font-weight: 600;
}
.add-btn {
    flex: 0 0 auto;
    max-width: 48%;
    display: inline-block;
    background: var(--store-button);
    color: var(--store-button-text);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    border: none;
    cursor: pointer;
}
.qty-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 0 0 auto;
    max-width: 52%;
    background: var(--mive-primary-soft);
    border-radius: 12px;
    padding: 4px 10px;
    width: fit-content;
}
.qty-stepper button {
    background: none;
    border: none;
    color: var(--mive-primary);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
}
.qty-stepper .qty-value {
    font-size: 13px;
    font-weight: bold;
    color: var(--mive-primary);
    min-width: 16px;
    text-align: center;
}
.qty-stepper button.is-remove {
    color: var(--store-primary-dark);
    display: inline-flex;
    align-items: center;
}

/* صفحه سبد خرید */
.page-title {
    font-size: 18px;
    margin: 16px 0;
}
.empty-cart-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: 50px 0;
    color: var(--store-muted);
}
.empty-cart {
    color: var(--store-muted);
    margin: 14px 0 18px;
}

.mive-empty-cart {
    min-height: calc(100vh - 190px);
    padding: 48px 20px 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.mive-empty-cart__icon {
    width: 104px;
    height: 104px;
    margin-bottom: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--store-warning);
    background: var(--store-warning-soft);
}

.mive-empty-cart__icon svg {
    width: 58px;
    height: 58px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mive-empty-cart__title {
    margin: 0 0 10px;
    color: var(--store-text);
    font-size: 21px;
    line-height: 1.7;
}

.mive-empty-cart__text {
    max-width: 320px;
    margin: 0;
    color: var(--store-muted);
    font-size: 14px;
    line-height: 1.9;
}

.mive-empty-cart__button {
    display: block;
    width: 100%;
    max-width: 320px;
    margin-top: 22px;
    padding: 13px 20px;
    border-radius: 14px;
    background: var(--store-button);
    color: var(--store-button-text);
    font-size: 15px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 6px 16px color-mix(in srgb,var(--store-primary) 20%,transparent);
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.mive-empty-cart__button:hover,
.mive-empty-cart__button:focus-visible {
    background: var(--store-button);
    color: var(--store-button-text);
    box-shadow: 0 8px 20px color-mix(in srgb,var(--store-primary) 28%,transparent);
}

.mive-empty-cart__button:active {
    background: var(--store-primary-dark);
    transform: translateY(1px);
    box-shadow: 0 3px 10px color-mix(in srgb,var(--store-primary) 20%,transparent);
}

.woocommerce-cart .return-to-shop {
    display: none;
}
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cart-line {
    background: var(--store-surface);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    transition: opacity 0.2s ease;
}
.cart-line-img img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
}
.cart-line-info {
    flex: 1;
}
.cart-line-title {
    font-size: 14px;
    margin-bottom: 4px;
}
.cart-line-price {
    color: var(--store-primary);
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 6px;
}
.remove-line {
    font-size: 15px;
    font-weight: bold;
    color: var(--store-muted);
    align-self: flex-start;
    padding: 4px 8px;
}
.cart-note-box {
    margin-top: 14px;
}
.cart-note-box label {
    display: block;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--store-text);
}
.cart-note-box textarea {
    width: 100%;
    min-height: 70px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--store-border);
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
}
.cart-summary {
    margin-top: 20px;
    padding-bottom: 80px;
}
.cart-total-row {
    display: flex;
    justify-content: space-between;
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 12px;
}
.checkout-btn {
    display: block;
    text-align: center;
    background: var(--store-button);
    color: var(--store-button-text);
    padding: 14px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: bold;
}

/* صفحه پرداخت (چک‌اوت) */
.mive-hidden-field {
    display: none !important;
}
.woocommerce-shipping-fields {
    display: none !important;
}
.woocommerce-billing-fields h3 {
    font-size: 16px;
    margin: 16px 0 10px;
}
.woocommerce-billing-fields .form-row,
#mive-delivery-time .form-row {
    margin-bottom: 12px;
}
.woocommerce-billing-fields input.input-text,
.woocommerce-billing-fields textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--store-border);
    font-size: 14px;
}

.mive-open-modal {
    background: var(--store-button);
    color: var(--store-button-text);
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
    cursor: pointer;
}

/* یادداشت ثابت زمان تحویل */
.mive-delivery-heading {
    font-size: 15px;
    margin: 4px 0 8px;
}
.mive-delivery-static-note {
    background: var(--store-surface);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    color: var(--store-text);
    margin-bottom: 10px;
}
.mive-no-shipping-msg {
    background: var(--store-warning-soft);
    color: var(--store-warning);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    text-align: center;
}

/* پنجره پایین‌رونده (بات‌شیت) */
.mive-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
}
.mive-modal.open {
    display: block;
}
.mive-modal-backdrop {
    position: absolute;
    inset: 0;
    background: var(--store-overlay);
}
.mive-modal-sheet {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    background: var(--store-surface);
    border-radius: 18px 18px 0 0;
    padding: 16px;
    max-height: 85vh;
    overflow-y: auto;
}
.mive-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 15px;
    font-weight: bold;
}
.mive-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--store-muted);
    cursor: pointer;
}
.mive-modal-save {
    width: 100%;
    background: var(--store-button);
    color: var(--store-button-text);
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: bold;
    margin-top: 10px;
    cursor: pointer;
}

/* ورود با موبایل */
.mive-otp-box {
    max-width: 320px;
    margin: 30px auto;
    text-align: center;
}
.mive-otp-box h2 {
    font-size: 18px;
    margin-bottom: 6px;
}
.otp-sub, .otp-sent-to {
    font-size: 13px;
    color: var(--store-muted);
    margin-bottom: 14px;
}
.mive-otp-test-notice {
    margin: 0 0 14px;
    padding: 8px 10px;
    border: 1px solid color-mix(in srgb,var(--store-primary) 25%,var(--store-surface));
    border-radius: 10px;
    background: var(--store-primary-soft);
    color: var(--store-primary-dark);
    font-size: 12px;
}
.mive-otp-box input {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid var(--store-border);
    text-align: center;
    font-size: 15px;
    margin-bottom: 10px;
}
.otp-btn-primary {
    width: 100%;
    background: var(--store-button);
    color: var(--store-button-text);
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}
.otp-error {
    font-size: 12px;
    color: var(--store-primary-dark);
    margin-top: 8px;
    min-height: 16px;
}
#otp-edit-phone {
    display: inline-block;
    margin-top: 10px;
    font-size: 12px;
    color: var(--store-muted);
}

/* حساب کاربری / سفارش‌ها */
.woocommerce-MyAccount-navigation ul {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}
.woocommerce-MyAccount-navigation a {
    display: block;
    background: var(--store-surface);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
}
.woocommerce-MyAccount-navigation .is-active a {
    background: var(--store-primary);
    color: var(--store-surface);
}
.woocommerce-orders-table {
    width: 100%;
    border-collapse: collapse;
}
.woocommerce-orders-table thead {
    display: none;
}
.woocommerce-orders-table tr {
    display: block;
    background: var(--store-surface);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 10px;
}
.woocommerce-orders-table td {
    display: block;
    padding: 3px 0;
    font-size: 13px;
}

/* رنگ‌بندی وضعیت سفارش برای تفکیک سفارش‌های در حال انجام از تمام‌شده */
.woocommerce-orders-table mark.order-status,
.woocommerce-order-details .order-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 12px;
    background: var(--store-border);
    color: var(--store-text);
}
mark.status-completed { background: var(--store-success-soft); color: var(--store-success); }
mark.status-processing { background: var(--store-warning-soft); color: var(--store-warning); }
mark.status-on-hold { background: var(--store-warning-soft); color: var(--store-warning); }
mark.status-pending { background: var(--store-border); color: var(--store-muted); }
mark.status-cancelled,
mark.status-failed,
mark.status-refunded { background: var(--store-primary-soft); color: var(--store-primary-dark); }
.mive-delivery-info {
    background: var(--store-surface);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    margin-top: 10px;
}

/* فوتر ثابت با آیکون */
.site-footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--store-surface);
    border-top: 1px solid var(--store-border);
    z-index: 500;
}
.footer-inner {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    justify-content: space-around;
    padding: 6px 0;
}
.footer-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--store-muted);
    font-size: 11px;
    padding: 4px 6px;
    border-radius: 10px;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.footer-item svg {
    color: var(--store-muted);
}
.footer-item:hover,
.footer-item:hover svg,
.footer-item.is-active,
.footer-item.is-active svg {
    color: var(--mive-primary);
}
.footer-item.is-active {
    background: var(--mive-primary-soft);
    font-weight: 700;
}
body {
    padding-bottom: 60px; /* جا برای فوتر ثابت */
}

/* نوار شناور سبد خرید (وقتی حداقل یه کالا اضافه شده) */
.mive-floating-cart {
    position: fixed;
    bottom: 60px; /* بالای فوتر */
    left: 12px;
    right: 12px;
    max-width: 456px;
    margin: 0 auto;
    background: var(--store-button);
    color: var(--store-button-text);
    border-radius: 14px;
    padding: 12px 16px;
    display: none;
    align-items: center;
    justify-content: space-between;
    z-index: 600;
    text-decoration: none;
}
.mive-floating-cart.show {
    display: flex;
}
.mive-floating-cart .fc-info {
    font-size: 14px;
    color: var(--store-surface);
}
.mive-floating-cart .fc-label {
    font-size: 15px;
    font-weight: bold;
    color: var(--store-text);
    background: var(--store-surface);
    padding: 8px 16px;
    border-radius: 10px;
}
