/* ============================================================
   My Account — Custom Layout
   Layout: sidebar sticky 1/3 | content 2/3
   ============================================================ */

/* ── Wrapper ─────────────────────────────────────────────── */
.ma-wrap {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  min-height: 100vh;
  padding: 100px 40px 60px;
  max-width: 1400px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.ma-sidebar {
  width: 33.333%;
  flex-shrink: 0;
  position: sticky;
  top: 90px;
}

.ma-sidebar-inner {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Profile block ───────────────────────────────────────── */
.ma-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.ma-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  background: #9bcccd;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ma-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ma-avatar-initials {
  font-size: 36px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.ma-name {
  font-size: 20px;
  font-weight: 700;
  color: #111;
  margin: 0;
}

.ma-email {
  font-size: 13px;
  color: #888;
  margin: 0;
}

/* ── Stats ───────────────────────────────────────────────── */
.ma-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  background: #f7fafa;
  border-radius: 12px;
  padding: 16px 12px;
}

.ma-stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ma-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #111;
}

.ma-stat-value .woocommerce-Price-amount {
  font-size: 16px;
  font-weight: 700;
  color: #111;
}

.ma-stat-label {
  font-size: 12px;
  color: #888;
}

.ma-stat-divider {
  width: 1px;
  height: 36px;
  background: #e0e0e0;
  flex-shrink: 0;
  margin: 0 8px;
}

/* ── Navigation ──────────────────────────────────────────── */
.ma-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ma-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: #444;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
  position: relative;
}

.ma-nav-item svg {
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.ma-nav-item:hover {
  background: #f0f9f9;
  color: #00b0af;
}

.ma-nav-item:hover svg {
  opacity: 1;
}

.ma-nav-item.active {
  background: #e6f7f7;
  color: #00b0af;
  font-weight: 600;
}

.ma-nav-item.active svg {
  opacity: 1;
}

.ma-nav-badge {
  margin-left: auto;
  background: #00c9c8;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 100px;
  padding: 2px 7px;
  line-height: 1.4;
}

/* ── Logout ──────────────────────────────────────────────── */
.ma-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  color: #e74c3c;
  font-weight: 500;
  transition: background 0.2s;
  text-decoration: none;
  margin-top: 4px;
}

.ma-logout:hover {
  background: #fdecea;
}

.ma-logout svg {
  flex-shrink: 0;
}

/* ── Content area ────────────────────────────────────────── */
.ma-content {
  flex: 1;
  min-width: 0;
}

/* ── Tab panels ──────────────────────────────────────────── */
.ma-tab-panel {
  display: none;
}

.ma-tab-panel.active {
  display: block;
}

.ma-section-title {
  font-size: 22px;
  font-weight: 700;
  color: #111;
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e6f7f7;
}

/* ── Empty state ─────────────────────────────────────────── */
.ma-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 60px 20px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
  text-align: center;
  color: #aaa;
  font-size: 15px;
}

.ma-btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  background: #00c9c8;
  color: #fff;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
  margin-top: 8px;
}

.ma-btn-primary:hover {
  background: #00b0af;
}

/* ── Orders table ────────────────────────────────────────── */
.ma-table-wrap {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.ma-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ma-table thead tr {
  background: #f7fafa;
}

.ma-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid #f0f0f0;
}

.ma-table td {
  padding: 14px 16px;
  color: #333;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: middle;
}

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

.ma-table tbody tr:hover td {
  background: #fafefe;
}

/* ── Order status badges ─────────────────────────────────── */
.ma-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}

.ma-status--completed {
  background: #e6f9f0;
  color: #1a9e5c;
}

.ma-status--processing {
  background: #e8f4ff;
  color: #1a6fc4;
}

.ma-status--pending,
.ma-status--on-hold {
  background: #fff8e1;
  color: #b07d00;
}

.ma-status--cancelled,
.ma-status--failed,
.ma-status--refunded {
  background: #fdecea;
  color: #c0392b;
}

/* ── View order link ─────────────────────────────────────── */
.ma-btn-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1.5px solid #9bcccd;
  border-radius: 100px;
  font-size: 13px;
  font-weight: 500;
  color: #00b0af;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.ma-btn-link:hover {
  background: #00c9c8;
  border-color: #00c9c8;
  color: #fff;
}

