/* ============================================
   MY ACCOUNT — hero banner, tab navigation, Berry Rewards card
   ============================================
   Matches the reference dashboard (https://www.aquaphor.bg/promo/
   Berry_store_7/account.html) — colors/spacing pulled from that page's own
   CSS where available, the rewards card itself is a new build (no
   dedicated CSS existed for it in the reference source, it's JS-rendered
   there) using the same design tokens.

   Scoped to body.woocommerce-account, loaded only on account pages — see
   the enqueue in inc/account-dashboard.php, same pattern as
   my-account-theme.css.

   NOT replicated: the reference's header floats translucently OVER the
   hero banner (position:absolute, backdrop-filter blur) — left out
   deliberately, since that would mean changing the sticky header's own
   positioning/z-index behavior specifically for this one page, a riskier
   change than this pass calls for. The header here stays exactly as it
   already is everywhere else on the site; the hero sits as a normal block
   below it instead.
   ============================================ */

/* ROOT CAUSE of the tab bar (and everything below it) rendering squeezed
   into the left ~500-1140px instead of using the full available width:
   the parent Hello Biz theme applies its own responsive max-width cascade
   to .site-main (500px/600px/800px/1140px across breakpoints), scoped via
   `body:not([class*="elementor-page-"])` — i.e. it applies to every
   NON-Elementor page. The homepage never hit this because it's
   Elementor-built (body carries an elementor-page-53 class there); My
   Account uses Hello Biz's own plain classic page template instead, so
   no such class exists on this page's <body> and the cap applies here.
   Every width rule this file sets further down (.berry-account-tabs-card
   max-width:1100px, etc.) was already being fed a narrower ancestor width
   than that — max-width can only shrink an element, never grow it past
   whatever space its parent actually has, so those rules had nothing to
   work with. Confirmed directly: fetched the real authenticated page HTML
   via a generated login session (not guessed from a screenshot) and
   traced the exact ancestor chain (#content.site-main > .page-content >
   .woocommerce > nav > .berry-account-tabs-card), then checked each
   class against the parent theme's actual compiled CSS. Same fix already
   applied once before for this exact issue on the homepage specifically
   (`body.home .site-main { padding-inline: 0; }`) — same root cause,
   different page. */
body.woocommerce-account .site-main {
  max-width: none !important;
  padding-inline: 0 !important;
}

body.woocommerce-account .berry-account-hero {
  background: var(--berry-grad-brand);
  padding: 48px 24px 80px;
  text-align: center;
  /* Flat/square, no rounding — matches the reference's own .account-hero
     exactly (border-radius:0), confirmed against its real CSS source, not
     the rounded-bottom guess this replaces. */
  border-radius: 0;
  margin: 0 0 -40px;
}

/* margin: 0 here (was 0 auto 16px) — that bottom gap used to separate the
   avatar directly from the name below it; both are now wrapped in
   .berry-account-hero__avatar-upload / sit above .berry-account-hero__
   name-row, each of which already carries its own spacing, so keeping
   this too would double it up. */
/* overflow: hidden is NOT here (it was, before) — this element now also
   hosts the camera badge (.berry-avatar-upload__preview-hint), positioned
   with a deliberate negative right/bottom offset so it sits half-on-half-
   off the circle's edge. overflow:hidden on this same box clipped that
   badge into a crescent instead of a full circle. The image still needs
   to render as a circle regardless, so that clip moved onto the img
   itself (border-radius below) instead of the shared container. */
body.woocommerce-account .berry-account-hero__avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(255,255,255,0.22);
  border: 3px solid rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
  color: #fff;
  margin: 0;
  box-shadow: 0 10px 30px rgba(0,0,0,0.22), 0 0 0 6px rgba(255,255,255,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.woocommerce-account .berry-account-hero__avatar:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(0,0,0,0.26), 0 0 0 6px rgba(255,255,255,0.12);
}

body.woocommerce-account .berry-account-hero__avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* .berry-account-hero__avatar is now ALSO .berry-avatar-upload__preview
   (a <label for="berry-avatar-upload-input">, see inc/account-dashboard.
   php) — that shared class already contributes position:relative and
   cursor:pointer, which this combined element needs (the hint badge
   below is absolutely positioned against it) and otherwise wouldn't
   duplicate here. The one real clash: .berry-avatar-upload__preview img
   sets a flat 2px purple-soft border, meant for that class's plain white-
   card context — wrong here, where the circle already has its own
   translucent-white ring (border rule just above). Reset only that. */
body.woocommerce-account .berry-account-hero__avatar.berry-avatar-upload__preview img {
  border: none;
}

body.woocommerce-account .berry-account-hero__avatar-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

