/* =========================================
   PAGE HEADER / BREADCRUMBS
   (same pattern as catalog/product pages)
   ========================================= */
.account-section { padding: 10px 0 100px; }

.page-header { padding: 10px 0 20px; border-bottom: 1px solid var(--border-light); margin-bottom: 30px; }

.breadcrumbs {
    display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary);
    margin-bottom: 15px; flex-wrap: nowrap; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.breadcrumbs::-webkit-scrollbar { display: none; }
.breadcrumbs a { color: var(--text-secondary); transition: 0.3s; }
@media (hover: hover) and (pointer: fine) {
    .breadcrumbs a:hover { color: var(--accent-gold); }
}
.breadcrumbs i { font-size: 9px; color: var(--text-muted); }
.breadcrumbs span { color: var(--text-secondary); }

.page-title { font-size: clamp(22px, 1.2vw + 17.7px, 32px); font-weight: 600; text-transform: uppercase; letter-spacing: 2px; color: var(--text-main); }

/* Account page is full-width like the home page (no sidebar eating into
   the row), so its product grids get the same extra column at wide
   viewports. Catalog page stays capped at 4 (see css/product-card.css)
   since its grid sits next to a filter sidebar. */
@media (min-width: 1400px) { .app-grid { grid-template-columns: repeat(5, 1fr); } }

/* =========================================
   PROFILE HEADER
   ========================================= */
/* Now a column: top row (avatar+name / action icons), then the tab bar
   as a second row inside the same card — the tabs used to be their own
   separate block below the card. */
