/* ====================================================================
   FindPrices Account Section — v2 design
   Layered on top of home-styles.css + content-styles.css.

   Shape:
     - Each account page reuses .page-hero (from content-styles.css) for
       the eyebrow / title / deck, and .section for content padding.
     - .account-subnav sits inside .page-hero as a horizontal pill nav
       between sections. Non-sticky to avoid layout fights.
     - Cards (.account-card, .account-grid) and all page-specific
       components live below.

   All class names + element IDs match what account.js / referrals.js /
   search-history.js / email-preferences.js / privacy.js expect.
   ==================================================================== */

/* ────── Account sub-nav (pill tabs inside .page-hero) ────── */
.account-subnav {
    margin-top: 28px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.account-subnav a {
    display: inline-flex;
    align-items: center;
    padding: 9px 16px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--fp-line);
    color: var(--fp-body);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
}
.account-subnav a:hover {
    border-color: var(--fp-heading);
    color: var(--fp-heading);
}
.account-subnav a.active {
    background: var(--fp-heading);
    border-color: var(--fp-heading);
    color: #fff;
}

@media (max-width: 700px) {
    .account-subnav {
        margin-top: 22px;
        gap: 6px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .account-subnav::-webkit-scrollbar { display: none; }
    .account-subnav a {
        flex-shrink: 0;
        padding: 8px 14px;
        font-size: 13px;
    }
}

/* ────── Make .page-hero on account pages a touch tighter ────── */
.page-hero.account-page-hero { padding: 56px 0 36px; }
.page-hero.account-page-hero h1 { font-size: clamp(34px, 4.6vw, 46px); }
@media (max-width: 700px) { .page-hero.account-page-hero { padding: 40px 0 24px; } }

/* ────── Container variants ────── */
.account-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 920px;
    margin: 0 auto;
}
.two-col-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

/* On wider screens, keep the search-history layout at full container width */
.account-section-wide { max-width: 1200px; margin: 0 auto; }

/* ────── Card system ────── */
.account-card {
    background: #fff;
    border: 1px solid var(--fp-line);
    border-radius: 14px;
    padding: 28px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s;
}
.account-card:hover { box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06); }

.account-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--fp-heading);
    letter-spacing: -0.018em;
    margin: 0 0 16px;
}
.account-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--fp-heading);
    letter-spacing: -0.012em;
    margin: 0 0 12px;
}
.account-card h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--fp-heading);
    margin: 0 0 4px;
}
.account-card p {
    color: var(--fp-body);
    line-height: 1.6;
    font-size: 14px;
    margin: 0 0 12px;
}
.account-card p:last-child { margin-bottom: 0; }

@media (max-width: 600px) {
    .account-card { padding: 22px; border-radius: 12px; }
    .account-grid { gap: 18px; }
}

/* ────── Profile card ────── */
.account-card--profile {
    padding: 0;
    overflow: hidden;
}
.profile-header-bg {
    background: linear-gradient(135deg, var(--fp-green-soft) 0%, #ffffff 100%);
    border-bottom: 1px solid var(--fp-line);
    padding: 32px 30px 26px;
}
.profile-display {
    display: flex;
    gap: 22px;
    align-items: center;
}
.profile-photo-container { position: relative; flex-shrink: 0; }
.profile-photo {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--fp-green);
    box-shadow: 0 2px 10px rgba(39, 174, 96, 0.18);
    display: none;
}
.profile-photo.loaded { display: block; }
.profile-photo-placeholder {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--fp-green-soft) 0%, #f1f8f4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fp-green);
    border: 3px solid var(--fp-green);
}
.profile-photo.loaded ~ .profile-photo-placeholder { display: none; }

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.profile-name {
    font-size: 21px;
    font-weight: 700;
    color: var(--fp-heading);
    margin: 0;
    letter-spacing: -0.015em;
}
.profile-email {
    font-size: 14px;
    color: var(--fp-muted);
    margin: 0;
    word-break: break-word;
}
.profile-meta {
    font-size: 13px;
    color: var(--fp-muted);
    margin: 8px 0 0;
    padding-top: 8px;
    border-top: 1px solid var(--fp-line);
}
.profile-meta strong { color: var(--fp-heading); font-weight: 600; }

