/* ==========================================================================
   Pardis Store — My Account
   ========================================================================== */

:root {
  --ps-account-brand: #13369d;
  --ps-account-brand-dark: #0f2d7a;
  --ps-account-bg: #f3f6fc;
  --ps-account-surface: #ffffff;
  --ps-account-border: #e3e8f2;
  --ps-account-text: #0f172a;
  --ps-account-muted: #64748b;
  --ps-account-radius: 16px;
  --ps-account-radius-sm: 12px;
  --ps-account-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
  --ps-account-sidebar-width: 290px;
  --ps-account-max-width: 1450px;
}

body.ps-my-account-page {
  font-family: "YekanBakhFaNum", system-ui, sans-serif;
  color: var(--ps-account-text);
}

/* Full-width shell — هم‌تراز با هدر (1450px) */
body.ps-my-account-page #primary,
body.ps-my-account-page main#content,
body.ps-my-account-page main.site-main,
body.ps-my-account-page .site-main {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  background: var(--ps-account-bg);
}

body.ps-my-account-page .page-content {
  width: 100% !important;
  max-width: var(--ps-account-max-width) !important;
  margin: 0 auto !important;
  padding: 0 1rem 2.5rem !important;
  box-sizing: border-box;
  float: none !important;
  background: var(--ps-account-bg);
}

body.ps-my-account-page .woocommerce {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  clear: both;
}

body.ps-my-account-page .entry-title,
body.ps-my-account-page .page-header,
body.ps-my-account-page .woocommerce > h2:first-child {
  display: none !important;
}

body.ps-my-account-page .woocommerce::before,
body.ps-my-account-page .woocommerce::after {
  display: none;
}

body.ps-my-account-page .woocommerce > .woocommerce-MyAccount-navigation:not(.ps-account-nav) {
  display: none !important;
}

/* Hello theme underlines all links inside .page-content */
body.ps-my-account-page .page-content .ps-account a,
body.ps-my-account-page .page-content a.ps-account-dash-card,
body.ps-my-account-page .page-content a.ps-account-section-link,
body.ps-my-account-page .page-content a.ps-order-card__link,
body.ps-my-account-page .page-content a.ps-order-card__number,
body.ps-my-account-page .ps-account__content a {
  text-decoration: none !important;
}

body.ps-my-account-page .page-content .ps-account a:hover,
body.ps-my-account-page .page-content .ps-account a:focus,
body.ps-my-account-page .ps-account__content a:hover,
body.ps-my-account-page .ps-account__content a:focus {
  text-decoration: none !important;
}

/* Reset WooCommerce float layout — ریشه مشکل سایدبار نصفه */
body.ps-my-account-page .woocommerce-account .woocommerce-MyAccount-navigation,
body.ps-my-account-page .woocommerce-account .woocommerce-MyAccount-content,
body.ps-my-account-page .ps-account__sidebar .woocommerce-MyAccount-navigation,
body.ps-my-account-page .ps-account__content.woocommerce-MyAccount-content {
  float: none !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  clear: none !important;
}

/* Layout shell */
.ps-account {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  width: 100%;
  padding-top: 1rem;
  direction: rtl;
}

.ps-account__main {
  min-width: 0;
  grid-area: account-main;
}

.ps-account__header {
  margin-bottom: 1rem;
}

.ps-account__title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ps-account-text);
}

.ps-account__content {
  background: var(--ps-account-surface);
  border: 1px solid var(--ps-account-border);
  border-radius: var(--ps-account-radius);
  padding: 1.15rem;
  box-shadow: var(--ps-account-shadow);
}

/* Mobile top nav */
.ps-account-mobile-nav {
  display: block;
  grid-area: account-mobile-nav;
  margin-bottom: 0.25rem;
}