.profile-card {
    display: flex; flex-direction: column;
    background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 4px; padding: 25px 30px; margin-bottom: 40px;
}
.profile-card-top { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
/* min-width:0 lets .profile-left shrink below its children's intrinsic
   width (the flexbox default is min-width:auto, which refuses to shrink
   a flex item past its content's natural size) — needed so the name
   input below can actually respect its own responsive width instead of
   forcing the row wider than the viewport on mobile. */
.profile-left { display: flex; align-items: center; gap: 20px; min-width: 0; }

/* =========================================
   AVATAR PROGRESS RING + DUST
   A circular progress ring wraps the avatar, filling toward the 100-order
   "Поціновувач чаю" status (percent comes from renderVerifiedStatus() in
   js/pages/account.js, same source as the text progress bar below the
   name — this is just a second, decorative rendering of the same number).
   A few tiny gold dust motes drift around it — purely decorative, kept
   very subtle (low opacity, slow, few particles) so it doesn't compete
   with the rest of the header. Wrap keeps the original 60x60 footprint so
   no layout shift versus the plain avatar this replaces.
   ========================================= */
.profile-avatar-wrap {
    position: relative; width: 60px; height: 60px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.profile-avatar-wrap .profile-avatar { position: relative; z-index: 2; }

.avatar-progress-ring {
    position: absolute; top: -6px; left: -6px; width: 72px; height: 72px;
    transform: rotate(-90deg); pointer-events: none; z-index: 1;
}
.apr-track { fill: none; stroke: var(--border-light); stroke-width: 2.5; }
.apr-fill {
    fill: none; stroke: var(--accent-gold); stroke-width: 2.5; stroke-linecap: round;
    stroke-dasharray: 188.5; stroke-dashoffset: 188.5;
    transition: stroke-dashoffset 1s ease-out;
    filter: drop-shadow(0 0 3px rgba(5, 83, 156, 0.5));
}
.profile-avatar-wrap.is-complete .apr-fill { filter: drop-shadow(0 0 5px rgba(5, 83, 156, 0.85)); }

.avatar-dust { position: absolute; inset: -10px; z-index: 3; pointer-events: none; overflow: visible; }
.avatar-dust span {
    position: absolute; width: 2px; height: 2px; background: var(--accent-gold);
    border-radius: 50%; opacity: 0; animation: dustFloat 5.5s ease-in-out infinite;
}
.avatar-dust span:nth-child(1) { top: 58%; left: -2%;  animation-delay: 0s;    }
.avatar-dust span:nth-child(2) { top: 12%; left: 92%;  animation-delay: 1.7s; }
.avatar-dust span:nth-child(3) { top: 82%; left: 68%;  animation-delay: 3.2s; }
.avatar-dust span:nth-child(4) { top: 2%;  left: 38%;  animation-delay: 2.4s; }

@keyframes dustFloat {
    0%   { opacity: 0; transform: translate(0, 0) scale(0.6); }
    18%  { opacity: 0.5; }
    50%  { opacity: 0.3; transform: translate(-3px, -12px) scale(1); }
    85%  { opacity: 0; }
    100% { opacity: 0; transform: translate(-5px, -18px) scale(0.6); }
}

@media (prefers-reduced-motion: reduce) {
    .avatar-dust span { animation: none; opacity: 0; }
    .apr-fill { transition: none; }
}
.profile-avatar {
    width: 60px; height: 60px; border-radius: 50%; background: rgba(5, 83, 156, 0.12);
    color: var(--accent-gold); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
    overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
/* Plain inline flow (not flex) on purpose: .verified-check is an
   inline-flex span with vertical-align:middle, which only centers
   correctly against the name text in a normal inline formatting
   context — flex's align-items:center centers by margin-box instead,
   which visibly misaligned the badge against the cap-height of the
   text. */
.profile-name { display: inline; font-size: 18px; font-weight: 500; color: var(--text-main); }
.profile-name-row { margin-bottom: 4px; }
/* The name/email column next to the avatar — needs min-width:0 too
   (see .profile-left's comment) plus flex:1 so it's the one that
   actually shrinks on a narrow screen, not .profile-actions' icon
   buttons getting pushed off-screen. */
.profile-name-col { min-width: 0; flex: 1; }
.profile-name-input {
    font-size: 16px; font-weight: 500; color: var(--text-main); background: transparent; border: 1px solid var(--border-strong);
    border-radius: 4px; padding: 6px 10px; margin-bottom: 4px; width: 100%; max-width: 220px;
    box-sizing: border-box; outline: none;
}
.profile-name-input:focus { border-color: var(--accent-gold); }
.profile-email { font-size: 13px; color: var(--text-secondary); }
.profile-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
/* Edit/save/logout are now three small icon buttons together, same
   treatment on every screen size (previously logout was a separate
   full-text button, and only mobile turned edit into an icon). */
.icon-btn {
    width: 36px; height: 36px; border-radius: 50%; padding: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-soft); border: 1px solid var(--border-strong); color: var(--text-secondary);
    font-size: 14px; line-height: 1; cursor: pointer; transition: 0.3s;
}
@media (hover: hover) and (pointer: fine) {
    .icon-btn:hover { border-color: var(--accent-gold); color: var(--accent-gold); }
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn-gold { background: var(--accent-gold); border-color: var(--accent-gold); color: #fff; }
@media (hover: hover) and (pointer: fine) {
    .icon-btn-gold:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
}
.icon-btn-gold:active { transform: scale(0.92); }
@media (hover: hover) and (pointer: fine) {
    .icon-btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
}
.icon-btn-danger:active { background: var(--danger); border-color: var(--danger); color: #fff; transform: scale(0.92); }

/* Edit/save/cancel as a clearly-labelled row below the profile header,
   not icon-only buttons — a lone checkmark or arrow read as too subtle
   to tell what it does at a glance. */
.profile-edit-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.profile-edit-actions { display: flex; gap: 10px; }
.profile-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border-radius: 4px; font-size: 13px; font-weight: 500;
    background: transparent; border: 1px solid var(--border-strong); color: var(--text-main); cursor: pointer; transition: 0.3s;
}
@media (hover: hover) and (pointer: fine) {
    .profile-btn:hover { border-color: var(--accent-gold); color: var(--accent-gold); }
}
.profile-btn:active { transform: scale(0.97); }
.profile-btn-gold { background: var(--accent-gold); border-color: var(--accent-gold); color: #fff; font-weight: 600; }
@media (hover: hover) and (pointer: fine) {
    .profile-btn-gold:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
}

/* Explainer panel under the profile card — shown to every logged-in
   customer by default (not just those who already have the badge), so
   it also works as "here's what to aim for". The seal icon here is
   purely decorative (tabindex="-1", no aria-label) — the real
   interactive badge is the one in .profile-name-row. */
/* No box/border — just plain text flowing under the profile card,
   shown only while editing (see editProfile()/saveProfile() in
   account.js). The seal used to be its own oversized icon to the left
   of this whole block (.badge-info-icon, transform: scale(1.9)) — per
   feedback it's now the same standard-size .verified-check used
   everywhere else (profile name row, review cards), sitting inline
   right after the "Поціновувач чаю»" heading text instead. */
.badge-info { margin-top: 20px; }
.badge-info-text h4 { color: var(--text-main); font-size: 14px; font-weight: 500; margin: 18px 0 8px; }
.badge-info-text h4:first-child { margin-top: 0; }
.badge-info-text p { color: var(--text-secondary); font-size: 13.5px; line-height: 1.6; margin: 0 0 8px; }
.badge-info-text p:last-child { margin-bottom: 0; }
.badge-info-text strong { color: var(--accent-gold); font-weight: 500; }
.badge-info-text ul { margin: 0 0 8px; padding-left: 18px; }
.badge-info-text li { color: var(--text-secondary); font-size: 13.5px; line-height: 1.6; margin-bottom: 4px; }

/* =========================================
   TABS
   ========================================= */
.account-tabs { display: flex; gap: 40px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-strong); }
.account-tab {
    font-size: 14px; font-weight: 500; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px;
    padding-bottom: 14px; border-bottom: 2px solid transparent; cursor: pointer; transition: 0.3s; background: none; border-top: none; border-left: none; border-right: none;
    display: flex; align-items: center; gap: 8px;
}
.account-tab.active { color: var(--text-main); border-bottom-color: var(--accent-gold); }
@media (hover: hover) and (pointer: fine) {
    .account-tab:hover { color: var(--text-main); border-bottom-color: var(--accent-gold); }
}
.account-tab .tab-icon { display: none; }
.account-tab .tab-label-short { display: none; }
/* Removed per feedback: the digit never centered cleanly in the pill/
   circle at any size, and a raw count next to "Бажання"/"Замовлення"
   wasn't adding anything a cart badge does — kept in the DOM (JS still
   writes to it) but hidden. */
.tab-count { display: none; }
#accountPanelsSection { margin-top: 40px; }
.account-panel { display: none; }
.account-panel.active { display: block; }

/* =========================================
   ORDERS
   ========================================= */
.orders-list { display: flex; flex-direction: column; gap: 15px; }
.order-card { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 4px; padding: 20px 25px; transition: 0.25s; }
@media (hover: hover) and (pointer: fine) {
    .order-card:hover { border-color: var(--border-light); }
}
.order-id-wrap { display: flex; align-items: center; gap: 12px; }
.order-icon {
    width: 34px; height: 34px; border-radius: 50%; background: rgba(5, 83, 156, 0.1);
    color: var(--accent-gold); display: flex; align-items: center; justify-content: center;
    font-size: 13px; flex-shrink: 0;
}
.order-id { display: block; }
.order-date { display: block; margin-top: 2px; }
.order-item-meta { color: var(--text-secondary); }
.order-card-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 15px; flex-wrap: wrap; }
.order-id { color: var(--text-main); font-weight: 500; font-size: 14px; }
.order-date { color: var(--text-secondary); font-size: 12px; }
.order-status {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px;
    padding: 5px 12px; border-radius: 20px; background: rgba(30, 158, 90, 0.1); color: var(--success);
}
.order-status i { font-size: 10px; }
.order-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 15px; }
.order-item-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-secondary); }
.order-item-row span:last-child { color: var(--text-main); font-weight: 500; flex-shrink: 0; margin-left: 15px; }
.order-delivery { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-secondary); padding: 12px 0; border-top: 1px solid var(--border-light); margin-bottom: 0; }
.order-delivery-ttn a { color: var(--accent-gold); text-decoration: none; border-bottom: 1px solid rgba(5, 83, 156, 0.4); }
.order-card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 15px; border-top: 1px solid var(--border-light); }
.order-total-label { color: var(--text-secondary); font-size: 13px; }
.order-total-val { color: var(--accent-gold); font-size: 18px; font-weight: 600; }

