/* ==========================================================================
   VARIABLES GLOBALES (:root)
   ========================================================================== */
:root {
  /* Tipografía */
  --text-2xs: 0.625rem;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.125rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;
  
  --lh-base: 1.5;
  --lh-snug: 1.2;
  --lh-relaxed: 1.625;
  
  --ls-snug: -0.01em;
  --ls-wider: 0.05em;

  /* Colores - Texto */
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --text-disabled: #9ca3af;
  
  /* Colores - Bordes y Fondos */
  --bg-body: #ffffff;
  --border-default: #e5e7eb;
  --border-subtle: #f3f4f6;
  --white: #ffffff;
  --tint: #f3f4f6;
  --ink: #111827;
  --muted: #9ca3af;
  --muted-2: #d1d5db;
  --line-2: #e5e7eb;

  /* Colores - Marca y Estados */
  --brand: #3b82f6;
  --brand-deep: #1d4ed8;
  --brand-dark: #1e3a8a;
  --brand-soft: #eff6ff;
  --brand-25: rgba(59, 130, 246, 0.25);
  --accent: #8b5cf6;
  --accent-soft: rgba(139, 92, 246, 0.12);
  --accent-deep: #5b21b6;
  --error: #ef4444;

  /* Radios y Sombras */
  --r-md: 0.375rem;
  --r-lg: 0.5rem;
  --r-xl: 0.75rem;
  --r-pill: 9999px;
  
  --sh-2: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --sh-3: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Transiciones y Focus */
  --dur-fast: 150ms;
  --dur-base: 300ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  
  --focus-width: 2px;
  --focus-color: var(--brand);
  --focus-offset: 2px;
}

/* =============================================================================
   00 · CHROME DE PÁGINA
   ============================================================================= */
.page-account {
  padding-block: 56px 88px;
}

@media (max-width: 767px) {
  .page-account {
    padding-block: 36px 56px;
  }
}

.page-account__head {
  margin-bottom: 40px;
}

@media (max-width: 767px) {
  .page-account__head {
    margin-bottom: 28px;
  }
}

.page-account__title {
  margin-top: 16px;
}

.page-account__sub {
  margin-top: 16px;
  max-width: 600px;
  font-size: var(--text-base);
  line-height: var(--lh-base);
  color: var(--text-muted);
}

/* =============================================================================
   01 · LAYOUT (sidebar | contenido)
   ============================================================================= */
.account__layout {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}

@media (max-width: 991px) {
  .account__layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

.account__content {
  min-width: 0;
}

/* =============================================================================
   02 · NAVEGACIÓN LATERAL
   ============================================================================= */
.account-nav {
  position: sticky;
  top: 96px;
  background: var(--white);
  border: 1px solid var(--border-default);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-2);
  padding: 20px;
}

@media (max-width: 991px) {
  .account-nav {
    position: static;
  }
}

.account-nav__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 18px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.account-nav__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--r-pill);
  background: var(--brand);
  color: var(--brand-dark);
  font-size: var(--text-md);
  font-weight: var(--fw-extrabold);
}

.account-nav__greeting {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.account-nav__hello {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.account-nav__name {
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  /* @include truncate */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-nav__list {
  /* @include list-reset */
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-nav__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.account-nav__link:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
}

.account-nav__link:hover {
  background: var(--tint);
  color: var(--text-primary);
}

.account-nav__icon {
  display: inline-flex;
  color: var(--muted);
  flex-shrink: 0;
  transition: color var(--dur-fast) var(--ease);
}

/* Estado activo */
.account-nav .is-active .account-nav__link,
.account-nav__item.is-active .account-nav__link {
  background: var(--ink);
  color: var(--white);
}

.account-nav .is-active .account-nav__icon,
.account-nav__item.is-active .account-nav__icon {
  color: var(--brand);
}

/* Item de logout */
.account-nav__item.woocommerce-MyAccount-navigation-link--customer-logout {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-subtle);
}

/* =============================================================================
   03 · DASHBOARD
   ============================================================================= */
.account-dashboard__welcome {
  margin: 0 0 28px;
  font-size: var(--text-base);
  color: var(--text-secondary);
}

.account-dashboard__welcome strong {
  color: var(--text-primary);
  font-weight: var(--fw-bold);
}

.account-dashboard__welcome a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* WPRY Commerce Kit · módulo Points & Rewards */
.account-dashboard .wck-points-balance {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 24px;
  padding: 12px 18px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  border: 1px solid var(--brand-25);
  color: var(--brand-dark);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
}

.account-dashboard .wck-points-balance::before {
  content: '';
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 2 15 9 22 9 16.5 14 18.5 21 12 17 5.5 21 7.5 14 2 9 9 9'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 2 15 9 22 9 16.5 14 18.5 21 12 17 5.5 21 7.5 14 2 9 9 9'/%3E%3C/svg%3E") center / contain no-repeat;
}

.account-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.account-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-default);
  background: var(--white);
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}