/* ── Account info form (WC default override) ─────────────── */
#ma-tab-info .woocommerce-MyAccount-content {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
  padding: 28px;
}

#ma-tab-info .woocommerce-form-row {
  margin-bottom: 16px;
}

#ma-tab-info label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

#ma-tab-info input[type="text"],
#ma-tab-info input[type="email"],
#ma-tab-info input[type="password"] {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

#ma-tab-info input:focus {
  border-color: #00c9c8;
}

#ma-tab-info .button,
#ma-tab-info button[type="submit"] {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  background: #00c9c8;
  color: #fff;
  border: none;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 8px;
}

#ma-tab-info .button:hover,
#ma-tab-info button[type="submit"]:hover {
  background: #00b0af;
}

/* ── Coupons grid ────────────────────────────────────────── */
.ma-coupons-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ma-coupon-card {
  display: flex;
  align-items: center;
  gap: 0;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  border: 1.5px solid #e6f7f7;
  transition: box-shadow 0.2s;
}

.ma-coupon-card:hover {
  box-shadow: 0 6px 28px rgba(0, 201, 200, 0.15);
}

.ma-coupon-card--expired {
  opacity: 0.55;
  filter: grayscale(0.4);
}

.ma-coupon-left {
  width: 64px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #00c9c8, #9bcccd);
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  color: #fff;
}

.ma-coupon-body {
  flex: 1;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ma-coupon-code {
  font-size: 18px;
  font-weight: 800;
  color: #111;
  letter-spacing: 0.06em;
  font-family: monospace;
}

.ma-coupon-discount {
  font-size: 14px;
  font-weight: 600;
  color: #00b0af;
}

.ma-coupon-min {
  font-size: 12px;
  color: #888;
}

.ma-coupon-expiry {
  font-size: 12px;
  color: #555;
}

.ma-coupon-expiry.expired {
  color: #e74c3c;
  font-weight: 600;
}

.ma-coupon-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 20px;
  background: none;
  border: none;
  border-left: 1.5px dashed #d0eded;
  cursor: pointer;
  color: #00b0af;
  font-size: 12px;
  font-weight: 600;
  transition:
    background 0.2s,
    color 0.2s;
  flex-shrink: 0;
}

.ma-coupon-copy:hover {
  background: #e6f7f7;
}

.ma-coupon-copy.copied {
  color: #1a9e5c;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) {
  .ma-wrap {
    padding: 90px 24px 48px;
    gap: 24px;
  }

  .ma-sidebar {
    width: 38%;
  }
}

@media (max-width: 768px) {
  .ma-wrap {
    flex-direction: column;
    padding: 80px 16px 40px;
    gap: 20px;
  }

  .ma-sidebar {
    width: 100%;
    position: static;
  }

  .ma-sidebar-inner {
    padding: 24px 20px;
  }

  .ma-nav ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .ma-nav-item {
    flex: 1 1 auto;
    justify-content: center;
    padding: 10px 12px;
    font-size: 13px;
    gap: 6px;
  }

  .ma-nav-item svg {
    display: none;
  }

  .ma-table th:nth-child(2),
  .ma-table td:nth-child(2) {
    display: none;
  }

  .ma-coupon-code {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .ma-table th:nth-child(4),
  .ma-table td:nth-child(4) {
    display: none;
  }
}

/* ── Order detail modal ──────────────────────────────────── */
.ma-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.ma-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.ma-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  transform: translateY(16px);
  transition: transform 0.25s ease;
  overflow: hidden;
}

.ma-modal-overlay.open .ma-modal {
  transform: translateY(0);
}

.ma-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.ma-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #111;
  margin: 0;
}

.ma-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #888;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    color 0.2s;
}

.ma-modal-close:hover {
  background: #f5f5f5;
  color: #333;
}

.ma-modal-body {
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Meta info grid */
.ma-modal-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f7fafa;
  border-radius: 10px;
  padding: 16px;
}

.ma-modal-meta-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  color: #333;
}

.ma-modal-meta-label {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  min-width: 90px;
  flex-shrink: 0;
}

/* Items table */
.ma-modal-items-wrap {
  overflow-x: auto;
}

