/* ============================================================
   SpencoGEL – Account Pages
   Login · Register · Dashboard · Profile · Orders
   ============================================================ */

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  --brand:        #7F2A7D;
  --brand-dark:   #7a3a7a;
  --brand-light:  rgba(153, 64, 153, 0.08);
  --brand-border: rgba(153, 64, 153, 0.16);

  --surface:      #ffffff;
  --bg:           #fafafa;
  --text:         #151515;
  --text-muted:   #777;
  --border:       rgba(0, 0, 0, 0.09);

  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    18px;
  --radius-pill:  999px;

  --shadow-card:  0 8px 32px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 12px 28px rgba(153, 64, 153, 0.10);

  --transition:   0.18s ease;
}


/* ── Shared Page Layout ─────────────────────────────────────── */
.auth-page,
.dashboard-page,
.orders-page {
  min-height: calc(100vh - 160px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  background: var(--bg);
}

.orders-page {
  align-items: flex-start;
  padding: 32px 20px 90px;
}


/* ── Shared Card ────────────────────────────────────────────── */
.auth-box,
.dashboard-card,
.orders-card {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow-card);
}

.auth-box       { max-width: 420px; padding: 36px 32px; }
.dashboard-card { max-width: 460px; padding: 32px; text-align: center; }
.orders-card    { max-width: 720px; margin: 0 auto; padding: 28px 24px; }


/* ── Logo ───────────────────────────────────────────────────── */
.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.auth-logo img,
.dashboard-logo {
  height: 64px;
  object-fit: contain;
}

.dashboard-logo { margin-bottom: 12px; }