@media (max-width: 600px) {
    .profile-display { flex-direction: column; text-align: center; gap: 14px; }
    .profile-photo, .profile-photo-placeholder { width: 80px; height: 80px; }
    .profile-name { font-size: 18px; }
}

/* ────── Badges ────── */
.account-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.account-badge--member     { background: var(--fp-green-soft); color: var(--fp-green-dk); }
.account-badge--ambassador { background: linear-gradient(135deg, #e8f5e9 0%, #d4edda 100%); color: var(--fp-green-dk); }
.account-badge--legend     { background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%); color: #b8881a; }
.account-badge--vip        { background: linear-gradient(135deg, #ede7f6 0%, #d1c4e9 100%); color: #5e35b1; }
.account-badge--admin      { background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%); color: #1565c0; }
.account-badge--danger     { background: #fff0ee; color: #c0392b; }

.count-badge {
    background: var(--fp-green);
    color: #fff;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
}

/* ────── Tier CTA ────── */
.tier-cta {
    margin-top: 16px;
    padding: 14px 16px;
    border-left: 3px solid var(--fp-green);
    background: var(--fp-green-soft);
    border-radius: 8px;
}
.tier-cta p {
    margin: 0 0 10px;
    font-size: 14px;
    color: var(--fp-heading);
    line-height: 1.5;
}
.tier-cta .btn { width: 100%; justify-content: center; }

/* ────── Progress bar ────── */
.account-progress { margin: 14px 0 8px; }
.account-progress__bar {
    width: 100%;
    height: 8px;
    background: var(--fp-line);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}
.account-progress__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--fp-green), var(--fp-green-dk));
    border-radius: 999px;
    transition: width 0.5s ease;
}
.account-progress__text {
    display: block;
    font-size: 13px;
    color: var(--fp-body);
    text-align: center;
}

/* ────── Forms ────── */
.account-form-group { margin-bottom: 16px; }
.account-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--fp-heading);
    font-size: 13px;
}
.account-input,
.account-select,
.account-form-group input,
.account-form-group select,
.account-form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--fp-line);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    color: var(--fp-heading);
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.account-input:focus,
.account-select:focus,
.account-form-group input:focus,
.account-form-group select:focus,
.account-form-group textarea:focus {
    border-color: var(--fp-green);
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.18);
}

/* ────── Buttons ────── */
.btn-full { width: 100%; justify-content: center; }
.account-card .btn { font-weight: 600; letter-spacing: 0; }

.btn-outline {
    background: transparent;
    color: var(--fp-heading);
    border: 1.5px solid var(--fp-line);
    padding: 12px 22px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: border-color 0.15s, transform 0.15s;
}
.btn-outline:hover {
    border-color: var(--fp-heading);
    transform: translateY(-1px);
}

.btn-danger {
    background: #fff;
    color: #e74c3c;
    border: 1.5px solid #f1c0c0;
    padding: 12px 22px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.btn-danger:hover {
    background: #e74c3c;
    color: #fff;
    border-color: #e74c3c;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(231, 76, 60, 0.25);
}

/* ────── Toggle switch ────── */
.account-toggle {
    position: relative;
    width: 44px;
    height: 26px;
    flex-shrink: 0;
}
.account-toggle input { opacity: 0; width: 0; height: 0; }
.account-toggle__slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #d4d6db;
    transition: background 0.3s;
    border-radius: 999px;
}
.account-toggle__slider::before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}
.account-toggle input:checked + .account-toggle__slider { background: var(--fp-green); }
.account-toggle input:checked + .account-toggle__slider::before { transform: translateX(18px); }

/* ────── Preference rows ────── */
.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--fp-heading);
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}
.section-subtitle {
    font-size: 13px;
    color: var(--fp-muted);
    margin-bottom: 18px;
}
.preference-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--fp-line);
}
.preference-item:last-child { border-bottom: none; }
.preference-info { flex: 1; min-width: 0; }
.preference-info h4 { font-size: 15px; font-weight: 600; color: var(--fp-heading); margin: 0 0 4px; }
.preference-info p { font-size: 13px; color: var(--fp-muted); margin: 0; line-height: 1.5; }

