/* public/css/account.css — Customer account section styles */
/* Scoped under .account-page to prevent specificity conflicts */

/* ── Reset & Typography ── */
.account-page {
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  color: var(--text, #111827);
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 80px;
  min-height: 60vh;
}

/* ── Account Header ── */
.account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.account-greeting {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-greeting__hello {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.account-greeting__name {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text, #111827);
  line-height: 1.2;
}

.account-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted, #6b7280);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  transition: all 0.15s ease;
  border: 1px solid var(--border, #e5e7eb);
  background: transparent;
  white-space: nowrap;
}

.account-back-link:hover {
  background: var(--surface2, #f3f4f6);
  color: var(--text, #111827);
}

/* ── Tab Bar ── */
.account-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  background: var(--surface2, #f3f4f6);
  border-radius: 12px;
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.account-tabs::-webkit-scrollbar {
  display: none;
}

.account-tab {
  flex: 1;
  min-width: 0;
  padding: 10px 16px;
  border: none;
  background: transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted, #6b7280);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-align: center;
  position: relative;
}

.account-tab:hover {
  color: var(--text, #111827);
  background: rgba(255, 255, 255, 0.5);
}

.account-tab.is-active {
  background: #fff;
  color: var(--text, #111827);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.account-tab__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary, #2563eb);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Tab Panels ── */
.account-panel {
  display: none;
  animation: accountFadeIn 0.25s ease;
}

.account-panel.is-active {
  display: block;
}

@keyframes accountFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Order Cards Grid ── */
.orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.order-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 16px;
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
}

.order-card:hover {
  box-shadow: var(--shadow-lg, 0 4px 12px rgba(0, 0, 0, 0.08));
  transform: translateY(-1px);
}

.order-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.order-card__id {
  font-size: 0.82rem;
  font-weight: 600;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text, #111827);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.order-card__status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Status badge colors */
.order-card__status--pagado       { background: rgba(22, 163, 74, 0.1);  color: #16a34a; }
.order-card__status--proceso      { background: rgba(37, 99, 235, 0.1);  color: #2563eb; }
.order-card__status--listo        { background: rgba(124, 58, 237, 0.1); color: #7c3aed; }
.order-card__status--completado   { background: rgba(5, 150, 105, 0.1);  color: #059669; }
.order-card__status--cancelado    { background: rgba(220, 38, 38, 0.1);  color: #dc2626; }
.order-card__status--pendiente    { background: rgba(217, 119, 6, 0.1);  color: #d97706; }

.order-card__date {
  font-size: 0.78rem;
  color: var(--muted, #6b7280);
  margin-bottom: 10px;
}

.order-card__items {
  border-top: 1px solid var(--border, #e5e7eb);
  padding-top: 10px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: var(--muted, #6b7280);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--border, #e5e7eb);
  padding-top: 10px;
}

.order-card__total {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text, #111827);
  font-variant-numeric: tabular-nums;
}

.order-card__cta {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary, #2563eb);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.order-card__cta::after {
  content: '→';
}

/* ── Credits Card ── */
.credits-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.credits-balance-card {
  background: linear-gradient(135deg, var(--primary, #2563eb) 0%, #1d4ed8 100%);
  color: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  position: relative;
  overflow: hidden;
}

.credits-balance-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.credits-balance__label {
  font-size: 0.82rem;
  font-weight: 500;
  opacity: 0.85;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.credits-balance__amount {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.credits-balance__currency {
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.7;
  margin-left: 4px;
}

.credits-txn-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.credits-txn-list__title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.credits-txn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  font-size: 0.85rem;
  transition: background 0.15s ease;
}

.credits-txn:hover {
  background: var(--surface2, #f9fafb);
}

.credits-txn__info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.credits-txn__reason {
  font-weight: 600;
  color: var(--text, #111827);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.credits-txn__date {
  font-size: 0.75rem;
  color: var(--muted, #6b7280);
}

.credits-txn__amount {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.credits-txn__amount--credit {
  color: #16a34a;
}

.credits-txn__amount--debit {
  color: #dc2626;
}

/* ── Promotions ── */
.promos-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.promo-milestone-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 20px;
}

.promo-milestone__title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text, #111827);
  margin-bottom: 14px;
}

.promo-milestone__bar-wrap {
  background: var(--surface2, #f3f4f6);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.promo-milestone__bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary, #2563eb), #7c3aed);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 4px;
}

.promo-milestone__label {
  font-size: 0.82rem;
  color: var(--muted, #6b7280);
  display: flex;
  justify-content: space-between;
}

.promo-milestone__reward {
  margin-top: 14px;
  padding: 10px 14px;
  background: rgba(22, 163, 74, 0.06);
  border-radius: 10px;
  font-size: 0.85rem;
  color: #065f46;
  font-weight: 500;
}

.promo-grant-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
}

.promo-grant__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.promo-grant__info {
  flex: 1;
  min-width: 0;
}

.promo-grant__label {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text, #111827);
}

.promo-grant__status {
  font-size: 0.75rem;
  color: var(--muted, #6b7280);
}

/* ── Skeleton Loading ── */
.account-skeleton {
  border-radius: 14px;
  overflow: hidden;
}

.skeleton-pulse {
  background: linear-gradient(90deg,
    var(--surface2, #f3f4f6) 25%,
    rgba(255, 255, 255, 0.5) 50%,
    var(--surface2, #f3f4f6) 75%
  );
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
}

@keyframes skeletonShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-order-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 16px;
}

.skeleton-line {
  height: 12px;
  border-radius: 6px;
  margin-bottom: 10px;
}

.skeleton-line--short  { width: 40%; }
.skeleton-line--medium { width: 65%; }
.skeleton-line--long   { width: 90%; }
.skeleton-line--full   { width: 100%; }

.skeleton-balance {
  height: 120px;
  border-radius: 16px;
}

/* ── Empty State ── */
.account-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
  color: var(--muted, #6b7280);
}

.account-empty__icon {
  font-size: 2.5rem;
  opacity: 0.4;
  margin-bottom: 4px;
}

.account-empty__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text, #111827);
}

.account-empty__text {
  font-size: 0.88rem;
  max-width: 320px;
  line-height: 1.5;
}

.account-empty__cta {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 10px;
  background: var(--primary, #2563eb);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  transition: all 0.15s ease;
  border: none;
  cursor: pointer;
}

.account-empty__cta:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* ── Error State ── */
.account-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 24px;
  text-align: center;
  background: rgba(239, 68, 68, 0.04);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 14px;
}

.account-error__text {
  font-size: 0.88rem;
  color: #991b1b;
}

.account-error__retry {
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: #fff;
  color: #dc2626;
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.account-error__retry:hover {
  background: rgba(239, 68, 68, 0.06);
}

/* ── Load More Button ── */
.account-load-more {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.account-load-more__btn {
  padding: 10px 28px;
  border-radius: 10px;
  border: 1px solid var(--border, #e5e7eb);
  background: var(--surface, #fff);
  color: var(--text, #111827);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.account-load-more__btn:hover {
  background: var(--surface2, #f3f4f6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.account-load-more__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── First Order Reward Banner ── */
.promo-first-order {
  padding: 14px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(22, 163, 74, 0.06) 0%, rgba(37, 99, 235, 0.06) 100%);
  border: 1px solid rgba(22, 163, 74, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
}

.promo-first-order__icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.promo-first-order__info {
  flex: 1;
}

.promo-first-order__label {
  font-weight: 600;
  font-size: 0.88rem;
  color: #065f46;
}

.promo-first-order__hint {
  font-size: 0.78rem;
  color: var(--muted, #6b7280);
  margin-top: 2px;
}

/* ═══════════ Responsive ═══════════ */
@media (max-width: 840px) {
  .account-page {
    padding: 16px 12px 60px;
  }

  .orders-grid {
    grid-template-columns: 1fr 1fr;
  }

  .account-greeting__name {
    font-size: 1.15rem;
  }

  .credits-balance__amount {
    font-size: 1.8rem;
  }
}

@media (max-width: 540px) {
  .account-page {
    padding: 12px 10px 56px;
  }

  .account-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
  }

  .account-back-link {
    align-self: flex-start;
  }

  .account-tabs {
    gap: 2px;
    padding: 3px;
    border-radius: 10px;
    margin-bottom: 18px;
  }

  .account-tab {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .orders-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .order-card {
    padding: 14px;
    border-radius: 12px;
  }

  .order-card__id {
    max-width: 150px;
    font-size: 0.78rem;
  }

  .credits-balance-card {
    padding: 22px 18px;
    border-radius: 14px;
  }

  .credits-balance__amount {
    font-size: 1.6rem;
  }

  .account-empty {
    padding: 32px 16px;
  }

  .account-empty__icon {
    font-size: 2rem;
  }
}

@media (max-width: 360px) {
  .account-greeting__name {
    font-size: 1rem;
  }

  .order-card__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .credits-balance__amount {
    font-size: 1.4rem;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .account-panel {
    animation: none;
  }

  .skeleton-pulse {
    animation: none;
    background: var(--surface2, #f3f4f6);
  }

  .promo-milestone__bar {
    transition: none;
  }

  .order-card:hover {
    transform: none;
  }
}
