/* ══════════════════════════════════════════════════════════════
   ABR UM Profile  ·  سیستم مدیریت کاربر ابرباران
   Minimal · RTL · Responsive
   ══════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --abr-bg:          #F7F7F8;
  --abr-surface:     #FFFFFF;
  --abr-border:      #E8E8EC;
  --abr-text:        #1A1A2E;
  --abr-muted:       #7A7A8C;
  --abr-accent:      #2563EB;
  --abr-accent-light:#EFF4FF;
  --abr-gold:        #D4A017;
  --abr-gold-light:  #FDF8EC;
  --abr-success:     #16A34A;
  --abr-danger:      #DC2626;
  --abr-radius:      12px;
  --abr-radius-sm:   8px;
  --abr-shadow:      0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  --abr-sidebar-w:   240px;
  --abr-font:        'Vazirmatn', 'Vazir', system-ui, sans-serif;
}

/* ── Reset wrapper ───────────────────────────────────────────── */
.abr-um-wrap *,
.abr-um-wrap *::before,
.abr-um-wrap *::after { box-sizing: border-box; }

/* ── Layout ──────────────────────────────────────────────────── */
.abr-um-wrap {
  display: flex;
  gap: 24px;
  max-width: 1080px;
  margin: 40px auto;
  padding: 0 20px 60px;
  direction: rtl;
  font-family: var(--abr-font);
  color: var(--abr-text);
  background: var(--abr-bg);
  min-height: 75vh;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.abr-sidebar {
  width: var(--abr-sidebar-w);
  flex-shrink: 0;
}

.abr-avatar-block {
  background: var(--abr-surface);
  border: 1px solid var(--abr-border);
  border-radius: var(--abr-radius);
  padding: 28px 20px 20px;
  text-align: center;
  margin-bottom: 12px;
  box-shadow: var(--abr-shadow);
}

.abr-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 12px;
  border: 2px solid var(--abr-border);
}
.abr-avatar img { width: 100%; height: 100%; object-fit: cover; }

.abr-username {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--abr-text);
}
.abr-useremail {
  font-size: 12px;
  color: var(--abr-muted);
  margin: 0;
  word-break: break-all;
}

/* ── Sidebar nav ─────────────────────────────────────────────── */
.abr-nav {
  background: var(--abr-surface);
  border: 1px solid var(--abr-border);
  border-radius: var(--abr-radius);
  overflow: hidden;
  box-shadow: var(--abr-shadow);
}

.abr-nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  font-size: 14px;
  color: var(--abr-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--abr-border);
  transition: background .15s, color .15s;
}
.abr-nav__item:last-child { border-bottom: none; }
.abr-nav__item:hover { background: var(--abr-bg); color: var(--abr-text); }

.abr-nav__item--active {
  background: var(--abr-accent-light);
  color: var(--abr-accent);
  font-weight: 600;
}

.abr-nav__icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.abr-nav__logout {
  color: var(--abr-danger);
  border-bottom: none;
}
.abr-nav__logout:hover { background: #FEF2F2; }

/* ── Main ────────────────────────────────────────────────────── */
.abr-main {
  flex: 1;
  min-width: 0;
}

.abr-page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 24px;
  color: var(--abr-text);
}

/* ── Fade in ─────────────────────────────────────────────────── */
@keyframes abrFade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}
.abr-fade-in { animation: abrFade .25s ease; }

/* ── Stat row (dashboard) ────────────────────────────────────── */
.abr-stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.abr-stat-card {
  background: var(--abr-surface);
  border: 1px solid var(--abr-border);
  border-radius: var(--abr-radius);
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--abr-shadow);
}
.abr-stat-card--accent {
  background: var(--abr-gold-light);
  border-color: #e8d08c;
}
.abr-stat-card--accent .abr-stat-icon { color: var(--abr-gold); }

.abr-stat-icon {
  font-size: 22px;
  color: var(--abr-accent);
  flex-shrink: 0;
}
.abr-stat-card strong {
  display: block;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}
.abr-stat-card small {
  font-size: 12px;
  color: var(--abr-muted);
}

