/**
 * Treehouse My Account dashboard styling.
 */

:root {
  --th-green: #2f5d3a;
  --th-green-dark: #1f3f28;
  --th-green-light: #e8f0ea;
  --th-green-soft: #f4f8f5;
  --th-lime: #7cb342;
  --th-surface: #ffffff;
  --th-muted: #6b7280;
  --th-border: #e5e7eb;
  --th-shadow: 0 4px 20px rgba(31, 63, 40, 0.08);
  --th-radius: 16px;
  --th-radius-pill: 999px;
}

/* Page background */
.woocommerce-account .site-main,
.woocommerce-account .entry-content {
  background: #f3f4f6;
}

.woocommerce-account .woocommerce {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* Notices span the full width above both columns */
.woocommerce-account .woocommerce > .woocommerce-notices-wrapper {
  grid-column: 1 / -1;
}

/* Sidebar column wrapper (header + nav + footer in one grid cell) */
.th-account-sidebar {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Sidebar header */
.th-account-sidebar-head {
  margin: 0;
}

.th-account-sidebar-head__title {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--th-green-dark);
  line-height: 1.2;
}

.th-account-sidebar-head__tagline {
  margin: 0;
  font-size: 0.9rem;
  color: var(--th-muted);
}

.woocommerce-account .woocommerce-MyAccount-navigation {
  float: none;
  width: auto;
  background: var(--th-green-soft);
  border: 1px solid var(--th-green-light);
  border-radius: var(--th-radius);
  padding: 0.75rem;
  margin: 0;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul li {
  margin: 0;
  padding: 0;
  border: 0;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul li a {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 2.75rem;
  padding: 0.7rem 1rem;
  border-radius: var(--th-radius-pill);
  color: var(--th-green-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul li a br {
  display: none;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul li a:hover {
  background: rgba(47, 93, 58, 0.08);
  color: var(--th-green);
}

.woocommerce-account .woocommerce-MyAccount-navigation ul li.is-active a {
  background: var(--th-green);
  color: #fff;
}

.th-account-sidebar-after {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.th-account-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.5rem;
  border-radius: var(--th-radius-pill);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.th-account-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.th-account-btn--primary {
  background: var(--th-green);
  color: #fff;
  width: 100%;
}

.th-account-btn--inverse {
  background: #fff;
  color: var(--th-green);
  width: 100%;
}

.th-account-sidebar-foot {
  display: flex;
  gap: 1.25rem;
  padding: 0 0.25rem;
}

.th-account-sidebar-foot a {
  font-size: 0.85rem;
  color: var(--th-muted);
  text-decoration: none;
}

.th-account-sidebar-foot a:hover {
  color: var(--th-green);
}

/* Main content column */
.woocommerce-account .woocommerce-MyAccount-content {
  grid-column: 2;
  float: none;
  width: auto;
  margin: 0;
  padding: 0;
}

.woocommerce-account .woocommerce-MyAccount-content > h2,
.woocommerce-account .woocommerce-MyAccount-content .treehouse-nutrition > h2 {
  font-size: 1.5rem;
  color: var(--th-green-dark);
  margin-top: 0;
}

/* Dashboard */
.th-account-dash {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.th-account-hero {
  background: linear-gradient(135deg, #f0f7f2 0%, #e3efe6 100%);
  border: 1px solid var(--th-green-light);
  border-radius: var(--th-radius);
  padding: 2rem 2.25rem;
  position: relative;
  overflow: hidden;
}

.th-account-hero::after {
  content: "";
  position: absolute;
  right: -2rem;
  top: -2rem;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(124, 179, 66, 0.25) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.th-account-hero__title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 800;
  color: var(--th-lime);
  line-height: 1.15;
  position: relative;
  z-index: 1;
}

.th-account-hero__text {
  margin: 0;
  max-width: 42rem;
  color: #374151;
  font-size: 1rem;
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

.th-account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1.5rem;
}

.th-card {
  background: var(--th-surface);
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius);
  box-shadow: var(--th-shadow);
  padding: 1.5rem;
}

.th-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.th-card__header h3,
.th-card--info h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--th-green-dark);
}

.th-card__link {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--th-green);
  text-decoration: none;
}

.th-card__link:hover {
  text-decoration: underline;
}

.th-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.th-activity-list__item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--th-border);
}

.th-activity-list__item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.th-activity-list__item:first-child {
  padding-top: 0;
}

.th-activity-list__icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--th-green-light);
}

.th-activity-list__icon--delivery {
  background: #d4ead9;
}

.th-activity-list__icon--points {
  background: #f5e6c8;
}

.th-activity-list__icon--update {
  background: #e8eaed;
}

.th-activity-list__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.th-activity-list__body strong {
  color: #111827;
  font-size: 0.95rem;
}

.th-activity-list__body span {
  color: var(--th-muted);
  font-size: 0.85rem;
}

/* Current box card */
.th-current-box {
  background: var(--th-green);
  border-color: var(--th-green);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1.25rem;
}

.th-current-box__ring {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 6px solid rgba(255, 255, 255, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
}

.th-current-box__percent {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
}

.th-current-box__label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  opacity: 0.9;
}

.th-current-box__text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.55;
  opacity: 0.95;
}