.ps-account-mobile-nav__track {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.15rem 0 0.5rem;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.ps-account-mobile-nav__track::-webkit-scrollbar {
  display: none;
}

.ps-account-mobile-nav__item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--ps-account-border);
  background: var(--ps-account-surface);
  color: var(--ps-account-muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.ps-account-mobile-nav__item .material-symbols-outlined {
  font-family: "Material Symbols Outlined", sans-serif;
  font-size: 18px;
  line-height: 1;
}

.ps-account-mobile-nav__item.is-active {
  background: #eef3ff;
  border-color: #c7d7fe;
  color: var(--ps-account-brand);
}

/* Sidebar */
.ps-account__sidebar {
  grid-area: account-sidebar;
  background: var(--ps-account-surface);
  border: 1px solid var(--ps-account-border);
  border-radius: var(--ps-account-radius);
  padding: 1rem;
  box-shadow: var(--ps-account-shadow);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  align-self: stretch;
}

.ps-account-nav {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
}

.ps-account__profile {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-bottom: 1rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #eef2f7;
}

.ps-account__avatar-wrap {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: #eef3ff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ps-account__avatar {
  font-family: "Material Symbols Outlined", sans-serif;
  font-size: 34px;
  color: var(--ps-account-brand);
  line-height: 1;
}

.ps-account__hello {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ps-account-muted);
}

.ps-account__name {
  margin: 0.15rem 0 0;
  font-size: 1rem;
  font-weight: 700;
}

.ps-account__phone {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--ps-account-muted);
  direction: ltr;
  text-align: right;
}

.ps-account-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ps-account-nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 0.85rem;
  border-radius: var(--ps-account-radius-sm);
  text-decoration: none;
  color: #334155;
  font-size: 0.92rem;
  font-weight: 600;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.ps-account-nav a:hover {
  background: #f8fafc;
  color: var(--ps-account-brand);
}

.ps-account-nav .is-active a {
  background: #eef3ff;
  color: var(--ps-account-brand);
}

.ps-account-nav__icon {
  font-family: "Material Symbols Outlined", sans-serif;
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.ps-account__logout {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-top: auto;
  padding: 0.72rem 0.85rem;
  border-radius: var(--ps-account-radius-sm);
  border: 1px solid #fecdd3;
  background: #fff1f2;
  color: #be123c;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  flex-shrink: 0;
}

.ps-account__logout .material-symbols-outlined {
  font-family: "Material Symbols Outlined", sans-serif;
  font-size: 20px;
}

/* Dashboard */
.ps-account-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.ps-account-stat {
  background: #fafcff;
  border: 1px solid var(--ps-account-border);
  border-radius: var(--ps-account-radius-sm);
  padding: 0.85rem 0.75rem;
  text-align: center;
}

.ps-account-stat__value {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ps-account-brand);
  line-height: 1.2;
}

.ps-account-stat__value--sm {
  font-size: 0.95rem;
  font-weight: 700;
}

.ps-account-stat__label {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--ps-account-muted);
}

.ps-account-dashboard__cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.ps-account-dash-card {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  grid-template-areas:
    "icon title"
    "icon desc";
  column-gap: 0.85rem;
  row-gap: 0.15rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--ps-account-border);
  border-radius: var(--ps-account-radius-sm);
  text-decoration: none !important;
  color: inherit;
  background: #fafcff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.ps-account-dash-card:hover,
.ps-account-dash-card:focus {
  border-color: #c7d7fe;
  box-shadow: 0 8px 20px rgba(19, 54, 157, 0.08);
  transform: translateY(-1px);
  color: inherit;
  text-decoration: none !important;
}

.ps-account-dash-card__icon {
  grid-area: icon;
  align-self: center;
  font-family: "Material Symbols Outlined", sans-serif;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  color: var(--ps-account-brand);
  font-size: 28px;
  line-height: 1;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.ps-account-dash-card__title {
  grid-area: title;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
}

.ps-account-dash-card__desc {
  grid-area: desc;
  font-size: 0.82rem;
  color: var(--ps-account-muted);
  line-height: 1.45;
}

.ps-account-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.ps-account-section-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.ps-account-section-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ps-account-brand);
  text-decoration: none;
}

.ps-account-lead {
  margin: 0 0 1rem;
  color: var(--ps-account-muted);
  line-height: 1.7;
}

/* Orders */
.ps-orders-list {
  display: grid;
  gap: 0.75rem;
}