/* ── Quick links ─────────────────────────────────────────────── */
.abr-quick-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.abr-qlink {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  border-radius: var(--abr-radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid var(--abr-border);
  background: var(--abr-surface);
  color: var(--abr-text);
  transition: border-color .15s, background .15s;
}
.abr-qlink:hover { border-color: var(--abr-accent); color: var(--abr-accent); }
.abr-qlink--accent {
  background: var(--abr-accent);
  color: #fff;
  border-color: var(--abr-accent);
}
.abr-qlink--accent:hover { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }

/* ── Loyalty hero ────────────────────────────────────────────── */
.abr-loyalty-hero {
  background: var(--abr-surface);
  border: 1px solid var(--abr-border);
  border-radius: var(--abr-radius);
  padding: 32px 28px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: var(--abr-shadow);
}

.abr-points-display {
  margin-bottom: 20px;
}
.abr-points-num {
  display: block;
  font-size: 52px;
  font-weight: 800;
  color: var(--abr-gold);
  line-height: 1;
}
.abr-points-label {
  font-size: 14px;
  color: var(--abr-muted);
  margin-top: 4px;
  display: block;
}

.abr-progress-wrap { max-width: 400px; margin: 0 auto 20px; }
.abr-progress-bar {
  height: 8px;
  background: var(--abr-border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 8px;
}
.abr-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--abr-gold), #f59e0b);
  border-radius: 99px;
  transition: width .6s ease;
}
.abr-progress-hint { font-size: 13px; color: var(--abr-muted); margin: 0; }

.abr-redeem-hint {
  font-size: 14px;
  color: var(--abr-muted);
  margin: 0 0 8px;
}

/* ── Coupon result ───────────────────────────────────────────── */
.abr-coupon-result {
  margin-top: 20px;
  background: var(--abr-gold-light);
  border: 1px solid #e8d08c;
  border-radius: var(--abr-radius-sm);
  padding: 16px 20px;
}
.abr-coupon-code {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.abr-coupon-code strong {
  font-size: 22px;
  letter-spacing: .12em;
  color: var(--abr-text);
  font-family: monospace;
}

/* ── Loyalty info ────────────────────────────────────────────── */
.abr-loyalty-info {
  background: var(--abr-surface);
  border: 1px solid var(--abr-border);
  border-radius: var(--abr-radius);
  padding: 22px 24px;
  margin-bottom: 20px;
  box-shadow: var(--abr-shadow);
}
.abr-loyalty-info h3 { margin: 0 0 14px; font-size: 15px; }
.abr-loyalty-info ul { margin: 0; padding: 0 18px; }
.abr-loyalty-info li { font-size: 14px; color: var(--abr-muted); margin-bottom: 6px; }
.abr-loyalty-info li strong { color: var(--abr-text); }

/* ── Log ─────────────────────────────────────────────────────── */
.abr-log-card {
  background: var(--abr-surface);
  border: 1px solid var(--abr-border);
  border-radius: var(--abr-radius);
  padding: 22px 24px;
  box-shadow: var(--abr-shadow);
}
.abr-log-card h3 { margin: 0 0 16px; font-size: 15px; }

.abr-log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--abr-border);
  font-size: 14px;
}
.abr-log-item:last-child { border-bottom: none; }
.abr-log-reason { flex: 1; color: var(--abr-text); }
.abr-log-delta  { font-weight: 700; min-width: 48px; text-align: center; }
.abr-log-delta.pos { color: var(--abr-success); }
.abr-log-delta.neg { color: var(--abr-danger); }
.abr-log-date   { font-size: 12px; color: var(--abr-muted); }

/* ── Edit profile form ───────────────────────────────────────── */
.abr-form-card {
  background: var(--abr-surface);
  border: 1px solid var(--abr-border);
  border-radius: var(--abr-radius);
  padding: 28px 24px;
  box-shadow: var(--abr-shadow);
}

.abr-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.abr-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.abr-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--abr-text);
}
.abr-field input {
  padding: 10px 14px;
  border: 1px solid var(--abr-border);
  border-radius: var(--abr-radius-sm);
  font-size: 14px;
  font-family: var(--abr-font);
  color: var(--abr-text);
  background: var(--abr-bg);
  transition: border-color .15s, box-shadow .15s;
  direction: rtl;
}
.abr-field input:focus {
  outline: none;
  border-color: var(--abr-accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background: #fff;
}
.abr-field input.abr-disabled { opacity: .5; cursor: not-allowed; }
.abr-field small { font-size: 12px; color: var(--abr-muted); }

.abr-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 18px;
  color: var(--abr-muted);
  font-size: 13px;
}
.abr-divider::before,
.abr-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--abr-border);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.abr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--abr-radius-sm);
  font-size: 14px;
  font-family: var(--abr-font);
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s;
}
.abr-btn:active { transform: scale(.97); }