.unsubscribe-all {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid var(--fp-line);
}
.unsubscribe-all p { margin: 0; font-size: 13px; color: var(--fp-muted); }
.unsubscribe-all a { color: #e74c3c; font-weight: 600; }
.unsubscribe-all a:hover { text-decoration: underline; }

/* ────── Alerts ────── */
.account-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
    line-height: 1.5;
}
.account-alert.active { display: block; }
.account-alert--success { background: var(--fp-green-soft); color: var(--fp-green-dk); border: 1px solid rgba(39, 174, 96, 0.25); }
.account-alert--error   { background: #fff0ee; color: #c0392b; border: 1px solid #f1c0c0; }

/* ────── Inner section blocks (used inside privacy-data card) ────── */
.account-section-block {
    padding: 20px 22px;
    background: var(--fp-bg-alt);
    border-radius: 10px;
    margin-bottom: 16px;
    border: 1px solid var(--fp-line);
}
.account-section-block:last-child { margin-bottom: 0; }
.account-section-block h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--fp-heading);
}
.account-section-block p {
    font-size: 14px;
    color: var(--fp-body);
    margin: 0 0 12px;
    line-height: 1.5;
}

/* ────── Activity stats ────── */
.activity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.activity-stat-card {
    background: #fff;
    padding: 18px 14px;
    border-radius: 10px;
    border: 1px solid var(--fp-line);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.activity-stat-card__value {
    font-size: 22px;
    font-weight: 800;
    color: var(--fp-green-dk);
    letter-spacing: -0.015em;
    line-height: 1;
}
.activity-stat-card__label {
    font-size: 11px;
    color: var(--fp-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

/* ────── Danger zone ────── */
.account-danger {
    padding: 22px;
    background: #fff5f4;
    border: 1.5px solid #f1c0c0;
    border-radius: 12px;
}
.account-danger h3 { color: #c0392b; margin: 0 0 8px; font-size: 16px; }
.account-danger p { color: var(--fp-body); margin: 0 0 14px; font-size: 14px; }

/* ────── Sign-out ────── */
.sign-out-section { text-align: center; }

/* ────── Modal ────── */
.account-modal {
    position: fixed;
    inset: 0;
    background: rgba(8, 16, 12, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 10000;
}
.account-modal.active { display: flex; }
.account-modal__card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
    padding: 28px;
}
.account-modal__card h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--fp-heading);
}
.account-modal__card p {
    color: var(--fp-body);
    font-size: 14px;
    line-height: 1.55;
    margin: 0;
}
.account-modal__actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 22px;
}
.account-modal__actions .btn { padding: 10px 18px; font-size: 14px; }

/* ────── Loading ────── */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.loading-overlay.active { display: flex; }
.loading {
    text-align: center;
    color: var(--fp-muted);
    padding: 60px 20px;
    font-size: 15px;
}

/* ====================================================================
   Referrals page
   ==================================================================== */

.share-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 0 0 22px;
}
@media (max-width: 600px) { .share-buttons { grid-template-columns: repeat(2, 1fr); } }

.share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 10px;
    background: #fff;
    border: 1.5px solid var(--fp-line);
    border-radius: 12px;
    color: var(--fp-heading);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
}
.share-btn:hover {
    border-color: var(--fp-green);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(39, 174, 96, 0.12);
}
/* Force SVG sizing — without explicit width/height on the svg element,
   CSS-only sizing via parent flex would let SVGs balloon. */
.share-btn svg {
    width: 22px !important;
    height: 22px !important;
    flex-shrink: 0;
    color: var(--fp-green-dk);
    fill: currentColor;
}

.referral-link-container {
    display: flex;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.referral-link-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 14px;
    border: 1px solid var(--fp-line);
    border-radius: 8px;
    background: var(--fp-bg-alt);
    color: var(--fp-heading);
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}
.referral-link-container .btn {
    padding: 12px 22px;
    font-size: 14px;
    flex-shrink: 0;
}

.share-note {
    font-size: 12px;
    color: var(--fp-muted);
    margin: 0 0 22px;
}

.divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 28px 0;
    color: var(--fp-muted);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--fp-line);
}

