/* ==========================================================================
   Limoo Account | حساب کاربری، ورود، سفارش‌ها و پیگیری
   از متغیرهای --mehra-* قالب یا مقدار پیش‌فرض استفاده می‌کند؛ از تنظیمات افزونه هم قابل تغییر است.
   ========================================================================== */
:root {
  --mh-brown: var(--mehra-brown, #73542E);
  --mh-dark: var(--mehra-brown-dark, #4B3720);
  --mh-ink: var(--mehra-ink, #2B2016);
  --mh-cream: var(--mehra-cream, #F4E0CC);
  --mh-sand: var(--mehra-sand, #E9CFB4);
  --mh-paper: var(--mehra-paper, #FBF5EE);
  --mh-muted: var(--mehra-muted, #6B5A48);
  --mh-soft: var(--mehra-text-soft, #5A4630);
}

/* ---------- پایه: خنثی کردن شناورها و ظاهر پیش‌فرض ووکامرس ---------- */
.woocommerce-account .woocommerce-MyAccount-navigation,
.woocommerce-account .woocommerce-MyAccount-content { float: none; width: auto; }
.woocommerce mark { background: none; color: var(--mh-brown); font-weight: 700; }
.mh-ico { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- چیدمان صفحه (کاربر وارد شده) ---------- */
body.woocommerce-account.logged-in .woocommerce { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 32px; align-items: start; }
body.woocommerce-account .woocommerce-notices-wrapper { grid-column: 1 / -1; }

/* ---------- ناوبری ---------- */
.woocommerce-MyAccount-navigation {
  padding: 16px; border: 1.5px solid var(--mh-sand); border-radius: 20px; background: #fff;
  position: sticky; top: 110px;
}
.mh-profile { display: flex; align-items: center; gap: 12px; padding: 8px 8px 16px; margin-bottom: 8px; border-bottom: 1.5px solid var(--mh-cream); }
.mh-avatar { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--mh-brown); color: var(--mh-paper); font-size: 20px; font-weight: 800; }
.mh-profile__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.5; }
.mh-profile__text strong { font-size: 16px; color: var(--mh-dark); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mh-profile__text small { font-size: 12.5px; color: var(--mh-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: start; }

.woocommerce-MyAccount-navigation ul { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.woocommerce-MyAccount-navigation li { margin: 0; padding: 0; border: 0; }
.woocommerce-MyAccount-navigation a {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 14px;
  color: var(--mh-ink); font-size: 15px; font-weight: 600; text-decoration: none; transition: background-color .2s, color .2s;
}
.woocommerce-MyAccount-navigation a:hover { background: var(--mh-cream); color: var(--mh-dark); }
.woocommerce-MyAccount-navigation .is-active a { background: var(--mh-brown); color: var(--mh-paper); }
.woocommerce-MyAccount-navigation .woocommerce-MyAccount-navigation-link--customer-logout a { color: #8A2F1F; }
.woocommerce-MyAccount-navigation .woocommerce-MyAccount-navigation-link--customer-logout a:hover { background: #FBEDEA; }

/* ---------- کارت محتوا ---------- */
.woocommerce-account .woocommerce-MyAccount-content {
  padding: 28px; border: 1.5px solid var(--mh-sand); border-radius: 20px; background: #fff; min-width: 0;
}
.woocommerce-MyAccount-content h2, .woocommerce-MyAccount-content h3 { margin: 0 0 14px; font-size: 20px; font-weight: 800; color: var(--mh-dark); line-height: 1.5; }
.woocommerce-MyAccount-content p { line-height: 2; color: var(--mh-soft); }
.woocommerce-MyAccount-content a:not(.mh-btn):not(.button):not(.mh-tile) { color: var(--mh-brown); }

/* ---------- داشبورد ---------- */
.mh-hello { padding: 24px; border-radius: 18px; background: var(--mh-cream); }
.mh-hello h2 { margin: 0 0 2px; font-size: 24px; }
.mh-hello p { margin: 0; }
.mh-stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 18px 0 0; padding: 0; list-style: none; }
.mh-stats li { display: flex; flex-direction: column; min-width: 140px; padding: 12px 18px; border-radius: 14px; background: var(--mh-paper); border: 1.5px solid var(--mh-sand); }
.mh-stats strong { font-size: 24px; line-height: 1.3; color: var(--mh-brown); }
.mh-stats span { font-size: 13px; color: var(--mh-muted); }

.mh-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 20px 0 0; padding: 0; list-style: none; }
.mh-tile {
  display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 18px; border: 1.5px solid var(--mh-sand);
  border-radius: 18px; background: #fff; text-decoration: none; color: var(--mh-ink); transition: border-color .2s, background-color .2s;
}
.mh-tile:hover { border-color: var(--mh-brown); background: var(--mh-paper); }
.mh-tile__icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 8px; border-radius: 50%; background: var(--mh-cream); color: var(--mh-brown); }
.mh-tile strong { font-size: 16px; color: var(--mh-dark); }
.mh-tile small { font-size: 13px; color: var(--mh-muted); }

.mh-recent { margin-top: 28px; }
.mh-recent__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.mh-recent__head h3 { margin: 0; }
.mh-recent__head a { font-size: 14px; font-weight: 700; }
.mh-mini { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.mh-mini a { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 14px 16px; border: 1.5px solid var(--mh-sand); border-radius: 16px; background: var(--mh-paper); text-decoration: none; color: var(--mh-ink); }
.mh-mini a:hover { border-color: var(--mh-brown); }
.mh-mini__main { display: flex; flex-direction: column; line-height: 1.6; }
.mh-mini__main strong { color: var(--mh-brown); }
.mh-mini__main small { font-size: 13px; color: var(--mh-muted); }
.mh-mini__total { font-weight: 700; }

/* ---------- نشان وضعیت ---------- */
.mh-badge { display: inline-flex; align-items: center; justify-self: start; height: 30px; padding: 0 12px; border: 1.5px solid var(--mh-sand); border-radius: 999px; background: var(--mh-cream); color: var(--mh-dark); font-size: 13px; font-weight: 700; white-space: nowrap; }
.mh-order--completed .mh-badge { background: #E5F0E7; border-color: #B8D4BE; color: #2F5A3B; }
.mh-order--pending .mh-badge, .mh-order--on-hold .mh-badge { background: #FFF4DB; border-color: #F0D9A0; color: #6B4A00; }
.mh-order--cancelled .mh-badge, .mh-order--failed .mh-badge, .mh-order--refunded .mh-badge { background: #FBEDEA; border-color: #EBC3BB; color: #7A2B1D; }

/* ---------- دکمه‌ها ---------- */
.mh-btn, .woocommerce .button, .woocommerce button.button, .woocommerce a.button, .woocommerce input.button, .woocommerce-Button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px;
  border: 2px solid var(--mh-brown); border-radius: 999px; background: var(--mh-brown); color: var(--mh-paper);
  font: inherit; font-size: 15px; font-weight: 700; line-height: 1.4; text-decoration: none; cursor: pointer; transition: background-color .2s, color .2s;
}
.mh-btn:hover, .woocommerce .button:hover, .woocommerce button.button:hover, .woocommerce a.button:hover, .woocommerce-Button:hover { background: var(--mh-dark); border-color: var(--mh-dark); color: var(--mh-paper); }
.mh-btn--view { background: transparent; color: var(--mh-brown); }
.mh-btn--view:hover { background: var(--mh-brown); color: var(--mh-paper); }
.mh-btn--cancel { background: transparent; border-color: #B3432F; color: #8A2F1F; }
.mh-btn--cancel:hover { background: #8A2F1F; border-color: #8A2F1F; color: #fff; }
.mh-btn:focus-visible, .woocommerce .button:focus-visible, .mh-tile:focus-visible, .woocommerce-MyAccount-navigation a:focus-visible { outline: 3px solid var(--mh-brown); outline-offset: 2px; }

/* ---------- لیست سفارش‌ها ---------- */
.mh-orders { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.mh-order {
  display: grid; grid-template-columns: minmax(0, 1.2fr) auto minmax(0, 1fr) auto; align-items: center; gap: 12px 20px;
  padding: 18px 20px; border: 1.5px solid var(--mh-sand); border-radius: 18px; background: var(--mh-paper);
}
.mh-order__main { display: flex; flex-direction: column; line-height: 1.6; }
.mh-order__num { font-size: 17px; font-weight: 800; color: var(--mh-brown); text-decoration: none; }
.mh-order__main time { font-size: 13.5px; color: var(--mh-muted); }
.mh-order__meta { display: flex; flex-direction: column; line-height: 1.6; }
.mh-order__meta small { font-size: 13px; color: var(--mh-muted); }
.mh-order__meta strong { font-size: 16px; color: var(--mh-ink); }
.mh-order__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mh-order__actions .mh-btn { min-height: 40px; padding: 0 18px; font-size: 14px; }
.mh-order__track { grid-column: 1 / -1; margin: 0; padding: 8px 14px; border-radius: 10px; background: var(--mh-cream); font-size: 13.5px; color: var(--mh-dark); }
.mh-pager { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }
.mh-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 16px; text-align: center; }
.mh-empty h3 { margin: 8px 0 0; }
.mh-empty p { margin: 0 0 12px; }
.mh-empty__icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--mh-cream); color: var(--mh-brown); }
.mh-empty__icon .mh-ico { width: 34px; height: 34px; }

/* ---------- وضعیت مرحله‌ای و کد رهگیری ---------- */
.mh-timeline { margin: 8px 0 28px; padding: 22px 16px 20px; border: 1.5px solid var(--mh-sand); border-radius: 18px; background: var(--mh-paper); }
.mh-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 0; list-style: none; }
.mh-steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 52px; text-align: center; color: var(--mh-muted); }
.mh-steps li strong { font-size: 14.5px; font-weight: 700; }
.mh-steps li small { font-size: 12.5px; }
.mh-step__dot { position: absolute; top: 0; inset-inline-start: 50%; z-index: 1; width: 40px; height: 40px; margin-inline-start: -20px; border: 3px solid var(--mh-sand); border-radius: 50%; background: #fff; display: grid; place-items: center; }
.mh-steps li::after { content: ""; position: absolute; top: 18px; inset-inline-start: 50%; width: 100%; height: 4px; border-radius: 2px; background: var(--mh-sand); }
.mh-steps li:last-child::after { display: none; }
.mh-steps li.is-done .mh-step__dot { border-color: var(--mh-brown); background: var(--mh-brown); }
.mh-steps li.is-done .mh-step__dot::before { content: ""; width: 10px; height: 18px; margin-top: -3px; border: solid var(--mh-paper); border-width: 0 3px 3px 0; transform: rotate(45deg); }
.mh-steps li.is-done::after { background: var(--mh-brown); }
.mh-steps li.is-done strong, .mh-steps li.is-current strong { color: var(--mh-dark); }
.mh-steps li.is-current .mh-step__dot { border-color: var(--mh-brown); box-shadow: 0 0 0 5px rgba(115, 84, 46, .18); }
.mh-trackbox { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 20px; padding: 12px 16px; border-radius: 12px; background: var(--mh-cream); color: var(--mh-dark); font-size: 14.5px; }
.mh-alert { padding: 14px 18px; border: 1.5px solid #EBC3BB; border-radius: 12px; background: #FBEDEA; color: #7A2B1D; font-weight: 600; }

/* ---------- جزئیات سفارش و آدرس‌ها ---------- */
.woocommerce table.shop_table { width: 100%; border: 1.5px solid var(--mh-sand); border-collapse: separate; border-spacing: 0; border-radius: 16px; overflow: hidden; }
.woocommerce table.shop_table th, .woocommerce table.shop_table td { padding: 12px 16px; border: 0; border-bottom: 1px solid var(--mh-cream); text-align: start; vertical-align: top; }
.woocommerce table.shop_table thead th { background: var(--mh-cream); color: var(--mh-dark); }
.woocommerce table.shop_table tfoot th { background: var(--mh-paper); }
.woocommerce table.shop_table tr:last-child > * { border-bottom: 0; }
.woocommerce-order-details, .woocommerce-customer-details { margin-top: 24px; overflow-x: auto; }
.woocommerce-columns--addresses, .woocommerce-Addresses { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.woocommerce-columns--addresses::before, .woocommerce-columns--addresses::after, .woocommerce-Addresses::before, .woocommerce-Addresses::after { display: none; }
.woocommerce-account .col-1, .woocommerce-account .col-2, .woocommerce-account .u-column1, .woocommerce-account .u-column2 { float: none; width: auto; }
.woocommerce-Address, .woocommerce-column--billing-address, .woocommerce-column--shipping-address { padding: 18px; border: 1.5px solid var(--mh-sand); border-radius: 16px; background: var(--mh-paper); }
.woocommerce-Address-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.woocommerce-Address-title h2, .woocommerce-Address-title h3 { margin: 0; }
.woocommerce address { font-style: normal; line-height: 2; color: var(--mh-soft); }

/* ---------- فرم‌ها ---------- */
.woocommerce form .form-row { margin: 0 0 16px; padding: 0; }
.woocommerce form .form-row label { display: block; margin-bottom: 6px; font-size: 14.5px; font-weight: 700; color: var(--mh-dark); line-height: 1.6; }
.woocommerce form .form-row .required { color: #B3432F; text-decoration: none; }
.woocommerce form .form-row input.input-text, .woocommerce form .form-row select, .woocommerce form .form-row textarea,
.woocommerce .select2-container--default .select2-selection--single {
  width: 100%; min-height: 48px; padding: 0 16px; border: 1.5px solid var(--mh-sand); border-radius: 14px; background: #fff;
  font: inherit; font-size: 15px; color: var(--mh-ink); box-shadow: none;
}
.woocommerce form .form-row textarea { padding: 12px 16px; min-height: 110px; }
.woocommerce .select2-container--default .select2-selection--single { display: flex; align-items: center; }
.woocommerce .select2-container--default .select2-selection--single .select2-selection__rendered { padding: 0; line-height: 1.6; color: var(--mh-ink); }
.woocommerce .select2-container--default .select2-selection--single .select2-selection__arrow { height: 46px; }
.woocommerce form .form-row input.input-text:focus, .woocommerce form .form-row select:focus, .woocommerce form .form-row textarea:focus {
  border-color: var(--mh-brown); outline: none; box-shadow: 0 0 0 3px rgba(115, 84, 46, .2);
}
.woocommerce form .form-row .woocommerce-input-wrapper { display: block; }
.woocommerce-address-fields__field-wrapper, .woocommerce-EditAccountForm { display: flex; flex-wrap: wrap; gap: 0 16px; }
.woocommerce-address-fields__field-wrapper > .form-row-first, .woocommerce-address-fields__field-wrapper > .form-row-last,
.woocommerce-EditAccountForm > .form-row-first, .woocommerce-EditAccountForm > .form-row-last { float: none; width: calc(50% - 8px); }
.woocommerce-address-fields__field-wrapper > .form-row-wide, .woocommerce-EditAccountForm > .form-row-wide,
.woocommerce-EditAccountForm > fieldset, .woocommerce-EditAccountForm > p:not(.form-row), .woocommerce-EditAccountForm > .woocommerce-form-row--wide { float: none; width: 100%; }
.woocommerce-EditAccountForm .clear, .woocommerce-address-fields__field-wrapper .clear { display: none; }
.woocommerce-EditAccountForm fieldset { margin: 8px 0 0; padding: 16px; border: 1.5px solid var(--mh-sand); border-radius: 16px; }
.woocommerce-EditAccountForm legend { padding: 0 8px; font-weight: 800; color: var(--mh-dark); }
.woocommerce form em, .woocommerce-EditAccountForm span em { font-size: 13px; color: var(--mh-muted); }

/* ---------- پیام‌های ووکامرس ---------- */
.woocommerce-message, .woocommerce-info, .woocommerce-error {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 20px; padding: 14px 18px; list-style: none;
  border: 1.5px solid var(--mh-sand); border-radius: 14px; background: var(--mh-cream); color: var(--mh-dark); line-height: 1.8;
}
.woocommerce-message::before, .woocommerce-info::before, .woocommerce-error::before { display: none; }
.woocommerce-error { border-color: #EBC3BB; background: #FBEDEA; color: #7A2B1D; }
.woocommerce-message .button, .woocommerce-info .button { float: none; margin-inline-start: auto; order: 2; }

/* ---------- ورود و ثبت‌نام (کاربر وارد نشده) ---------- */
body.woocommerce-account:not(.logged-in) .woocommerce { max-width: 1000px; margin-inline: auto; }
.woocommerce-account .u-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.woocommerce-account .u-columns::before, .woocommerce-account .u-columns::after { display: none; }
.woocommerce-account .u-columns > h2, .woocommerce-account h2 { font-size: 22px; font-weight: 800; color: var(--mh-dark); }
.woocommerce form.login, .woocommerce form.register, .woocommerce form.lost_reset_password, .woocommerce form.woocommerce-form-track-order, .woocommerce form.track_order {
  margin: 0; padding: 28px; border: 1.5px solid var(--mh-sand); border-radius: 20px; background: #fff;
}
body.woocommerce-account:not(.logged-in) .woocommerce > form.login { max-width: 480px; margin-inline: auto; }
.woocommerce form .form-row-first, .woocommerce form .form-row-last { float: none; width: 100%; }
.woocommerce-form-login__rememberme { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; font-weight: 500; }
.woocommerce-form-login__rememberme input, .woocommerce form .woocommerce-form__input-checkbox { width: 20px; height: 20px; accent-color: var(--mh-brown); }
.woocommerce form.login .button, .woocommerce form.register .button { width: 100%; min-height: 52px; font-size: 16px; }
.woocommerce-LostPassword { margin: 14px 0 0; text-align: center; }
.woocommerce-LostPassword a { color: var(--mh-brown); font-weight: 600; }
.woocommerce form .show-password-input { inset-inline-end: 14px; inset-inline-start: auto; }

/* ---------- پیگیری سفارش ---------- */
.woocommerce form.track_order { max-width: 560px; margin-inline: auto; }
.woocommerce-order-tracking, .woocommerce .order-info { line-height: 2; }
.woocommerce .order-info { margin-bottom: 18px; padding: 14px 18px; border-radius: 14px; background: var(--mh-cream); color: var(--mh-dark); }

/* ==========================================================================
   تبلت و موبایل
   ========================================================================== */
@media (max-width: 1023px) {
  body.woocommerce-account.logged-in .woocommerce { grid-template-columns: minmax(0, 1fr); gap: 16px; }

  /* منو: تب‌های افقی قابل اسکرول */
  .woocommerce-MyAccount-navigation { position: static; padding: 0; border: 0; border-radius: 0; background: transparent; }
  .mh-profile { padding: 4px 2px 14px; margin-bottom: 0; border-bottom: 0; }
  .woocommerce-MyAccount-navigation ul {
    display: flex; gap: 8px; margin-inline: calc(var(--mehra-gutter, 20px) * -1); padding: 2px var(--mehra-gutter, 20px) 8px;
    overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .woocommerce-MyAccount-navigation ul::-webkit-scrollbar { display: none; }
  .woocommerce-MyAccount-navigation li { flex: none; scroll-snap-align: center; }
  .woocommerce-MyAccount-navigation a { min-height: 44px; padding: 0 16px; gap: 8px; border: 1.5px solid var(--mh-sand); border-radius: 999px; background: #fff; white-space: nowrap; }
  .woocommerce-MyAccount-navigation .is-active a { border-color: var(--mh-brown); }
  .woocommerce-MyAccount-navigation .mh-ico { width: 20px; height: 20px; }
}

@media (max-width: 767px) {
  .woocommerce-account .woocommerce-MyAccount-content { padding: 18px 16px; border-radius: 18px; }
  .woocommerce-MyAccount-content h2, .woocommerce-MyAccount-content h3 { font-size: 18px; }

  .mh-hello { padding: 18px; }
  .mh-hello h2 { font-size: 20px; }
  .mh-stats li { flex: 1 1 0; min-width: 0; padding: 10px 14px; }
  .mh-tiles { gap: 10px; }
  .mh-tile { padding: 14px; border-radius: 16px; }
  .mh-tile__icon { width: 42px; height: 42px; }
  .mh-tile strong { font-size: 15px; }
  .mh-tile small { font-size: 12.5px; }
  .mh-mini a { grid-template-columns: 1fr auto; padding: 12px 14px; }
  .mh-mini__total { grid-column: 1 / -1; }

  /* کارت سفارش */
  .mh-order { grid-template-columns: minmax(0, 1fr) auto; padding: 16px; gap: 10px 12px; }
  .mh-order__meta { grid-column: 1 / -1; flex-direction: row; align-items: baseline; justify-content: space-between; }
  .mh-order__actions { grid-column: 1 / -1; }
  .mh-order__actions .mh-btn { flex: 1 1 0; }
  .mh-pager .mh-btn { flex: 1; }

  /* مراحل */
  .mh-timeline { padding: 18px 8px; }
  .mh-steps li strong { font-size: 13px; }
  .mh-steps li small { font-size: 11.5px; }
  .mh-trackbox { flex-direction: column; gap: 4px; }

  /* فرم‌ها و آدرس‌ها */
  .woocommerce-address-fields__field-wrapper > .form-row-first, .woocommerce-address-fields__field-wrapper > .form-row-last,
  .woocommerce-EditAccountForm > .form-row-first, .woocommerce-EditAccountForm > .form-row-last { width: 100%; }
  .woocommerce-columns--addresses, .woocommerce-Addresses { grid-template-columns: minmax(0, 1fr); }
  .woocommerce-account .u-columns { grid-template-columns: minmax(0, 1fr); }
  .woocommerce form.login, .woocommerce form.register, .woocommerce form.lost_reset_password, .woocommerce form.track_order { padding: 20px 16px; border-radius: 18px; }
  .woocommerce-Address-title { flex-wrap: wrap; }
  .woocommerce-message .button, .woocommerce-info .button { width: 100%; margin-inline-start: 0; }
  .woocommerce table.shop_table th, .woocommerce table.shop_table td { padding: 10px 12px; font-size: 14px; }
}