body.woocommerce-account .berry-account-hero__avatar-remove {
  background: none;
  border: none;
  padding: 2px;
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

body.woocommerce-account .berry-account-hero__avatar-remove:hover {
  color: #fff;
  text-decoration: underline;
}

body.woocommerce-account .berry-account-hero__name-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

body.woocommerce-account .berry-account-hero__name {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  font-family: var(--berry-font-display);
  cursor: pointer;
}

/* Always visible (not hover-only) — a pencil badge that only appears on
   hover reads as decoration until you happen to mouse over it; per
   explicit request ("make it visible for the user that u can change it
   there") this needs to read as editable at rest. Solid white + purple
   icon, same inverted-on-hover treatment as the avatar's own camera
   badge (see .berry-avatar-upload__preview-hint in my-account-theme.css)
   for one consistent "this is editable" language across both — a
   translucent-white-on-purple badge was tried first and reported as
   barely visible for the same reason the camera badge was.
   padding: 0 !important is load-bearing, not decorative — this is a real
   <button type="button">, which the parent Hello Biz theme's own global
   reset (button,[type=button]{padding:.5rem 1rem}) already targets; left
   unset, that padding alone was enough to squeeze the 15px icon out to
   nothing inside this 28px circle. Same root cause already diagnosed
   and fixed for other buttons elsewhere in this project — missed here
   simply because this button never had an explicit padding declared of
   its own to begin with. */
body.woocommerce-account .berry-account-hero__name-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  padding: 0 !important;
  border: none !important;
  border-radius: 50%;
  background: #fff;
  color: var(--berry-purple, #8b5cf6);
  box-shadow: 0 3px 10px rgba(0,0,0,0.3);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

body.woocommerce-account .berry-account-hero__name-edit svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

body.woocommerce-account .berry-account-hero__name-edit:hover {
  background: var(--berry-purple, #8b5cf6);
  color: #fff;
  transform: scale(1.1);
}

body.woocommerce-account .berry-account-hero__name-input {
  font-size: 24px;
  font-weight: 800;
  font-family: var(--berry-font-display);
  color: var(--berry-text, #1f2937);
  background: #fff;
  border: none;
  border-radius: var(--berry-radius-field, 10px);
  padding: 4px 12px;
  width: 220px;
  max-width: 60vw;
  text-align: center;
}

body.woocommerce-account .berry-account-hero__name-input:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

body.woocommerce-account .berry-account-hero__name-error {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  padding: 6px 12px;
  background: #fff;
  color: #dc2626;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--berry-radius-field, 10px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  white-space: nowrap;
  z-index: 2;
}

body.woocommerce-account .berry-account-hero__email {
  font-size: 13.5px;
  color: rgba(255,255,255,0.72);
  margin-top: 3px;
}

body.woocommerce-account .berry-account-hero__since {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50px;
  padding: 5px 14px;
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  margin-top: 14px;
}

/* Tab navigation — visually a tab bar, functionally still real links to
   each WooCommerce account endpoint (orders/edit-address/notifications/
   edit-account), same as the tile grid it replaces. Each tab is a full
   page navigation, not a client-side panel switch — the reference's own
   JS-driven instant tab switching would mean rebuilding how WooCommerce's
   classic My Account endpoints work from scratch; this keeps every
   existing endpoint/URL/hook intact and just restyles how you get there. */
body.woocommerce-account .berry-account-tabs-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  background: var(--berry-surface);
  border-radius: var(--berry-radius-xl, 24px) var(--berry-radius-xl, 24px) 0 0;
  box-shadow: var(--berry-shadow-md);
  overflow: hidden;
  box-sizing: border-box;
}

/* Dashboard only — nothing follows this card there (the real endpoint
   content div is display:none on the Dashboard, see my-account-theme.css),
   so all 4 corners round instead of just the top 2. Was missing entirely
   before (the PHP already added this class, but no matching CSS rule
   existed for it), which is why the Dashboard card's bottom corners were
   square instead of rounded. */
body.woocommerce-account .berry-account-tabs-card--solo {
  border-radius: var(--berry-radius-xl, 24px);
}

/* The <nav> WooCommerce wraps this in already carries its own full card
   treatment (background/border/shadow/padding — see .woocommerce-
   MyAccount-navigation in my-account-theme.css), which was nesting a card
   inside this new card. Neutralized here so .berry-account-tabs-card is
   the only visible card, matching the reference's single seamless piece
   instead of a card-within-a-card. */
body.woocommerce-account .woocommerce-MyAccount-navigation {
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

/* Sits directly under .berry-account-tabs-card on every non-Dashboard
   page (that card only rounds its own TOP corners there) — rounding all
   4 corners here too left a visible notch/gap in the outline where the
   two met instead of one continuous shape. Only the bottom corners round
   now, matching the reference's own .account-panel
   (border-radius: 0 0 var(--radius-xl) var(--radius-xl)) exactly. */
body.woocommerce-account .woocommerce-MyAccount-content {
  max-width: 1100px;
  margin: 0 auto;
  border-radius: 0 0 var(--berry-radius-xl, 24px) var(--berry-radius-xl, 24px) !important;
}

/* Single row of 6 tabs, evenly spread when there's room to spare, never
   crushed into illegible fragments when there isn't. A previous version
   used flex:1 1 0% (always shrink to fit, however tight) — correct-looking
   in every static check of the CSS itself, but in real testing the row's
   actual available width still came out narrower than expected for
   reasons that kept resisting isolation even after multiple confirmed
   fixes further up this ancestor chain (site-main's max-width, MyAccount-
   navigation's float/width), and flex:1 1 0% has no floor: it will shrink
   a tab as far as needed to fit, silently chopping "Berry Rewards" down to
   "Berry Rew" rather than ever admitting the row doesn't have enough room.
   flex:1 1 auto + min-width below removes that failure mode entirely: each
   tab still grows to fill a wide-enough container exactly as before, but
   refuses to shrink past a legible floor — a too-narrow container scrolls
   horizontally instead, at ANY width, not just below one breakpoint. This
   is robust regardless of what the real container width turns out to be,
   without needing that root cause pinned down further. */
body.woocommerce-account .berry-account-tabs {
  display: flex;
  width: 100%;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid #e5e7eb;
}

body.woocommerce-account .berry-account-tab {
  flex: 1 1 auto;
  min-width: 128px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 64px;
  padding: 0 20px;
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  border: none !important;
  border-bottom: 3px solid transparent !important;
  border-radius: 0 !important;
  background: none !important;
  text-decoration: none !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  transition: color 0.15s ease;
}

/* Fixed size regardless of how tight the tab gets — without this, the
   icon (sized only via its own inline width/height, no CSS floor) could
   be squeezed down by its flex-shrinking parent along with everything
   else in it. */
body.woocommerce-account .berry-account-tab svg,
body.woocommerce-account .berry-account-tab .berry-grape-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

/* Text only darkens on hover — no underline movement, no background
   change (the underline is reserved for the active tab alone). */
body.woocommerce-account .berry-account-tab:hover {
  color: #111827;
}

/* Icons only below 640px — 7 tabs' worth of icon+label text has no
   comfortable fit on a phone width, which is exactly what the min-width
   floor above (128px × 7 = 896px) was accepting a horizontal scroll for.
   Dropping the label instead removes the need for that scroll entirely:
   7 plain icons fit and stay evenly spread with real room to spare on
   any real phone width, so this replaces the scroll rather than adding a
   second mobile-only behavior on top of it. */
@media (max-width: 640px) {
  body.woocommerce-account .berry-account-tabs {
    overflow-x: visible;
  }
  body.woocommerce-account .berry-account-tab {
    min-width: 0;
    gap: 0;
    padding: 0 14px;
  }
  body.woocommerce-account .berry-account-tab span {
    display: none;
  }
}

body.woocommerce-account .berry-account-tab.is-active {
  color: #8b5cf6 !important;
  border-bottom-color: #8b5cf6 !important;
}

body.woocommerce-account .berry-account-tab.berry-account-tab--danger {
  color: #dc2626 !important;
}

body.woocommerce-account .berry-account-tabs-body {
  padding: 36px 40px 40px;
}

@media (max-width: 600px) {
  body.woocommerce-account .berry-account-tabs-body {
    padding: 24px 20px 28px;
  }
}

/* Berry Rewards card — values below are the reference's own .br-card
   family, copied exactly from its <style> block (found on a fuller re-read
   of the source — an earlier pass here approximated this from a
   screenshot alone). Green gradient background kept from that earlier
   screenshot read (the generic .br-card rule itself carries no background
   — the reference sets that per-tier via inline style/JS, and Level 1's
   own color is confirmed green there). Class names are this project's
   own (matching the existing PHP), values are the reference's. */
/* "Имаш активна поръчка" banner — sits above the rewards card, only
   rendered when berry_get_customer_active_order() finds a 'processing'
   order (see inc/account-dashboard.php). Gradient purple fill + white
   text per explicit follow-up request, using the exact "Запазване на
   промените" button's own color reference — same --berry-grad-brand the
   hero banner and that button both already use, so this is the same
   gradient, not a new one. (An earlier pass tried a white card with a
   purple border/icon instead, matching the reference dashboard's own
   lighter layout — reverted here per this explicit request for the
   gradient-filled look instead.) */
body.woocommerce-account .berry-active-order-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--berry-grad-brand);
  border: none;
  border-radius: var(--radius-lg, 20px);
  padding: 16px 20px;
  color: #fff;
  text-decoration: none !important;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(140,1,251,0.28);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.woocommerce-account .berry-active-order-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(140,1,251,0.36);
  color: #fff;
}

body.woocommerce-account .berry-active-order-banner__icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,0.22);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.woocommerce-account .berry-active-order-banner__body {
  flex: 1;
  min-width: 0;
}

body.woocommerce-account .berry-active-order-banner__title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 800;
  font-size: 14.5px;
  color: #fff;
}