.ma-modal-items {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ma-modal-items thead tr {
  background: #f7fafa;
}

.ma-modal-items th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ma-modal-items td {
  padding: 10px 12px;
  border-bottom: 1px solid #f5f5f5;
  vertical-align: middle;
}

.ma-modal-item-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ma-modal-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: #eee;
}

.ma-modal-item-qty {
  color: #888;
  white-space: nowrap;
}

.ma-modal-item-price {
  font-weight: 600;
  white-space: nowrap;
}

.ma-modal-discount {
  color: #1a9e5c;
  font-weight: 600;
}

/* Totals */
.ma-modal-totals table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ma-modal-totals td {
  padding: 6px 0;
  color: #555;
}

.ma-modal-totals td:last-child {
  text-align: right;
  font-weight: 500;
  color: #333;
}

.ma-modal-total-row td {
  padding-top: 12px;
  border-top: 1.5px solid #eee;
  font-size: 16px;
  color: #111 !important;
}

/* Note */
.ma-modal-note {
  font-size: 13px;
  color: #666;
  background: #fffbea;
  border-left: 3px solid #f0c040;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
}

/* Coupon description */
.ma-coupon-desc {
  font-size: 12px;
  color: #666;
  font-style: italic;
}

@media (max-width: 480px) {
  .ma-modal-body {
    padding: 16px;
  }

  .ma-modal-meta-label {
    min-width: 72px;
  }
}

/* ── Order fail reason ───────────────────────────────────── */
.ma-modal-fail-reason {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fdecea;
  border-left: 3px solid #e74c3c;
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  font-size: 13px;
  color: #c0392b;
}

.ma-modal-fail-reason svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: #e74c3c;
}

.ma-modal-fail-reason strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
}

/* ── Customer notes from admin ───────────────────────────── */
.ma-modal-customer-notes {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ma-modal-cn-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ma-modal-cn-title svg {
  color: #00b0af;
  flex-shrink: 0;
}

.ma-modal-cn-item {
  background: #f0fafa;
  border-left: 3px solid #00c9c8;
  border-radius: 0 8px 8px 0;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ma-modal-cn-content {
  font-size: 14px;
  color: #333;
  line-height: 1.5;
}

.ma-modal-cn-date {
  font-size: 11px;
  color: #999;
}

/* ── Account info form (custom) ──────────────────────────── */
.ma-info-wrap {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.05);
  padding: 28px;
}

.ma-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 20px;
}

.ma-alert svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.ma-alert ul {
  margin: 0;
  padding: 0 0 0 16px;
}

.ma-alert--success {
  background: #e6f9f0;
  color: #1a9e5c;
  border: 1px solid #b2e8d0;
}

.ma-alert--error {
  background: #fdecea;
  color: #c0392b;
  border: 1px solid #f5c6c2;
}

.ma-info-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.ma-info-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.ma-info-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ma-info-field label {
  font-size: 13px;
  font-weight: 600;
  color: #555;
}

.ma-required {
  color: #e74c3c;
}

.ma-info-field input[type="text"],
.ma-info-field input[type="email"],
.ma-info-field input[type="password"] {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
  background: #fff;
}

.ma-info-field input:focus {
  border-color: #00c9c8;
}

.ma-field-hint {
  font-size: 12px;
  color: #aaa;
}

.ma-pass-wrap {
  position: relative;
}

.ma-pass-wrap input {
  padding-right: 44px !important;
}

.ma-toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  padding: 0;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.ma-toggle-pw:hover,
.ma-toggle-pw.active {
  color: #00b0af;
}

.ma-info-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #aaa;
  font-size: 13px;
  margin: 4px 0;
}

.ma-info-divider::before,
.ma-info-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #eee;
}

.ma-info-divider em {
  font-style: normal;
  font-size: 12px;
  color: #bbb;
}

.ma-info-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: #00c9c8;
  color: #fff;
  border: none;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  align-self: flex-start;
  margin-top: 4px;
}

.ma-info-submit:hover {
  background: #00b0af;
}

@media (max-width: 600px) {
  .ma-info-row {
    grid-template-columns: 1fr;
  }

  .ma-info-wrap {
    padding: 20px 16px;
  }
}
