/* ==========================================================================
   Woo My Account Layout – styles
   Zamzam Pharmacy
   ========================================================================== */

/* ── Tokens ── */
.wmal-wrap,
.e-my-account-tab {
  --wmal-red:          #d10419;
  --wmal-red-hover:    #b00315;
  --wmal-red-soft:     rgba(209, 4, 25, 0.07);
  --wmal-card-bg:      #ffffff;
  --wmal-card-border:  #f0f0f1;
  --wmal-card-radius:  16px;
  --wmal-card-pad:     28px;
  --wmal-line:         #f0f0f1;
  --wmal-soft:         #f8f8f9;
  --wmal-heading:      #16181a;
  --wmal-text:         #2c2f33;
  --wmal-muted:        #8a8f96;
  --wmal-nav-w:        230px;
  --wmal-gap:          24px;
  --wmal-radius-btn:   40px;
  --wmal-radius-badge: 20px;
}

/* ── Top-level layout produced by Elementor My Account widget ── */
.e-my-account-tabs-vertical .woocommerce {
  display: flex !important;
  align-items: flex-start !important;
  gap: var(--wmal-gap) !important;
}

/* ── Sidebar nav ── */
.wmal-nav {
  width: var(--wmal-nav-w);
  min-width: var(--wmal-nav-w);
  flex-shrink: 0;
  background: var(--wmal-card-bg);
  border: 1px solid var(--wmal-card-border);
  border-radius: var(--wmal-card-radius);
  padding: 12px;
}

.wmal-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.wmal-nav__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--wmal-text);
  text-decoration: none !important;
  transition: background 0.18s, color 0.18s;
  line-height: 1.3;
}

.wmal-nav__link:hover {
  background: var(--wmal-red-soft);
  color: var(--wmal-red);
}

.wmal-nav__item--active .wmal-nav__link {
  background: var(--wmal-red-soft);
  color: var(--wmal-red);
  font-weight: 600;
}

.wmal-nav__icon {
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
  color: inherit;
}

/* Logout item – slightly muted unless hovered */
.wmal-nav__item:last-child .wmal-nav__link {
  color: var(--wmal-muted);
}
.wmal-nav__item:last-child .wmal-nav__link:hover {
  color: var(--wmal-red);
}

/* ── Content area ── */
.woocommerce-MyAccount-content {
  flex: 1 1 0;
  min-width: 0;
  background: var(--wmal-card-bg);
  border: 1px solid var(--wmal-card-border);
  border-radius: var(--wmal-card-radius);
  padding: var(--wmal-card-pad);
}

/* ── Dashboard greeting ── */
.wmal-greeting {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 24px;
  background: var(--wmal-soft);
  border-radius: 12px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

/* decorative leaf shape */
.wmal-greeting::after {
  content: '';
  position: absolute;
  right: -30px;
  bottom: -30px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(209, 4, 25, 0.05);
  pointer-events: none;
}

.wmal-greeting__avatar {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  background: #e8e8e8;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.wmal-greeting__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wmal-greeting__name {
  font-size: 20px;
  font-weight: 700;
  color: var(--wmal-heading);
  margin: 0 0 6px;
}

.wmal-greeting__desc {
  font-size: 13px;
  color: var(--wmal-muted);
  margin: 0;
  line-height: 1.6;
}

/* ── Recent orders section ── */
.wmal-recent-orders__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.wmal-recent-orders__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--wmal-heading);
  margin: 0;
}

.wmal-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--wmal-red);
  text-decoration: underline !important;
  text-underline-offset: 3px;
}

.wmal-link:hover {
  color: var(--wmal-red-hover);
}

/* ── Table ── */
.wmal-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.wmal-orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 480px;
}

.wmal-orders-table thead tr {
  border-bottom: 2px solid var(--wmal-line);
}

.wmal-orders-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--wmal-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.wmal-orders-table tbody tr {
  border-bottom: 1px solid var(--wmal-line);
}

.wmal-orders-table tbody tr:last-child {
  border-bottom: none;
}

.wmal-orders-table tbody td {
  padding: 14px 14px;
  color: var(--wmal-text);
  vertical-align: middle;
}

.wmal-order-num {
  font-weight: 600;
  color: var(--wmal-heading);
  text-decoration: none !important;
}

.wmal-order-num:hover {
  color: var(--wmal-red);
  text-decoration: underline !important;
}