body.woocommerce-account .berry-active-order-banner__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.25);
}

body.woocommerce-account .berry-active-order-banner__meta {
  margin-top: 3px;
  font-size: 13px;
  color: rgba(255,255,255,0.82);
}

body.woocommerce-account .berry-active-order-banner__chevron {
  flex-shrink: 0;
  color: #fff;
  opacity: 0.85;
}

body.woocommerce-account .berry-rewards-card {
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: var(--radius-lg, 20px);
  padding: 24px 28px;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

body.woocommerce-account .berry-rewards-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 30%, rgba(255,255,255,0.13) 0%, transparent 65%);
  pointer-events: none;
}

body.woocommerce-account .berry-rewards-card__left {
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
  z-index: 1;
}

body.woocommerce-account .berry-rewards-card__icon {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.20);
  padding: 10px;
}

body.woocommerce-account .berry-rewards-card__level {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.38);
  border-radius: 50px;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

body.woocommerce-account .berry-rewards-card__points {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 900;
  line-height: 1;
}

body.woocommerce-account .berry-rewards-card__points span {
  font-size: 15px;
  font-weight: 600;
  margin-left: 4px;
}

body.woocommerce-account .berry-rewards-card__sub {
  font-size: 13px;
  color: rgba(255,255,255,0.72);
  margin-top: 3px;
}