.abr-btn--primary {
  background: var(--abr-accent);
  color: #fff;
}
.abr-btn--primary:hover { background: #1d4ed8; }
.abr-btn--primary:disabled { opacity: .6; cursor: not-allowed; }

.abr-btn--outline {
  background: transparent;
  color: var(--abr-accent);
  border: 1px solid var(--abr-accent);
}
.abr-btn--outline:hover { background: var(--abr-accent-light); }

.abr-btn--sm { padding: 7px 14px; font-size: 13px; }
.abr-btn--full { width: 100%; margin-top: 8px; }

/* ── Messages ────────────────────────────────────────────────── */
.abr-msg {
  margin-top: 14px;
  padding: 11px 16px;
  border-radius: var(--abr-radius-sm);
  font-size: 14px;
}
.abr-msg--success { background: #F0FDF4; color: var(--abr-success); border: 1px solid #bbf7d0; }
.abr-msg--error   { background: #FEF2F2; color: var(--abr-danger);  border: 1px solid #fecaca; }

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 768px) {
  .abr-um-wrap {
    flex-direction: column;
    padding: 65px 14px 80px;
    gap: 16px;
    margin-top: 0;
  }
  .abr-sidebar { width: 100%; }

  .abr-avatar-block {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 16px;
    text-align: right;
  }
  .abr-avatar { margin: 0; width: 56px; height: 56px; flex-shrink: 0; }

  /* ناوبری شبکه‌ای ۳ ستونه */
  .abr-nav { display: grid; grid-template-columns: repeat(3, 1fr); }
  .abr-nav__item {
    flex-direction: column;
    gap: 4px;
    padding: 12px 6px;
    font-size: 12px;
    text-align: center;
    border-bottom: none;
    border-left: 1px solid var(--abr-border);
  }
  .abr-nav__item:nth-child(3n) { border-left: none; }
  .abr-nav__logout {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: center;
    border-top: 1px solid var(--abr-border);
    border-left: none;
  }

  .abr-stat-row    { grid-template-columns: 1fr; gap: 10px; }
  .abr-form-grid   { grid-template-columns: 1fr; }
  .abr-points-num  { font-size: 42px; }
  .abr-log-date    { display: none; }
}

@media (max-width: 480px) {
  .abr-page-title       { font-size: 18px; }
  .abr-loyalty-hero     { padding: 22px 16px; }
  .abr-nav              { grid-template-columns: repeat(3, 1fr); }
}

/* دسکتاپ: margin بالا ثابت، تداخلی با هدر ندارد */
@media (min-width: 769px) {
  .abr-um-wrap { margin-top: 40px; }
}

/* ── WooCommerce content inside our wrapper ──────────────────── */
.abr-wc-content .woocommerce-orders-table,
.abr-wc-content .woocommerce-MyAccount-downloads,
.abr-wc-content .woocommerce-address-fields {
  width: 100%;
}

.abr-wc-content table.woocommerce-orders-table {
  border-collapse: collapse;
  font-size: 14px;
  width: 100%;
}

.abr-wc-content table.woocommerce-orders-table th {
  background: var(--abr-bg);
  padding: 10px 14px;
  border-bottom: 2px solid var(--abr-border);
  font-weight: 600;
  text-align: right;
}

.abr-wc-content table.woocommerce-orders-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--abr-border);
  vertical-align: middle;
}

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

.abr-wc-content .woocommerce-orders-table__row:hover td {
  background: var(--abr-bg);
}

/* بدون h2 اضافی از WC */
.abr-wc-content .woocommerce-column__title,
.abr-wc-content > h2:first-child { display: none; }

.abr-wc-content .woocommerce-Button,
.abr-wc-content .button {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: var(--abr-radius-sm);
  font-size: 13px;
  font-family: var(--abr-font);
  font-weight: 600;
  background: var(--abr-accent);
  color: #fff !important;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background .15s;
}
.abr-wc-content .woocommerce-Button:hover,
.abr-wc-content .button:hover { background: #1d4ed8; }

/* آدرس‌ها */
.abr-wc-content .woocommerce-Address { margin-bottom: 20px; }
.abr-wc-content .woocommerce-Address-title h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

/* پیام خالی */
.abr-wc-content .woocommerce-info {
  background: var(--abr-accent-light);
  border-right: 4px solid var(--abr-accent);
  border-left: none;
  padding: 14px 18px;
  border-radius: var(--abr-radius-sm);
  font-size: 14px;
  color: var(--abr-text);
}