/* =========================================
   PAGINATION (same visual pattern as css/catalog.css)
   ========================================= */
.pagination-wrapper { display: flex; justify-content: center; margin-top: 40px; }
.pagination {
    display: flex; align-items: center; gap: 4px;
    background: var(--bg-card); border: 1px solid var(--border-light);
    border-radius: 4px; padding: 6px; overflow: visible;
}
.page-btn {
    background: transparent; border: none; border-radius: 4px; color: var(--text-secondary);
    width: 38px; height: 38px; padding: 0; font-size: 14px; font-family: inherit;
    cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px;
    position: relative;
}
.page-btn:has(.page-text) { width: auto; padding: 0 14px; }
@media (hover: hover) and (pointer: fine) {
    .page-btn:hover:not(.disabled):not(.dots):not(.active) { color: var(--text-main); background: var(--bg-soft); }
}
.page-btn.active { color: var(--accent-gold); font-weight: 500; background: transparent; }
.page-btn.active::after {
    content: ''; position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
    width: 16px; height: 2px; background: var(--accent-gold); border-radius: 2px;
}
.page-btn.disabled { color: var(--border-strong); cursor: not-allowed; }
.page-btn.dots { cursor: default; pointer-events: none; color: var(--text-muted); width: auto; padding: 0 4px; }