/* ── Titles ─────────────────────────────────────────────────── */
.auth-box h2 {
  margin-bottom: 24px;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.dashboard-header h2 {
  font-size: 19px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.dashboard-sub {
  font-size: 14px;
  color: var(--text-muted);
}

.orders-header { margin-bottom: 20px; }

.orders-header h2 {
  font-size: 19px;
  font-weight: 600;
  color: var(--text);
}

/* ── Orders Tabs ───────────────────────────────────────────── */
.orders-tabs {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 18px;
  padding: 5px;
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  background: var(--brand-light);
}

.orders-tabs.is-enhanced { display: grid; }

.orders-tab {
  min-width: 0;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.orders-tab:hover { color: var(--brand); }

.orders-tab:focus-visible {
  outline: 3px solid var(--primary-focus);
  outline-offset: 1px;
}

.orders-tab.is-active {
  background: var(--surface);
  color: var(--brand);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

.orders-tab-count {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: rgba(127, 42, 125, 0.10);
  color: var(--brand);
  font-size: 12px;
}

.orders-panel + .orders-panel { margin-top: 28px; }
.orders-panel-title { margin: 0 0 12px; font-size: 16px; color: var(--text); }
.orders-tabs-enhanced .orders-panel + .orders-panel { margin-top: 0; }
.orders-tabs-enhanced .orders-panel-title { display: none; }
.orders-panel[hidden] { display: none; }


/* ── Form ───────────────────────────────────────────────────── */
.auth-box form,
.auth-mini {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-box label,
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.auth-box input,
.spg-form input,
.spg-form textarea {
  width: 100%;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 0 13px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.spg-form textarea {
  height: auto;
  padding: 12px 13px;
}

.auth-box input::placeholder,
.spg-form input::placeholder,
.spg-form textarea::placeholder {
  color: #bbb;
  font-size: 13px;
}

.auth-box input:focus,
.spg-form input:focus,
.spg-form textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 16px;
}

.field-full  { grid-column: 1 / -1; }

.field-error {
  margin-top: 5px;
  font-size: 12px;
  color: #b91c1c;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
}


/* ── Buttons ────────────────────────────────────────────────── */

/* Base */
.btn,
.auth-btn,
.dash-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  padding: 0 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: opacity var(--transition), transform var(--transition),
              background var(--transition), border-color var(--transition);
  white-space: nowrap;
}

/* Filled – primary action */
.auth-btn,
.btn-primary,
.dash-btn.primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  width: 100%;
}

.auth-btn:hover,
.btn-primary:hover,
.dash-btn.primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  transform: translateY(-1px);
}

.auth-btn:active,
.btn-primary:active,
.dash-btn.primary:active { transform: translateY(0); }

/* auth-btn sizing */
.auth-btn { margin-top: 6px; }

/* Outlined */
.btn-outline {
  background: transparent;
  border-color: var(--brand-border);
  color: var(--brand);
}

.btn-outline:hover {
  background: var(--brand-light);
  border-color: var(--brand);
}

/* Ghost / text-only */
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
  padding: 0 8px;
  height: 36px;
  font-size: 13px;
}

.btn-ghost:hover { color: var(--brand); }

/* Danger */
.btn-danger,
.dash-btn.danger {
  background: transparent;
  border-color: rgba(185, 28, 28, 0.18);
  color: #b91c1c;
  background: transparent;
}

.btn-danger:hover,
.dash-btn.danger:hover {
  background: rgba(185, 28, 28, 0.05);
  border-color: rgba(185, 28, 28, 0.30);
}

/* Pill – small contextual action */
.btn-pill {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  background: var(--brand-light);
  color: var(--brand);
  border: 1px solid var(--brand-border);
}

.btn-pill:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

/* Neutral dashboard button */
.dash-btn {
  display: flex;
  padding: 13px 16px;
  border-radius: var(--radius-md);
  background: #f5f5f5;
  color: #333;
  border-color: transparent;
  font-size: 14px;
  width: 100%;
}

.dash-btn:hover { background: #efefef; transform: translateY(-1px); }


/* ── Bottom Auth Link ───────────────────────────────────────── */
.auth-link {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-link a {
  color: var(--brand);
  font-weight: 500;
}

.auth-link a:hover { text-decoration: underline; }


/* ── Feedback Messages ──────────────────────────────────────── */
.auth-error,
.auth-success {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
  border: 1px solid;
}

.auth-error {
  background: rgba(220, 38, 38, 0.06);
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.14);
}

.auth-success {
  background: rgba(34, 197, 94, 0.07);
  color: #166534;
  border-color: rgba(34, 197, 94, 0.18);
}


/* ── Dashboard Stats ────────────────────────────────────────── */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 22px 0;
}

.stat-box {
  background: #f8f5f8;
  border-radius: var(--radius-md);
  padding: 14px 10px;
  font-size: 12px;
  color: var(--text-muted);
  border: 0.5px solid var(--brand-border);
}

.stat-box strong {
  display: block;
  margin-top: 5px;
  font-size: 17px;
  font-weight: 600;
  color: var(--brand);
}

.stat-box .active { color: #16a34a; }


/* ── Dashboard Actions ──────────────────────────────────────── */
.dashboard-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}


/* ── Status Badges ──────────────────────────────────────────── */
.order-status {
  font-size: 12px;
  font-weight: 500;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #f4f4f4;
  color: #666;
  white-space: nowrap;
}

.status-paid,
.status-delivered,
.status-completed,
.status-success {
  background: rgba(21, 130, 75, 0.08);
  color: #15824b;
  border-color: rgba(21, 130, 75, 0.18);
}

.status-pending,
.status-processing {
  background: rgba(165, 106, 0, 0.08);
  color: #a56a00;
  border-color: rgba(165, 106, 0, 0.18);
}

.status-failed,
.status-canceled,
.status-cancelled {
  background: rgba(185, 28, 28, 0.07);
  color: #b91c1c;
  border-color: rgba(185, 28, 28, 0.16);
}


/* ── Orders List ────────────────────────────────────────────── */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.order-row {
  display: block;
  padding: 14px 16px;
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.order-row:hover {
  border-color: var(--brand-border);
  transform: translateY(-1px);
  box-shadow: var(--shadow-hover);
}

.order-row-summary:hover {
  border-color: var(--border);
  transform: none;
  box-shadow: none;
}

.order-top,
.order-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-top { margin-bottom: 8px; }

.order-number {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  direction: ltr;
}

.order-date {
  font-size: 12px;
  color: var(--text-muted);
  direction: ltr;
}

.order-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.orders-actions { margin-top: 16px; }


/* ── Order Detail ───────────────────────────────────────────── */
.order-detail-box {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0.5px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
}

.detail-row span   { color: var(--text-muted); font-size: 13px; }
.detail-row strong { font-weight: 600; color: var(--text); font-size: 14px; }


/* ── Empty State ────────────────────────────────────────────── */
.empty-state {
  margin-top: 14px;
  padding: 28px 16px;
  border: 1px dashed var(--brand-border);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}


/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 860px) {
  .form-grid    { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; }
}

@media (max-width: 768px) {
  .auth-page,
  .dashboard-page { padding: 40px 16px; }
}

@media (max-width: 560px) {
  .auth-box       { padding: 26px 18px; }
  .auth-box h2    { font-size: 18px; }
  .orders-page    { padding: 18px 10px 90px; }
  .orders-card    { padding: 18px 14px; }
  .order-row      { padding: 12px 13px; }
  .order-number   { font-size: 14px; }
  .order-amount   { font-size: 15px; }
  .order-status   { font-size: 11px; padding: 3px 9px; }
  .orders-tab     { min-height: 44px; gap: 5px; padding: 7px 6px; font-size: 13px; }
  .orders-tab-count { min-width: 21px; height: 21px; padding: 0 5px; font-size: 11px; }

  .order-bottom {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 5px;
  }
}

/* ==================================
   ورود و تأیید شماره موبایل با OTP
   ================================== */

.auth-box h1 {
    margin: 0 0 10px;
    font-size: 23px;
    color: #222;
}

.auth-description {
    margin: 0 0 24px;
    color: #666;
    font-size: 14px;
    line-height: 2;
    text-align: center;
}

.auth-helper {
    margin: 20px 0 0;
    color: #777;
    font-size: 12px;
    line-height: 1.9;
    text-align: center;
}

.auth-success {
    margin-bottom: 18px;
    padding: 12px 14px;
    border: 1px solid #ccebd9;
    border-radius: 12px;
    background: #effaf3;
    color: #21824b;
    font-size: 13px;
    line-height: 1.8;
}

.otp-phone {
    display: inline-block;
    color: #7f2a7d;
    font-weight: 700;
}

.otp-input {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    direction: ltr;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 8px;
    color: #222;
}

.otp-input::placeholder {
    color: #d0d0d0;
    letter-spacing: 6px;
}

.otp-resend-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 13px;
    margin-top: 22px;
}

.otp-resend-section form {
    margin: 0;
}

.otp-resend-button {
    padding: 4px;
    border: 0;
    background: transparent;
    color: #7f2a7d;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.otp-resend-button:hover:not(:disabled) {
    color: #682066;
}

.otp-resend-button:disabled {
    color: #999;
    cursor: default;
}

.change-phone-link {
    color: #666;
    font-size: 13px;
    text-decoration: none;
}

.change-phone-link:hover {
    color: #7f2a7d;
}

@media (max-width: 600px) {
    .auth-box h1 {
        font-size: 20px;
    }

    .otp-input {
        font-size: 25px;
        letter-spacing: 6px;
    }
}


/* ── استایل شماره تأییدشده ─────────────────────────────────────────────── */

.verified-phone-box {
    min-height: 46px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #e3e3e3;
    border-radius: 12px;
    background: #f8f8f8;
    color: #444;
}

.verified-phone-badge {
    padding: 4px 9px;
    border-radius: 999px;
    background: #eaf8ef;
    color: #21824b;
    font-size: 11px;
    font-weight: 700;
}

.field-help {
    display: block;
    margin-top: 7px;
    color: #888;
    font-size: 11px;
    line-height: 1.8;
}