.account-card:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
}

.account-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-3);
  border-color: var(--brand-25);
}

.account-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  border-radius: var(--r-md);
  background: var(--brand-soft);
  color: var(--brand-deep);
}

.account-card__title {
  font-size: var(--text-md);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

.account-card__desc {
  font-size: var(--text-sm);
  line-height: var(--lh-base);
  color: var(--text-muted);
}

/* =============================================================================
   04 · PEDIDOS
   ============================================================================= */
/* La variable $cols se ha inyectado directamente en grid-template-columns */

.account-orders__head {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 1.2fr) minmax(0, 1.1fr);
  gap: 16px;
  padding: 0 18px 12px;
  border-bottom: 1px solid var(--border-default);
}

@media (max-width: 767px) {
  .account-orders__head {
    display: none;
  }
}

.account-orders__head-cell {
  font-size: var(--text-2xs);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--text-muted);
}

.account-orders__head-cell--order-total,
.account-orders__head-cell--order-actions {
  text-align: right;
}

.account-orders__row {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 1.2fr) minmax(0, 1.1fr);
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--border-subtle);
  border-top: 0;
  background: var(--white);
}

.account-orders__row:first-of-type {
  border-top: 1px solid var(--border-subtle);
  border-radius: var(--r-md) var(--r-md) 0 0;
}

.account-orders__row:last-of-type {
  border-radius: 0 0 var(--r-md) var(--r-md);
}

@media (max-width: 767px) {
  .account-orders__row {
    grid-template-columns: 1fr;
    gap: 8px;
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    margin-bottom: 14px;
    padding: 18px;
  }
}

.account-orders__cell {
  min-width: 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.account-orders__cell--order-number .account-orders__number-link {
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

.account-orders__cell--order-number .account-orders__number-link:hover {
  color: var(--brand-deep);
}

.account-orders__cell--order-total {
  text-align: right;
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

.account-orders__cell--order-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

@media (max-width: 767px) {
  .account-orders__cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    text-align: left !important;
  }

  .account-orders__cell::before {
    content: attr(data-title);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    color: var(--text-muted);
  }

  .account-orders__cell--order-actions {
    justify-content: flex-start;
  }

  .account-orders__cell--order-actions::before {
    display: none;
  }
}

.account-orders__status {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  border-radius: var(--r-pill);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  background: var(--tint);
  color: var(--text-secondary);
}

.account-orders__status--completed {
  background: rgba(16, 185, 129, 0.12);
  color: #0a7d5a;
}

.account-orders__status--processing {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.account-orders__status--on-hold {
  background: rgba(245, 158, 11, 0.14);
  color: #92600a;
}

.account-orders__status--cancelled,
.account-orders__status--failed {
  background: rgba(239, 68, 68, 0.12);
  color: #b42323;
}

.account-orders__status--pending {
  background: var(--line-2);
  color: var(--text-muted);
}

.account-orders__pagination {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 24px;
}

/* =============================================================================
   05 · ESTADO VACÍO
   ============================================================================= */
.account-empty {
  text-align: center;
  padding: clamp(32px, 5vw, 56px) 24px;
}

.account-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  margin-bottom: 20px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand-deep);
  border: 1px solid var(--brand-25);
}

.account-empty__text {
  margin: 0 0 22px;
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  color: var(--text-primary);
}

/* =============================================================================
   06 · DIRECCIONES
   ============================================================================= */
.account-address__intro {
  margin: 0 0 24px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.account-addresses {
  display: grid;
  gap: 20px;
}

.account-addresses--grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.account-address {
  padding: 24px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-default);
  background: var(--white);
}

.account-address__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.account-address__title {
  margin: 0;
  font-size: var(--text-md);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

.account-address__body {
  font-style: normal;
  font-size: var(--text-sm);
  line-height: var(--lh-relaxed);
  color: var(--text-secondary);
}

/* =============================================================================
   07 · FORMULARIOS
   ============================================================================= */
.account-form {
  max-width: 560px;
}

.account-form--account,
.account-form--address {
  max-width: 720px;
}

.account-form__heading,
.account-form__legend {
  font-size: var(--text-lg);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--ls-snug);
  color: var(--text-primary);
  margin: 0 0 20px;
}

.account-form__row {
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.account-form__row--inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.account-form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

@media (max-width: 575px) {
  .account-form__grid {
    grid-template-columns: 1fr;
  }
}

.account-form label {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--text-secondary);
}

.account-form label .required {
  color: var(--error);
}

.account-form__input,
.account-form input[type='text'],
.account-form input[type='email'],
.account-form input[type='password'],
.account-form input[type='tel'],
.account-form select,
.account-form textarea {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  font-size: var(--text-sm);
  color: var(--text-primary);
  background: var(--bg-body);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  transition: border-color var(--dur-fast) var(--ease);
}

.account-form__input::placeholder,
.account-form input[type='text']::placeholder,
.account-form input[type='email']::placeholder,
.account-form input[type='password']::placeholder,
.account-form input[type='tel']::placeholder,
.account-form select::placeholder,
.account-form textarea::placeholder {
  color: var(--text-disabled);
}

.account-form__input:hover,
.account-form input[type='text']:hover,
.account-form input[type='email']:hover,
.account-form input[type='password']:hover,
.account-form input[type='tel']:hover,
.account-form select:hover,
.account-form textarea:hover {
  border-color: var(--muted-2);
}

.account-form__input:focus,
.account-form input[type='text']:focus,
.account-form input[type='email']:focus,
.account-form input[type='password']:focus,
.account-form input[type='tel']:focus,
.account-form select:focus,
.account-form textarea:focus {
  outline: none;
}

.account-form__input:focus-visible,
.account-form input[type='text']:focus-visible,
.account-form input[type='email']:focus-visible,
.account-form input[type='password']:focus-visible,
.account-form input[type='tel']:focus-visible,
.account-form select:focus-visible,
.account-form textarea:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
  border-color: transparent;
}