/* ── Status badges ── */
.wmal-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--wmal-radius-badge);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.wmal-status--completed    { background: rgba(34,197,94,.13);  color: #15803d; }
.wmal-status--processing   { background: rgba(59,130,246,.13); color: #1d4ed8; }
.wmal-status--on-hold      { background: rgba(234,179,8,.13);  color: #a16207; }
.wmal-status--pending      { background: rgba(234,179,8,.13);  color: #a16207; }
.wmal-status--cancelled    { background: rgba(239,68,68,.13);  color: #b91c1c; }
.wmal-status--failed       { background: rgba(239,68,68,.13);  color: #b91c1c; }
.wmal-status--refunded     { background: rgba(148,163,184,.2); color: #475569; }

/* ── Buttons ── */
.wmal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  border-radius: var(--wmal-radius-btn);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none !important;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
  white-space: nowrap;
  cursor: pointer;
}

.wmal-btn--outline {
  border: 1.5px solid var(--wmal-red);
  color: var(--wmal-red) !important;
  background: transparent;
}

.wmal-btn--outline:hover {
  background: var(--wmal-red);
  color: #ffffff !important;
}

/* ── Empty state ── */
.wmal-empty {
  color: var(--wmal-muted);
  font-size: 14px;
  padding: 20px 0 4px;
  margin: 0;
}

/* ── WooCommerce notices inside the content ── */
.woocommerce-MyAccount-content .woocommerce-message,
.woocommerce-MyAccount-content .woocommerce-info,
.woocommerce-MyAccount-content .woocommerce-error {
  border-left: 4px solid var(--wmal-red);
  background: var(--wmal-red-soft);
  color: var(--wmal-text);
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 20px;
  list-style: none;
}

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

.woocommerce-MyAccount-content .woocommerce-message a.button,
.woocommerce-MyAccount-content .woocommerce-info a.button {
  background: var(--wmal-red) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: var(--wmal-radius-btn) !important;
  padding: 8px 20px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  margin-right: 10px;
  float: none !important;
  display: inline-flex;
}

/* ── WooCommerce core orders table (the /orders/ endpoint) ── */
.woocommerce-orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.woocommerce-orders-table thead th {
  padding: 10px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--wmal-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--wmal-line);
}

.woocommerce-orders-table tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--wmal-line);
  color: var(--wmal-text);
  vertical-align: middle;
}

.woocommerce-orders-table tbody tr:last-child td {
  border-bottom: none;
}

.woocommerce-orders-table mark.order-status {
  background: none !important;
  padding: 4px 12px !important;
  border-radius: var(--wmal-radius-badge) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
}

.woocommerce-orders-table .status-completed mark,
.woocommerce-orders-table tr.status-completed mark {
  background: rgba(34,197,94,.13) !important;
  color: #15803d !important;
}
.woocommerce-orders-table .status-processing mark,
.woocommerce-orders-table tr.status-processing mark {
  background: rgba(59,130,246,.13) !important;
  color: #1d4ed8 !important;
}
.woocommerce-orders-table .status-on-hold mark,
.woocommerce-orders-table .status-pending mark {
  background: rgba(234,179,8,.13) !important;
  color: #a16207 !important;
}
.woocommerce-orders-table .status-cancelled mark,
.woocommerce-orders-table .status-failed mark {
  background: rgba(239,68,68,.13) !important;
  color: #b91c1c !important;
}

.woocommerce-orders-table .woocommerce-button,
.woocommerce-orders-table a.button,
.woocommerce-orders-table .button {
  display: inline-flex !important;
  align-items: center !important;
  padding: 8px 20px !important;
  border-radius: var(--wmal-radius-btn) !important;
  border: 1.5px solid var(--wmal-red) !important;
  color: var(--wmal-red) !important;
  background: transparent !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  transition: background 0.18s, color 0.18s !important;
}

.woocommerce-orders-table a.button:hover,
.woocommerce-orders-table .button:hover {
  background: var(--wmal-red) !important;
  color: #ffffff !important;
}

/* ── Account / address forms ── */
.woocommerce-MyAccount-content .woocommerce-address-fields label,
.woocommerce-MyAccount-content .woocommerce-EditAccountForm label {
  font-size: 13px;
  font-weight: 600;
  color: var(--wmal-muted);
  display: block;
  margin-bottom: 6px;
}

.woocommerce-MyAccount-content .woocommerce-address-fields input,
.woocommerce-MyAccount-content .woocommerce-EditAccountForm input,
.woocommerce-MyAccount-content .woocommerce-address-fields select,
.woocommerce-MyAccount-content .woocommerce-EditAccountForm select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--wmal-card-border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--wmal-text);
  background: #ffffff;
  outline: none;
  transition: border-color 0.18s;
}

.woocommerce-MyAccount-content input:focus,
.woocommerce-MyAccount-content select:focus {
  border-color: var(--wmal-red);
}

.woocommerce-MyAccount-content .button[type="submit"],
.woocommerce-MyAccount-content button[type="submit"] {
  background: var(--wmal-red) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: var(--wmal-radius-btn) !important;
  padding: 12px 32px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: background 0.18s !important;
}

.woocommerce-MyAccount-content .button[type="submit"]:hover,
.woocommerce-MyAccount-content button[type="submit"]:hover {
  background: var(--wmal-red-hover) !important;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Tablet: narrow sidebar */
@media (max-width: 900px) {
  :root {
    --wmal-nav-w: 180px;
  }
  .wmal-nav__link {
    padding: 10px 12px;
    font-size: 13px;
    gap: 8px;
  }
  .wmal-nav__icon {
    font-size: 16px;
  }
  .woocommerce-MyAccount-content {
    padding: 20px;
  }
}

/* Mobile: stack sidebar above content */
@media (max-width: 640px) {
  .e-my-account-tabs-vertical .woocommerce {
    flex-direction: column !important;
  }

  .wmal-nav {
    width: 100% !important;
    min-width: 0 !important;
    padding: 8px;
  }

  .wmal-nav__list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  .wmal-nav__item {
    flex: 0 0 auto;
  }

  .wmal-nav__link {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
  }

  .wmal-nav__label {
    display: none;
  }

  .wmal-nav__link {
    gap: 0;
    justify-content: center;
    padding: 10px 14px;
  }

  .wmal-nav__icon {
    font-size: 20px;
  }

  .woocommerce-MyAccount-content {
    width: 100%;
    padding: 16px;
  }

  .wmal-greeting {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px 16px;
  }

  .wmal-orders-table {
    font-size: 13px;
    min-width: 0;
  }

  /* Stack table rows on very small screens */
  .wmal-orders-table thead {
    display: none;
  }

  .wmal-orders-table tbody tr {
    display: block;
    padding: 12px 0;
  }

  .wmal-orders-table tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: none;
  }

  .wmal-orders-table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--wmal-muted);
    font-size: 12px;
    margin-right: 8px;
  }

  .wmal-orders-table tbody tr {
    border-bottom: 1px solid var(--wmal-line);
    padding: 12px 14px;
  }

  /* Core WooCommerce orders table on /orders/ endpoint */
  .woocommerce-orders-table {
    font-size: 13px;
  }
}