.invite-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--fp-heading);
    margin-bottom: 6px;
}
.invite-input-group {
    display: grid;
    grid-template-columns: 1fr 1.4fr auto;
    gap: 10px;
    margin-bottom: 8px;
}
@media (max-width: 700px) { .invite-input-group { grid-template-columns: 1fr; } }
.invite-input {
    padding: 12px 14px;
    border: 1px solid var(--fp-line);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--fp-heading);
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.invite-input:focus {
    border-color: var(--fp-green);
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.18);
}
.invite-input-group .btn { padding: 12px 22px; font-size: 14px; }

.progress-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 28px;
    align-items: center;
}
@media (max-width: 700px) { .progress-grid { grid-template-columns: 1fr; gap: 18px; } }

.progress-savings {
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, var(--fp-green-soft), #ffffff);
    border: 1px solid rgba(39, 174, 96, 0.25);
    border-radius: 12px;
}
.progress-savings-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fp-muted);
    margin-bottom: 6px;
    font-weight: 600;
}
.progress-savings-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--fp-green-dk);
    letter-spacing: -0.02em;
    line-height: 1;
}

.rewards-box {
    margin-top: 18px;
    padding: 16px 18px;
    background: var(--fp-bg-alt);
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--fp-body);
    border: 1px solid var(--fp-line);
}
.rewards-box strong { color: var(--fp-heading); }

/* ====================================================================
   Search history page
   ==================================================================== */

.filters-section {
    background: #fff;
    border: 1px solid var(--fp-line);
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 24px;
}
.filter-row {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr auto;
    gap: 10px;
}
@media (max-width: 800px) {
    .filter-row { grid-template-columns: 1fr 1fr; }
    .filter-row > input { grid-column: 1 / -1; }
}
.filter-input,
.filter-select {
    padding: 11px 14px;
    border: 1px solid var(--fp-line);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: var(--fp-heading);
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.filter-input:focus, .filter-select:focus {
    border-color: var(--fp-green);
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.18);
}

.history-layout {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
}
@media (max-width: 900px) { .history-layout { grid-template-columns: 1fr; } }

.search-list-container,
.results-container {
    background: #fff;
    border: 1px solid var(--fp-line);
    border-radius: 12px;
    overflow: hidden;
    align-self: start;
}
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--fp-line);
    background: var(--fp-bg-alt);
}
.list-header h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--fp-heading);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0;
}
.search-list {
    max-height: 720px;
    overflow-y: auto;
}
.search-list-container .btn {
    margin: 16px;
    width: calc(100% - 32px);
}

.results-header {
    padding: 16px 22px;
    border-bottom: 1px solid var(--fp-line);
    background: var(--fp-bg-alt);
}
.results-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--fp-heading);
    margin: 0;
    letter-spacing: -0.01em;
}
.results-content {
    padding: 24px;
    min-height: 420px;
    max-height: 720px;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 20px;
    color: var(--fp-muted);
    gap: 14px;
    min-height: 320px;
}
.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--fp-line);
    flex-shrink: 0;
}
.empty-state p { font-size: 14px; max-width: 280px; margin: 0; }

/* search-history.js dynamic items */
.search-list .search-item {
    padding: 14px 18px;
    border-bottom: 1px solid var(--fp-line);
    cursor: pointer;
    transition: background 0.15s;
}
.search-list .search-item:last-child { border-bottom: none; }
.search-list .search-item:hover { background: var(--fp-bg-alt); }
.search-list .search-item.active {
    background: var(--fp-green-soft);
    border-left: 3px solid var(--fp-green);
    padding-left: 15px;
}
.search-list .search-item__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--fp-heading);
    margin: 0 0 4px;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.search-list .search-item__meta {
    font-size: 12px;
    color: var(--fp-muted);
    display: flex;
    gap: 8px;
    align-items: center;
}
.search-list .search-item__savings {
    color: var(--fp-green-dk);
    font-weight: 700;
}

/* ====================================================================
   Smooth scroll for hash anchors
   ==================================================================== */
html { scroll-behavior: smooth; scroll-padding-top: 100px; }

@keyframes highlightPulse {
    0%, 100% { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04); }
    50% { box-shadow: 0 0 0 4px rgba(39, 174, 96, 0.2), 0 2px 10px rgba(0, 0, 0, 0.04); }
}
.account-card:target { animation: highlightPulse 2s ease-out; }