.account-form textarea {
  height: auto;
  min-height: 120px;
  padding: 12px 16px;
  resize: vertical;
}

.account-form select {
  appearance: none;
  cursor: pointer;
}

.account-form__hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.account-form__hint em {
  font-style: italic;
}

.account-form__checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
}

.account-form__checkbox input {
  width: auto;
  height: auto;
  accent-color: var(--accent);
}

.account-form__lost {
  margin: 4px 0 0;
}

.account-form__lost a {
  font-size: var(--text-sm);
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.account-form__fieldset {
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 22px 22px 6px;
  margin: 0 0 22px;
}

.account-form__fieldset .account-form__legend {
  padding: 0 8px;
  margin: 0;
  font-size: var(--text-md);
}

.account-form__submit {
  margin-top: 4px;
}

.account-form .clear {
  display: none;
}

/* =============================================================================
   08 · LOGIN / REGISTRO
   ============================================================================= */
.account-auth {
  display: grid;
  gap: clamp(24px, 4vw, 40px);
}

.account-auth--split {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 767px) {
  .account-auth--split {
    grid-template-columns: 1fr;
  }
}

.account-auth--single {
  max-width: 460px;
  margin-inline: auto;
}

.account-auth__panel {
  padding: clamp(24px, 3vw, 36px);
  border-radius: var(--r-xl);
  border: 1px solid var(--border-default);
  background: var(--white);
  box-shadow: var(--sh-2);
}

.account-auth__title {
  margin: 0 0 22px;
  font-size: var(--text-lg);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--ls-snug);
  color: var(--text-primary);
}

.account-auth__panel .account-form {
  max-width: none;
}

/* =============================================================================
   09 · NOTICES (estilos nativos desencolados)
   ============================================================================= */
.page-account .woocommerce-message,
.page-account .woocommerce-error,
.page-account .woocommerce-info {
  margin: 0 0 24px;
  padding: 14px 18px;
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  border: 1px solid var(--border-default);
  background: var(--tint);
  list-style: none;
}

.page-account .woocommerce-message {
  border-color: rgba(16, 185, 129, 0.30);
  background: rgba(16, 185, 129, 0.07);
}

.page-account .woocommerce-error {
  border-color: rgba(239, 68, 68, 0.30);
  background: rgba(239, 68, 68, 0.07);
}

/* Lista de errores de validación de Woo */
.page-account .woocommerce-error {
  list-style: none;
}

.page-account .woocommerce-error li {
  margin: 0;
}