.ps-order-card {
  border: 1px solid var(--ps-account-border);
  border-radius: var(--ps-account-radius-sm);
  padding: 0.95rem;
  background: #fafcff;
}

.ps-order-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.ps-order-card__number {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ps-account-brand);
  text-decoration: none;
}

.ps-order-status {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.ps-order-status.is-pending,
.ps-order-status.is-hold {
  background: #fef3c7;
  color: #92400e;
}

.ps-order-status.is-processing {
  background: #dbeafe;
  color: #1d4ed8;
}

.ps-order-status.is-completed {
  background: #dcfce7;
  color: #166534;
}

.ps-order-status.is-cancelled,
.ps-order-status.is-failed {
  background: #fee2e2;
  color: #b91c1c;
}

.ps-order-status.is-refunded,
.ps-order-status.is-default {
  background: #f1f5f9;
  color: #475569;
}

.ps-order-card__meta {
  display: grid;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--ps-account-muted);
}

.ps-order-card__meta strong {
  color: var(--ps-account-text);
}

.ps-order-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ps-order-card__label {
  color: var(--ps-account-muted);
}

.ps-order-card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.65rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ps-account-brand);
  text-decoration: none;
}

.ps-order-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #eef2f7;
}

.ps-order-detail__summary {
  display: grid;
  gap: 0.65rem;
  padding: 1rem;
  border: 1px solid var(--ps-account-border);
  border-radius: var(--ps-account-radius-sm);
  background: #fafcff;
  margin-bottom: 1rem;
}

.ps-order-detail__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.92rem;
}

.ps-order-updates__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.ps-order-updates__item {
  padding: 0.85rem;
  border: 1px solid var(--ps-account-border);
  border-radius: var(--ps-account-radius-sm);
  background: #fff;
}

.ps-order-updates__item time {
  display: block;
  font-size: 0.78rem;
  color: var(--ps-account-muted);
  margin-bottom: 0.35rem;
}

/* Addresses */
.ps-address-grid {
  display: grid;
  gap: 0.85rem;
}

.ps-address-card {
  border: 1px solid var(--ps-account-border);
  border-radius: var(--ps-account-radius-sm);
  overflow: hidden;
  background: #fafcff;
}

.ps-address-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #eef2f7;
}

.ps-address-card__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.ps-address-card__edit {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ps-account-brand);
  text-decoration: none;
}

.ps-address-card__edit .material-symbols-outlined {
  font-family: "Material Symbols Outlined", sans-serif;
  font-size: 18px;
}

.ps-address-card__body {
  padding: 1rem;
}

.ps-address-card__body address {
  font-style: normal;
  line-height: 1.8;
  color: #334155;
}

.ps-address-card__empty {
  margin: 0;
  color: var(--ps-account-muted);
}

/* Forms */
.ps-account-form .ps-form-section {
  margin-bottom: 1.25rem;
}

.ps-form-section__title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
}

.ps-form-section__desc {
  margin: -0.35rem 0 0.75rem;
  font-size: 0.85rem;
  color: var(--ps-account-muted);
}

.ps-form-grid {
  display: grid;
  gap: 0.85rem;
}

.ps-account-form label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
}

.ps-account-form .input-text,
.ps-account-form select,
.ps-account-form textarea,
.ps-account__content .woocommerce-input-wrapper .input-text,
.ps-account__content .select2-container .select2-selection {
  width: 100% !important;
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  border: 1px solid #dbe3f0;
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--ps-account-text);
  box-sizing: border-box;
}

.ps-form-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--ps-account-muted);
}

.ps-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

/* Buttons */
.ps-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 42px;
  padding: 0.65rem 1.1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.ps-btn--primary {
  background: var(--ps-account-brand);
  color: #fff !important;
  border-color: var(--ps-account-brand);
}

.ps-btn--primary:hover {
  background: var(--ps-account-brand-dark);
  border-color: var(--ps-account-brand-dark);
}

.ps-btn--ghost {
  background: #fff;
  color: var(--ps-account-brand) !important;
  border-color: #c7d7fe;
}