body.woocommerce-account .berry-rewards-card__progress {
  position: relative;
  z-index: 1;
  flex: 1 1 160px;
  min-width: 160px;
}

body.woocommerce-account .berry-rewards-card__progress-top {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: rgba(255,255,255,0.78);
  margin-bottom: 7px;
}

body.woocommerce-account .berry-rewards-card__bar {
  height: 9px;
  border-radius: 5px;
  background: rgba(255,255,255,0.22);
  overflow: hidden;
}

body.woocommerce-account .berry-rewards-card__bar-fill {
  height: 100%;
  border-radius: 5px;
  background: #fff;
  transition: width 1.1s cubic-bezier(0.4,0,0.2,1);
}

body.woocommerce-account .berry-rewards-card__note {
  font-size: 11px;
  color: rgba(255,255,255,0.58);
  margin-top: 6px;
}

/* ---------- Tier grid (Berry Rewards tab) ---------- */
body.woocommerce-account .br-tiers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-top: 4px;
}

body.woocommerce-account .br-tier-card {
  border: 2px solid var(--clr-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  background: #fff;
  position: relative;
}

body.woocommerce-account .br-tier-card.active-tier {
  border-color: var(--clr-primary);
  box-shadow: 0 4px 20px rgba(156,80,255,0.18);
  transform: translateY(-2px);
}

body.woocommerce-account .br-tier-card.locked-tier {
  opacity: 0.55;
}

body.woocommerce-account .br-tier-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 28px;
  margin-bottom: 6px;
  line-height: 1;
}

body.woocommerce-account .br-tier-card__name {
  font-weight: 800;
  font-size: 13px;
  color: var(--clr-text);
  margin-bottom: 3px;
  font-family: var(--font-display);
}

body.woocommerce-account .br-tier-card__range {
  font-size: 11px;
  color: var(--clr-text-dim);
  margin-bottom: 8px;
}

body.woocommerce-account .br-tier-card__badge {
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--clr-primary);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 10px;
  border-radius: 0 0 8px 8px;
  white-space: nowrap;
}

/* ---------- Points history (Berry Rewards tab) ----------
   Derived live from the customer's real orders (1 point per €1, same
   source as the points balance itself) rather than a stored ledger — see
   berry_render_rewards_history() in inc/account-loyalty.php. */
body.woocommerce-account .br-history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--clr-border);
}

body.woocommerce-account .br-history-item:last-child {
  border-bottom: none;
}

body.woocommerce-account .br-history-item__icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--grad-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

body.woocommerce-account .br-history-item__label {
  flex: 1;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--clr-text);
}

body.woocommerce-account .br-history-item__date {
  font-size: 11.5px;
  color: var(--clr-text-dim);
  margin-top: 2px;
}

body.woocommerce-account .br-history-item__amount {
  font-size: 15px;
  font-weight: 800;
  color: var(--clr-primary);
  font-family: var(--font-display);
  white-space: nowrap;
}