/* =========================================
   REVIEWS — the customer's own review history (Supabase-backed, see
   reviews.service.js's getMyReviews()). Same dark-card visual language
   as .order-card just above, so the three account tabs read as one
   consistent list style rather than three different components.
   ========================================= */
.reviews-empty-card { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 4px; }

.my-reviews-list { display: flex; flex-direction: column; gap: 15px; }
.my-review-card { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 4px; padding: 20px 25px; transition: 0.25s; }
@media (hover: hover) and (pointer: fine) {
    .my-review-card:hover { border-color: var(--border-light); }
}
.my-review-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 12px; flex-wrap: wrap; }
.my-review-stars { color: var(--warning); font-size: 13px; }
.my-review-status {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px;
    padding: 5px 12px; border-radius: 20px;
}
.my-review-status i { font-size: 10px; }
.my-review-status.is-approved { background: rgba(30, 158, 90, 0.1); color: var(--success); }
.my-review-status.is-pending { background: rgba(5, 83, 156, 0.1); color: var(--accent-gold); }
.my-review-text { color: var(--text-main); font-size: 14px; line-height: 1.6; margin-bottom: 15px; }
.my-review-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 15px;
    padding-top: 15px; border-top: 1px solid var(--border-light); flex-wrap: wrap;
}
.my-review-product { color: var(--accent-gold); font-size: 13px; }
.my-review-product i { font-size: 11px; margin-right: 4px; }
.my-review-date { color: var(--text-secondary); font-size: 12px; }

/* =========================================
   LOGGED-OUT PROMPT
   ========================================= */
.account-guard { padding: 100px 20px; text-align: center; }
.account-guard i { font-size: 36px; color: var(--accent-gold); margin-bottom: 20px; display: block; }
.account-guard .state-title { color: var(--text-main); font-size: 18px; font-weight: 500; margin-bottom: 20px; }
.account-guard .state-action-btn { padding: 14px 30px; font-size: 13px; }

@media (max-width: 600px) {
    /* Same gap as catalog.css: account.html's "Кабінет" h1 had no mobile
       override either and stayed at the 32px desktop size on phones. */

    /* account.html doesn't load catalog.css, so the wishlist grid (same
       .app-grid class) was falling back to product-card.css's desktop
       gap (20px) on mobile instead of catalog's 10px - cards read as
       smaller with too much space between them. Match catalog.css's
       mobile override here. */
    .app-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

    .profile-card { padding: 18px; gap: 16px; }
    .profile-card-top { align-items: flex-start; gap: 12px; }

    /* Full-width, stacked buttons on mobile — side-by-side small buttons
       are an easy mis-tap target on a phone, and "Редагувати профіль"
       reads better as its own full-width row anyway. */
    .profile-edit-row { flex-direction: column; }
    .profile-btn { width: 100%; }
    /* Зберегти/Скасувати stay side by side even on mobile — only
       editProfileBtn (with no sibling to share the row) goes full-width. */
    .profile-edit-actions { width: 100%; }
    .profile-edit-actions .profile-btn { width: auto; flex: 1; }

    /* ---- Tabs: fixed 3-column grid instead of a row you have to scroll.
       Icon-over-label. No outer box here — the tab bar is nested inside
       .profile-card now, which already has its own border. ---- */
    .account-tabs {
        display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
        border-top: 1px solid var(--border-strong); padding-top: 14px; margin-top: 4px; border-bottom: none;
    }
    .account-tab {
        flex-direction: column; gap: 4px; padding: 10px 4px 8px; border-radius: 4px;
        border-bottom: none; position: relative; font-size: 10.5px; letter-spacing: 0.2px;
        line-height: 1.25; text-align: center;
    }
    .account-tab.active { border-bottom-color: transparent; background: rgba(5, 83, 156, 0.08); }
    @media (hover: hover) and (pointer: fine) {
        .account-tab:hover { border-bottom-color: transparent; background: rgba(5, 83, 156, 0.08); }
    }
    .account-tab .tab-icon { display: block; font-size: 15px; }
    .account-tab .tab-label-full { display: none; }
    .account-tab .tab-label-short { display: block; }


    .order-card-header { flex-direction: column; align-items: flex-start; gap: 10px; }
}