.ps-btn--ghost:hover {
  background: #eef3ff;
}

.ps-btn--sm {
  min-height: 36px;
  padding: 0.45rem 0.85rem;
  font-size: 0.82rem;
}

/* Wishlist tab (existing) */
.ps-account-wishlist__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.ps-account-wishlist__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.ps-account-wishlist__meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ps-account-muted);
}

.ps-account-wishlist__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

.ps-account-wishlist-card {
  position: relative;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0.85rem;
  padding: 0.85rem;
  border: 1px solid var(--ps-account-border);
  border-radius: var(--ps-account-radius-sm);
  background: #fff;
}

.ps-account-wishlist-card__remove {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.ps-account-wishlist-card__remove .material-symbols-outlined {
  font-family: "Material Symbols Outlined", sans-serif;
  font-size: 18px;
}

.ps-account-wishlist-card__image {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 96px;
  border-radius: 10px;
  background: #f8fafc;
  overflow: hidden;
}

.ps-account-wishlist-card__image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ps-account-wishlist-card__title {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--ps-account-text);
  text-decoration: none;
  line-height: 1.5;
  margin-bottom: 0.35rem;
}

.ps-account-wishlist-card__price {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ps-account-brand);
  margin-bottom: 0.5rem;
}

.ps-account-wishlist-card__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  background: var(--ps-account-brand);
  color: #fff !important;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Downloads */
.ps-downloads-list {
  display: grid;
  gap: 0.75rem;
}

.ps-download-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--ps-account-border);
  border-radius: var(--ps-account-radius-sm);
  background: #fafcff;
}

.ps-download-card__title {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

.ps-download-card__title a {
  color: inherit;
  text-decoration: none;
}

.ps-download-card__file,
.ps-download-card__meta {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ps-account-muted);
}

/* Empty states */
.ps-account-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--ps-account-muted);
}

.ps-account-empty__icon {
  font-family: "Material Symbols Outlined", sans-serif;
  font-size: 42px;
  color: #cbd5e1;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.ps-account-empty__btn {
  display: inline-flex;
  margin-top: 0.85rem;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  background: var(--ps-account-brand);
  color: #fff !important;
  text-decoration: none;
  font-weight: 600;
}

/* Pagination + WC notices */
.ps-account-pagination {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1rem;
}

.ps-account__content .woocommerce-message,
.ps-account__content .woocommerce-info,
.ps-account__content .woocommerce-error {
  border-radius: 10px;
  margin-bottom: 1rem;
  font-family: inherit;
}

.ps-account__content .woocommerce-orders-table {
  display: none;
}

/* Responsive */
@media (max-width: 767px) {
  .ps-account-stats {
    grid-template-columns: 1fr;
  }

  .ps-account {
    grid-template-areas:
      "account-mobile-nav"
      "account-main";
  }

  .ps-account__sidebar {
    display: none !important;
  }

  .ps-account__content {
    padding: 1rem;
  }

  .ps-download-card {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (min-width: 768px) {
  body.ps-my-account-page .page-content {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }

  .ps-account {
    grid-template-columns: var(--ps-account-sidebar-width) minmax(0, 1fr);
    grid-template-areas: "account-sidebar account-main";
    gap: 1.25rem;
    align-items: start;
    padding-top: 1.5rem;
  }

  .ps-account-mobile-nav {
    display: none !important;
  }

  .ps-account__sidebar {
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + var(--ps-sticky-below-header, 8.8125rem) + 0.35rem);
    min-height: 420px;
  }

  .ps-account__logout {
    display: inline-flex;
  }

  .ps-account-dashboard__cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ps-account-wishlist__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ps-address-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ps-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ps-form-grid .form-row-wide {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1024px) {
  body.ps-my-account-page .page-content {
    padding-left: 2rem !important;
    padding-right: 2rem !important;
  }

  .ps-account {
    gap: 1.5rem;
  }

  .ps-account__content {
    padding: 1.35rem 1.5rem;
  }

  .ps-account__title {
    font-size: 1.5rem;
  }
}