/* Info cards row */
.th-account-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.th-card--info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 180px;
}

.th-card--info p {
  margin: 0;
  flex: 1;
  color: var(--th-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.th-card__cta {
  margin-top: auto;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--th-green);
  text-decoration: none;
}

.th-card__cta:hover {
  text-decoration: underline;
}

/* Other account endpoints — light card polish */
.woocommerce-account .woocommerce-MyAccount-content form {
  background: var(--th-surface);
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius);
  box-shadow: var(--th-shadow);
}

/* Tables inside My Account */
.woocommerce-account .woocommerce-MyAccount-content table.shop_table {
  width: 100%;
  background: var(--th-surface);
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius);
  box-shadow: var(--th-shadow);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  margin: 0 0 1.5rem;
  padding: 20px;
}

.woocommerce-account .woocommerce-MyAccount-content table.shop_table thead th {
  background: var(--th-green-soft);
  color: var(--th-green-dark);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 0.95rem 1.1rem;
  border-bottom: 1px solid var(--th-green-light);
}

.woocommerce-account .woocommerce-MyAccount-content table.shop_table tbody td {
  padding: 0.95rem 1.1rem;
  font-size: 0.92rem;
  color: #374151;
  border-bottom: 1px solid var(--th-border);
  vertical-align: middle;
}

.woocommerce-account
  .woocommerce-MyAccount-content
  table.shop_table
  tbody
  tr:last-child
  td {
  border-bottom: 0;
}

.woocommerce-account
  .woocommerce-MyAccount-content
  table.shop_table
  tbody
  tr:hover
  td {
  background: var(--th-green-soft);
}

.woocommerce-account
  .woocommerce-MyAccount-content
  table.shop_table
  .woocommerce-Price-amount {
  font-weight: 700;
  color: var(--th-green-dark);
}

/* Status pill (Status column) */
.woocommerce-account
  .woocommerce-MyAccount-content
  table.shop_table
  td[data-title="Status"] {
  font-weight: 600;
}

.woocommerce-account
  .woocommerce-MyAccount-content
  table.shop_table
  td[data-title="Status"]::before {
  content: "";
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
  opacity: 0.7;
}

/* Action buttons inside tables */
.woocommerce-account .woocommerce-MyAccount-content table.shop_table .button,
.woocommerce-account .woocommerce-MyAccount-content table.shop_table button {
  border-radius: var(--th-radius-pill);
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
}

@media (max-width: 600px) {
  .woocommerce-account .woocommerce-MyAccount-content table.shop_table thead {
    display: none;
  }

  .woocommerce-account
    .woocommerce-MyAccount-content
    table.shop_table
    tbody
    tr {
    display: block;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--th-border);
  }

  .woocommerce-account
    .woocommerce-MyAccount-content
    table.shop_table
    tbody
    tr:last-child {
    border-bottom: 0;
  }

  .woocommerce-account
    .woocommerce-MyAccount-content
    table.shop_table
    tbody
    td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border-bottom: 0;
    padding: 0.5rem 1.1rem;
    text-align: right;
  }

  .woocommerce-account
    .woocommerce-MyAccount-content
    table.shop_table
    tbody
    td::before {
    content: attr(data-title);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--th-muted);
    text-align: left;
  }

  .woocommerce-account
    .woocommerce-MyAccount-content
    table.shop_table
    td[data-title="Status"]::before {
    content: attr(data-title);
    width: auto;
    height: auto;
    margin: 0;
    border-radius: 0;
    background: none;
  }
}

/* Nutrition tab harmonization */
.woocommerce-account .treehouse-nutrition__toggle-btn.is-active {
  background: var(--th-green);
}

.woocommerce-account .treehouse-nutrition__nav-btn,
.woocommerce-account .treehouse-nutrition__card {
  border-color: var(--th-green-light);
}

/* Responsive */
@media (max-width: 900px) {
  .woocommerce-account .woocommerce {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .th-account-sidebar,
  .woocommerce-account .woocommerce-MyAccount-content {
    grid-column: 1;
  }

  .th-account-grid,
  .th-account-cards {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .woocommerce-account .woocommerce {
    padding: 1rem 0.75rem 2rem;
  }

  .th-account-hero {
    padding: 1.5rem;
  }

  .th-card {
    padding: 1.25rem;
  }
}
