/**
 * HiFriendbot Memory Product Styles
 * Reuses CSS variables from chat.css :root block
 */

/* ===================
   Container
   =================== */
.hfb-memory-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    max-width: 1100px;
    margin: 0 auto;
    min-height: calc(100vh - 80px);
    color: var(--hfb-text);
}

/* ===================
   Dashboard View
   =================== */

/* ── Hero ── */
.hfb-memory-hero {
    text-align: center;
    padding: 60px 5% 40px;
    position: relative;
    overflow: hidden;
}

.hfb-memory-hero__glow {
    position: absolute;
    top: -150px;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    height: 500px;
    background: radial-gradient(circle, var(--hfb-primary-glow) 0%, transparent 70%);
    pointer-events: none;
    animation: memory-pulse 4s ease-in-out infinite;
}

@keyframes memory-pulse {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.7; transform: translateX(-50%) scale(1.05); }
}

.hfb-memory-hero__title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 0 0 16px;
    background: linear-gradient(135deg, var(--hfb-text), var(--hfb-primary-light), var(--hfb-accent));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 5s ease infinite;
    position: relative;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.hfb-memory-hero__subtitle {
    font-size: 1.1rem;
    color: var(--hfb-text-secondary);
    max-width: 520px;
    margin: 0 auto 32px;
    line-height: 1.6;
    position: relative;
}

.hfb-memory-start-btn,
body button.hfb-memory-start-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    padding: 14px 32px !important;
    background: var(--hfb-gradient-primary) !important;
    color: white !important;
    border: none !important;
    border-radius: 50px !important;
    font-size: 16px !important;
    font-weight: 600;
    cursor: pointer;
    transition: var(--hfb-transition);
    box-shadow: 0 4px 20px var(--hfb-primary-glow);
    position: relative;
    min-height: 52px;
}

.hfb-memory-start-btn:hover,
body button.hfb-memory-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--hfb-primary-glow);
}

.hfb-memory-start-btn:active {
    transform: translateY(0);
}

.hfb-memory-start-btn svg {
    fill: none;
    stroke: currentColor;
}

/* ── Sections ── */
.hfb-memory-section {
    padding: 0 5% 48px;
    max-width: 960px;
    margin: 0 auto;
}

.hfb-memory-section__title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    text-align: center;
    margin: 0 0 8px;
    color: var(--hfb-text);
}

.hfb-memory-section__sub {
    font-size: 1rem;
    color: var(--hfb-text-secondary);
    text-align: center;
    margin: 0 0 32px;
}

/* ── Provider Grid ── */
.hfb-provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

/* ── Provider Cards ── */
.hfb-provider-card {
    background: var(--hfb-surface);
    border: 1px solid var(--hfb-border);
    border-radius: var(--hfb-radius);
    padding: 24px;
    transition: var(--hfb-transition);
}

.hfb-provider-card:hover {
    border-color: var(--hfb-border-light);
    box-shadow: var(--hfb-shadow);
}

.hfb-provider-card--quickstart {
    border-color: var(--hfb-accent);
    background: linear-gradient(180deg, rgba(6, 182, 212, 0.08) 0%, var(--hfb-surface) 100%);
}

.hfb-provider-card--quickstart:hover {
    border-color: var(--hfb-accent);
    box-shadow: 0 0 30px var(--hfb-accent-glow);
}

.hfb-provider-card__header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.hfb-provider-card__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--hfb-surface-light);
    color: var(--hfb-text-secondary);
}

.hfb-provider-card__icon--quickstart {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(139, 92, 246, 0.2));
    color: var(--hfb-accent);
}

.hfb-provider-card__icon--openai {
    color: var(--hfb-text);
}

.hfb-provider-card__icon--anthropic {
    color: var(--hfb-text);
}

.hfb-provider-card__icon--google {
    color: var(--hfb-text);
}

.hfb-provider-card__info h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: var(--hfb-text);
}

.hfb-provider-card__badge {
    font-size: 12px;
    font-weight: 500;
    color: var(--hfb-accent);
}

.hfb-provider-card__status {
    font-size: 13px;
    color: var(--hfb-text-muted);
}

.hfb-provider-card__status.connected {
    color: var(--hfb-green);
}

.hfb-provider-card__desc {
    font-size: 14px;
    color: var(--hfb-text-secondary);
    margin: 0 0 16px;
    line-height: 1.5;
}

/* ── Provider Card Buttons ── */
.hfb-provider-card__btn,
body button.hfb-provider-card__btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 10px 20px !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    font-weight: 600;
    cursor: pointer;
    transition: var(--hfb-transition);
    min-height: 44px;
    border: none !important;
}

.hfb-provider-card__btn--chat,
body button.hfb-provider-card__btn--chat {
    background: var(--hfb-gradient-primary) !important;
    color: white !important;
    width: 100%;
    box-shadow: 0 4px 15px var(--hfb-primary-glow);
}

.hfb-provider-card__btn--chat:hover,
body button.hfb-provider-card__btn--chat:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 25px var(--hfb-primary-glow);
}

.hfb-provider-card__btn--connect,
body button.hfb-provider-card__btn--connect {
    background: var(--hfb-surface-light) !important;
    color: var(--hfb-text) !important;
    border: 1px solid var(--hfb-border-light) !important;
    width: 100%;
}

.hfb-provider-card__btn--connect:hover,
body button.hfb-provider-card__btn--connect:hover {
    background: var(--hfb-surface-hover) !important;
    border-color: var(--hfb-primary) !important;
    color: var(--hfb-primary-light) !important;
}

.hfb-provider-card__btn--save,
body button.hfb-provider-card__btn--save {
    background: var(--hfb-gradient-primary) !important;
    color: white !important;
    flex: 1;
}

.hfb-provider-card__btn--cancel,
body button.hfb-provider-card__btn--cancel {
    background: var(--hfb-surface-light) !important;
    color: var(--hfb-text-secondary) !important;
}

.hfb-provider-card__btn--cancel:hover,
body button.hfb-provider-card__btn--cancel:hover {
    color: var(--hfb-text) !important;
}

.hfb-provider-card__btn--disconnect,
body button.hfb-provider-card__btn--disconnect {
    background: transparent !important;
    color: var(--hfb-text-muted) !important;
    font-size: 13px !important;
    padding: 8px 12px !important;
}

.hfb-provider-card__btn--disconnect:hover,
body button.hfb-provider-card__btn--disconnect:hover {
    color: #ef4444 !important;
}

.hfb-provider-card__btn--loading {
    opacity: 0.7;
    pointer-events: none;
}

/* ── Provider Card Form ── */
.hfb-provider-card__form {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--hfb-border);
}

.hfb-provider-card__steps {
    margin-bottom: 12px;
}

.hfb-provider-card__steps p {
    font-size: 14px;
    color: var(--hfb-text-secondary);
    margin: 0 0 6px;
    line-height: 1.5;
}

.hfb-provider-card__steps a {
    color: var(--hfb-primary-light);
    text-decoration: none;
}

.hfb-provider-card__steps a:hover {
    text-decoration: underline;
}

.hfb-provider-card__steps code {
    background: rgba(255, 255, 255, 0.06);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 12px;
    color: var(--hfb-text);
}

.hfb-provider-card__help {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 12px !important;
    color: #64748b !important;
}

.hfb-provider-card__help a {
    color: var(--hfb-primary-light);
    text-decoration: none;
}

.hfb-provider-card__help a:hover {
    text-decoration: underline;
}

/* Help tip below provider grid */
.hfb-provider-help-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 20px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.5;
}

.hfb-provider-help-tip svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--hfb-primary-light);
}

.hfb-provider-help-tip em {
    color: var(--hfb-text);
    font-style: italic;
}

.hfb-key-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--hfb-surface-light);
    border: 1px solid var(--hfb-border);
    border-radius: 12px;
    color: var(--hfb-text);
    font-size: 14px;
    font-family: 'Fira Code', 'Consolas', monospace;
    margin-bottom: 12px;
    transition: var(--hfb-transition);
    box-sizing: border-box;
}

.hfb-key-input:focus {
    outline: none;
    border-color: var(--hfb-primary);
    box-shadow: 0 0 0 3px var(--hfb-primary-glow);
}

.hfb-key-input::placeholder {
    color: var(--hfb-text-muted);
}

.hfb-provider-card__form-error {
    font-size: 13px;
    color: #ef4444;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
}

.hfb-provider-card__actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ── Provider Card Connected State ── */
.hfb-provider-card__connected {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--hfb-border);
}

.hfb-provider-card__connected-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.hfb-key-hint {
    font-size: 13px;
    font-family: 'Fira Code', 'Consolas', monospace;
    color: var(--hfb-text-secondary);
}

.hfb-model-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--hfb-surface-light);
    border: 1px solid var(--hfb-border);
    border-radius: 10px;
    color: var(--hfb-text);
    font-size: 14px;
    margin-bottom: 12px;
    cursor: pointer;
    appearance: auto;
}

.hfb-model-select:focus {
    outline: none;
    border-color: var(--hfb-primary);
}

/* ===================
   Personality Grid
   =================== */
.hfb-personality-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.hfb-personality-chip,
body button.hfb-personality-chip {
    padding: 10px 20px !important;
    background: var(--hfb-surface) !important;
    border: 1px solid var(--hfb-border) !important;
    border-radius: 50px !important;
    color: var(--hfb-text-secondary) !important;
    font-size: 14px !important;
    font-weight: 500;
    cursor: pointer;
    transition: var(--hfb-transition);
    min-height: 44px;
    display: inline-flex !important;
    align-items: center;
}

.hfb-personality-chip:hover,
body button.hfb-personality-chip:hover {
    border-color: var(--hfb-primary) !important;
    color: var(--hfb-primary-light) !important;
    background: var(--hfb-surface-light) !important;
}

.hfb-personality-chip.active,
body button.hfb-personality-chip.active {
    background: var(--hfb-gradient-primary) !important;
    color: white !important;
    border-color: transparent !important;
    box-shadow: 0 4px 15px var(--hfb-primary-glow);
}

.hfb-personality-loading,
.hfb-usage-loading {
    text-align: center;
    color: var(--hfb-text-muted);
    font-size: 14px;
    padding: 20px;
}

/* ===================
   Usage Tier Badge
   =================== */
.hfb-usage-tier {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.hfb-usage-tier__badge {
    display: inline-block;
    padding: 6px 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(6, 182, 212, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 50px;
    color: var(--hfb-accent);
    font-weight: 600;
    font-size: 0.9rem;
}

.hfb-usage-tier__upgrade {
    color: var(--hfb-accent);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.hfb-usage-tier__upgrade:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ===================
   Usage Grid
   =================== */
.hfb-usage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.hfb-usage-card {
    background: var(--hfb-surface);
    border: 1px solid var(--hfb-border);
    border-radius: var(--hfb-radius-sm);
    padding: 20px;
}

.hfb-usage-card__label {
    font-size: 13px;
    color: var(--hfb-text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.hfb-usage-card__value {
    font-size: 24px;
    font-weight: 700;
    color: var(--hfb-text);
    margin-bottom: 8px;
}

.hfb-usage-card__value span {
    font-size: 14px;
    color: var(--hfb-text-muted);
    font-weight: 400;
}

.hfb-usage-bar {
    height: 6px;
    background: var(--hfb-surface-light);
    border-radius: 3px;
    overflow: hidden;
}

.hfb-usage-bar__fill {
    height: 100%;
    border-radius: 3px;
    background: var(--hfb-gradient-primary);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hfb-usage-bar__fill--warning {
    background: linear-gradient(135deg, var(--hfb-orange), #ef4444);
}

/* ===================
   Account Link
   =================== */
.hfb-memory-account-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--hfb-accent, #06b6d4);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.hfb-memory-account-link:hover {
    opacity: 1;
    text-decoration: none;
    color: var(--hfb-accent, #06b6d4);
}

/* ===================
   Info Panels (collapsible)
   =================== */
.hfb-memory-info-panel {
    border: 1px solid var(--hfb-border);
    border-radius: var(--hfb-radius-lg);
    background: var(--hfb-surface);
    overflow: hidden;
}
.hfb-memory-info-panel__trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    color: var(--hfb-text);
    list-style: none;
}
.hfb-memory-info-panel__trigger::-webkit-details-marker { display: none; }
.hfb-memory-info-panel__trigger::marker { display: none; content: ''; }
.hfb-memory-info-panel__chevron {
    margin-left: auto;
    transition: transform 0.2s ease;
}
.hfb-memory-info-panel[open] .hfb-memory-info-panel__chevron {
    transform: rotate(180deg);
}
.hfb-memory-info-panel__content {
    padding: 0 20px 20px;
}
.hfb-memory-info-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.hfb-memory-info-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.hfb-memory-info-step__num {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--hfb-primary);
    color: var(--hfb-text);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hfb-memory-info-step p {
    margin: 4px 0 0;
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.5;
}
.hfb-memory-pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.hfb-memory-pricing-card {
    position: relative;
    padding: 20px;
    border-radius: var(--hfb-radius);
    border: 1px solid var(--hfb-border);
    background: var(--hfb-bg);
}
.hfb-memory-pricing-card--featured {
    border-color: var(--hfb-accent, #06b6d4);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.15);
}
.hfb-memory-pricing-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--hfb-accent, #06b6d4);
    color: #000;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.hfb-memory-pricing-card h4 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    font-weight: 700;
}
.hfb-memory-pricing-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--hfb-text);
    margin-bottom: 12px;
}
.hfb-memory-pricing-price span {
    font-size: 0.85rem;
    font-weight: 400;
    opacity: 0.6;
}
.hfb-memory-pricing-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.hfb-memory-pricing-card li {
    font-size: 0.85rem;
    padding: 4px 0;
    opacity: 0.85;
    line-height: 1.4;
}
.hfb-memory-pricing-card li::before {
    content: '✓ ';
    color: var(--hfb-accent, #06b6d4);
    font-weight: 700;
}
@media (max-width: 768px) {
    .hfb-memory-pricing-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================
   Chat View
   =================== */
.hfb-memory-chat {
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    height: calc(100vh - 80px);
    min-height: 500px;
    background: var(--hfb-surface);
    border-radius: var(--hfb-radius-lg);
    border: 1px solid var(--hfb-primary);
    box-shadow: var(--hfb-shadow-lg), var(--hfb-shadow-glow);
    overflow: hidden;
    margin: 20px auto;
}

/* ── Chat Header ── */
.hfb-memory-chat__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--hfb-border);
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(10px);
    z-index: 2;
}

.hfb-memory-back-btn,
body button.hfb-memory-back-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--hfb-border) !important;
    border-radius: 10px !important;
    background: var(--hfb-surface-light) !important;
    color: var(--hfb-text-secondary) !important;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: var(--hfb-transition);
    flex-shrink: 0;
    padding: 0 !important;
}

.hfb-memory-back-btn:hover,
body button.hfb-memory-back-btn:hover {
    border-color: var(--hfb-primary) !important;
    color: var(--hfb-primary-light) !important;
}

.hfb-memory-back-btn svg {
    stroke: currentColor;
}

/* ── Provider Dropdown ── */
.hfb-memory-provider-dropdown {
    position: relative;
    flex: 1;
    min-width: 0;
}

.hfb-memory-provider-trigger,
body button.hfb-memory-provider-trigger {
    display: flex !important;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px !important;
    background: var(--hfb-surface-light) !important;
    border: 1px solid var(--hfb-border) !important;
    border-radius: 10px !important;
    cursor: pointer;
    transition: var(--hfb-transition);
    min-height: 40px;
    text-align: left;
}

.hfb-memory-provider-trigger:hover,
body button.hfb-memory-provider-trigger:hover {
    border-color: var(--hfb-primary) !important;
}

.hfb-memory-provider-trigger__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--hfb-text);
    white-space: nowrap;
}

.hfb-memory-provider-trigger__model {
    font-size: 12px;
    color: var(--hfb-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hfb-memory-provider-trigger__chevron {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--hfb-text-muted);
    transition: transform 0.2s;
}

.hfb-memory-provider-dropdown.open .hfb-memory-provider-trigger__chevron {
    transform: rotate(180deg);
}

.hfb-memory-provider-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--hfb-surface);
    border: 1px solid var(--hfb-border-light);
    border-radius: 12px;
    box-shadow: var(--hfb-shadow-lg);
    z-index: 100;
    max-height: 400px;
    overflow-y: auto;
}

.hfb-memory-provider-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s;
    min-height: 44px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--hfb-text);
    font-size: 14px;
}

.hfb-memory-provider-option:hover {
    background: var(--hfb-surface-light);
}

.hfb-memory-provider-option.active {
    background: rgba(139, 92, 246, 0.15);
    color: var(--hfb-primary-light);
    font-weight: 600;
}

.hfb-memory-provider-option.disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

.hfb-memory-provider-option__hint {
    margin-left: auto;
    font-size: 11px;
    color: var(--hfb-text-muted);
    font-weight: 400;
}

.hfb-memory-provider-option--model {
    padding-left: 24px;
    font-size: 13px;
    min-height: 40px;
}

.hfb-memory-provider-group__header {
    padding: 8px 16px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--hfb-text-muted);
    cursor: default;
    user-select: none;
}

.hfb-memory-provider-group__header.disabled {
    opacity: 0.4;
    padding-bottom: 8px;
}

.hfb-memory-provider-group__status {
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    font-size: 11px;
}

.hfb-memory-provider-menu__divider {
    height: 1px;
    background: var(--hfb-border);
    margin: 4px 0;
}

/* ── Personality Badge ── */
.hfb-memory-personality-badge {
    flex-shrink: 0;
}

.hfb-memory-personality-badge__pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: var(--hfb-surface-light);
    border: 1px solid var(--hfb-border);
    border-radius: 50px;
    font-size: 12px;
    color: var(--hfb-text-secondary);
    white-space: nowrap;
}

/* ── Messages Area ── */
.hfb-memory-chat__messages {
    overflow-y: auto;
    overflow-x: hidden;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: linear-gradient(180deg, #1a1a2e 0%, #0f0f23 50%, #0a0a1a 100%);
    position: relative;
    min-height: 0;
}

.hfb-memory-chat__messages::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 60%;
    background: radial-gradient(ellipse, rgba(139, 92, 246, 0.04) 0%, transparent 70%);
    pointer-events: none;
}

.hfb-memory-chat__messages::-webkit-scrollbar {
    width: 6px;
}

.hfb-memory-chat__messages::-webkit-scrollbar-track {
    background: transparent;
}

.hfb-memory-chat__messages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--hfb-primary), var(--hfb-accent));
    border-radius: 10px;
}

/* Welcome screen */
.hfb-memory-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    opacity: 0.7;
}

.hfb-memory-welcome__icon {
    margin-bottom: 16px;
}

.hfb-memory-welcome h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--hfb-text);
    margin: 0 0 8px;
}

.hfb-memory-welcome p {
    font-size: 14px;
    color: var(--hfb-text-muted);
    margin: 0;
}

/* Messages — reuses .hfb-message, .hfb-typing, .hfb-error, .hfb-retry-btn classes from chat.css */

/* ── Input Area ── */
/* Input area — matches companion chat .hfb-chat-input styling */
.hfb-memory-chat__input-area {
    padding: 20px 28px;
    border-top: 2px solid var(--hfb-primary);
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.hfb-memory-chat__form {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

#hfb-memory-input {
    flex: 1;
    padding: 14px 22px;
    border: 1px solid var(--hfb-border);
    border-radius: 28px;
    font-size: 15px;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    transition: var(--hfb-transition);
    font-family: inherit;
    background: var(--hfb-surface-light);
    color: var(--hfb-text);
    box-sizing: border-box;
}

#hfb-memory-input::placeholder {
    color: var(--hfb-text-muted);
}

#hfb-memory-input:focus {
    outline: none;
    border-color: var(--hfb-primary);
    box-shadow: 0 0 0 3px var(--hfb-primary-glow), 0 0 20px var(--hfb-primary-glow);
    background: var(--hfb-surface);
}

/* Error messages — reuses .hfb-error and .hfb-retry-btn from chat.css */

/* ===================
   Login CTA (when not logged in)
   =================== */
.hfb-memory-login {
    text-align: center;
    padding: 80px 20px;
    max-width: 500px;
    margin: 0 auto;
}

.hfb-memory-login h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--hfb-text);
    margin: 0 0 12px;
}

.hfb-memory-login p {
    color: var(--hfb-text-secondary);
    margin: 0 0 24px;
}

.hfb-memory-login a {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    background: var(--hfb-gradient-primary);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: var(--hfb-transition);
}

.hfb-memory-login a:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 25px var(--hfb-primary-glow);
}

/* ===================
   Responsive — Tablet/Mobile
   =================== */
@media (max-width: 768px) {
    .hfb-memory-hero {
        padding: 40px 5% 32px;
    }

    .hfb-memory-hero__title {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
    }

    .hfb-memory-hero__subtitle {
        font-size: 1rem;
    }

    .hfb-provider-grid {
        grid-template-columns: 1fr;
    }

    .hfb-memory-section {
        padding: 0 4% 36px;
    }

    .hfb-memory-chat {
        height: calc(100vh - 60px);
        border-radius: 0;
        border: none;
        box-shadow: none;
        margin: 0;
    }

    .hfb-memory-chat__header {
        padding: 10px 14px;
        gap: 8px;
    }

    .hfb-memory-personality-badge {
        display: none;
    }

    .hfb-memory-chat__messages {
        padding: 16px;
        gap: 16px;
    }

    .hfb-memory-chat__input-area {
        padding: 14px 16px;
    }

    .hfb-memory-chat__form {
        gap: 10px;
    }

    #hfb-memory-input {
        padding: 12px 18px;
        font-size: 16px; /* Prevents iOS zoom */
    }

    .hfb-usage-grid {
        grid-template-columns: 1fr;
    }
}

/* ===================
   Responsive — Small Phone
   =================== */
@media (max-width: 480px) {
    .hfb-memory-hero {
        padding: 32px 4% 24px;
    }

    .hfb-memory-start-btn,
    body button.hfb-memory-start-btn {
        padding: 12px 24px !important;
        font-size: 15px !important;
    }

    .hfb-provider-card {
        padding: 18px;
    }

    .hfb-personality-chip,
    body button.hfb-personality-chip {
        padding: 8px 16px !important;
        font-size: 13px !important;
    }

    .hfb-memory-chat__header {
        padding: 8px 10px;
    }

    .hfb-memory-back-btn,
    body button.hfb-memory-back-btn {
        width: 36px;
        height: 36px;
    }
}

/* ═══════════════════════════════════════════
   LANDING PAGE (logged-out marketing)
   ═══════════════════════════════════════════ */

.hfb-memory-landing {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    color: var(--hfb-text);
    overflow-x: hidden;
}

/* ── Hero ── */
.hfb-memory-landing__hero {
    text-align: center;
    padding: 100px 5% 80px;
    position: relative;
    overflow: hidden;
}

.hfb-memory-landing__glow {
    position: absolute;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 900px;
    height: 600px;
    background: radial-gradient(circle, var(--hfb-primary-glow) 0%, transparent 70%);
    pointer-events: none;
    animation: memory-pulse 4s ease-in-out infinite;
}

.hfb-memory-landing__glow--2 {
    top: -100px;
    left: 30%;
    width: 600px;
    height: 400px;
    background: radial-gradient(circle, var(--hfb-accent-glow) 0%, transparent 70%);
    animation-delay: 2s;
}

.hfb-memory-landing__hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hfb-memory-landing__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--hfb-surface-light);
    border: 1px solid var(--hfb-border-light);
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 14px;
    color: var(--hfb-accent);
    margin-bottom: 28px;
    font-weight: 500;
}

.hfb-memory-landing__badge svg {
    stroke: var(--hfb-accent);
}

.hfb-memory-landing__title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.04em;
    margin: 0 0 24px;
    background: linear-gradient(135deg, var(--hfb-text) 0%, var(--hfb-primary-light) 50%, var(--hfb-accent) 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 5s ease infinite;
}

.hfb-memory-landing__subtitle {
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    color: var(--hfb-text-secondary);
    max-width: 680px;
    margin: 0 auto 36px;
    line-height: 1.7;
}

.hfb-memory-landing__ctas {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.hfb-memory-landing__btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--hfb-transition);
    min-height: 52px;
    cursor: pointer;
    border: none;
}

.hfb-memory-landing__btn--primary {
    background: var(--hfb-gradient-primary);
    color: white;
    box-shadow: 0 4px 25px var(--hfb-primary-glow);
}

.hfb-memory-landing__btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 35px var(--hfb-primary-glow);
    color: white;
}

.hfb-memory-landing__btn--secondary {
    background: var(--hfb-surface-light);
    color: var(--hfb-text-secondary);
    border: 1px solid var(--hfb-border-light);
}

.hfb-memory-landing__btn--secondary:hover {
    border-color: var(--hfb-primary);
    color: var(--hfb-text);
}

.hfb-memory-landing__btn--lg {
    padding: 18px 40px;
    font-size: 17px;
}

.hfb-memory-landing__social-proof {
    font-size: 13px;
    color: var(--hfb-text-muted);
    margin: 0;
}

/* ── Sections ── */
.hfb-memory-landing__section {
    padding: 80px 5%;
    max-width: 1100px;
    margin: 0 auto;
}

.hfb-memory-landing__section--dark {
    background: linear-gradient(180deg, rgba(10, 10, 26, 0.5) 0%, rgba(15, 15, 35, 0.3) 100%);
    max-width: 100%;
    padding-left: 5%;
    padding-right: 5%;
}

.hfb-memory-landing__section--dark > * {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

.hfb-memory-landing__section-title {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 700;
    text-align: center;
    margin: 0 0 12px;
    color: var(--hfb-text);
    letter-spacing: -0.02em;
}

.hfb-memory-landing__section-sub {
    font-size: 1.1rem;
    color: var(--hfb-text-secondary);
    text-align: center;
    margin: 0 auto 48px;
    max-width: 550px;
    line-height: 1.6;
}

/* ── Problems ── */
.hfb-memory-landing__problems {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.hfb-memory-landing__problem {
    background: var(--hfb-surface);
    border: 1px solid var(--hfb-border);
    border-radius: var(--hfb-radius);
    padding: 28px;
    transition: var(--hfb-transition);
}

.hfb-memory-landing__problem:hover {
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.1);
}

.hfb-memory-landing__problem-icon {
    margin-bottom: 16px;
}

.hfb-memory-landing__problem h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--hfb-text);
}

.hfb-memory-landing__problem p {
    font-size: 14px;
    color: var(--hfb-text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* Technology section: cyan hover instead of red */
.hfb-memory-landing__tech .hfb-memory-landing__problem:hover {
    border-color: rgba(0, 207, 253, 0.3);
    box-shadow: 0 0 30px rgba(0, 207, 253, 0.1);
}

/* ── Features ── */
.hfb-memory-landing__features {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}

.hfb-memory-landing__feature {
    background: var(--hfb-surface);
    border: 1px solid var(--hfb-border);
    border-radius: var(--hfb-radius);
    padding: 28px;
    transition: var(--hfb-transition);
}

.hfb-memory-landing__feature:hover {
    border-color: var(--hfb-border-light);
    transform: translateY(-2px);
    box-shadow: var(--hfb-shadow);
}

.hfb-memory-landing__feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--hfb-surface-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.hfb-memory-landing__feature h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--hfb-text);
}

.hfb-memory-landing__feature p {
    font-size: 14px;
    color: var(--hfb-text-secondary);
    margin: 0;
    line-height: 1.6;
}

/* ── How It Works Steps ── */
.hfb-memory-landing__steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
}

.hfb-memory-landing__step {
    flex: 1;
    max-width: 280px;
    text-align: center;
    padding: 24px;
}

.hfb-memory-landing__step-num {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--hfb-gradient-primary);
    color: white;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 4px 20px var(--hfb-primary-glow);
}

.hfb-memory-landing__step h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--hfb-text);
}

.hfb-memory-landing__step p {
    font-size: 14px;
    color: var(--hfb-text-secondary);
    margin: 0;
    line-height: 1.6;
}

.hfb-memory-landing__step-arrow {
    display: flex;
    align-items: center;
    padding-top: 36px;
    flex-shrink: 0;
}

/* ── Pricing Cards ── */
.hfb-memory-landing__pricing {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    max-width: 960px;
    margin: 0 auto;
}

.hfb-memory-landing__price-card {
    background: var(--hfb-surface);
    border: 1px solid var(--hfb-border);
    border-radius: var(--hfb-radius);
    padding: 32px 28px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: var(--hfb-transition);
}

.hfb-memory-landing__price-card:hover {
    border-color: var(--hfb-border-light);
    box-shadow: var(--hfb-shadow);
}

.hfb-memory-landing__price-card--featured {
    border-color: var(--hfb-primary);
    box-shadow: 0 0 40px var(--hfb-primary-glow);
    transform: scale(1.03);
}

.hfb-memory-landing__price-card--featured:hover {
    border-color: var(--hfb-primary-light);
    box-shadow: 0 0 50px var(--hfb-primary-glow);
    transform: scale(1.04);
}

.hfb-memory-landing__price-popular {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--hfb-gradient-primary);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 20px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.hfb-memory-landing__price-header h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--hfb-text);
}

.hfb-memory-landing__price {
    font-size: 40px;
    font-weight: 800;
    color: var(--hfb-text);
    margin-bottom: 24px;
    letter-spacing: -0.03em;
}

.hfb-memory-landing__price span {
    font-size: 16px;
    font-weight: 400;
    color: var(--hfb-text-muted);
}

.hfb-memory-landing__price-features {
    list-style: none;
    padding: 0;
    margin: 0 0 28px;
    flex: 1;
}

.hfb-memory-landing__price-features li {
    padding: 8px 0 8px 28px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    color: var(--hfb-text-secondary);
}

.hfb-memory-landing__price-features li.included::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='3'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.hfb-memory-landing__price-features li.excluded {
    color: var(--hfb-text-muted);
    opacity: 0.5;
}

.hfb-memory-landing__price-features li.excluded::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 14px;
    width: 12px;
    height: 2px;
    background: var(--hfb-text-muted);
    border-radius: 1px;
}

.hfb-memory-landing__price-btn {
    display: block;
    text-align: center;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--hfb-transition);
    min-height: 48px;
    background: var(--hfb-surface-light);
    color: var(--hfb-text);
    border: 1px solid var(--hfb-border-light);
}

.hfb-memory-landing__price-btn:hover {
    background: var(--hfb-surface-hover);
    border-color: var(--hfb-primary);
    color: var(--hfb-text);
}

.hfb-memory-landing__price-btn--primary {
    background: var(--hfb-gradient-primary);
    color: white;
    border: none;
    box-shadow: 0 4px 20px var(--hfb-primary-glow);
}

.hfb-memory-landing__price-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 30px var(--hfb-primary-glow);
    color: white;
}

.hfb-memory-landing__pricing-note {
    text-align: center;
    font-size: 13px;
    color: var(--hfb-text-muted);
    margin-top: 24px;
}

/* ── Final CTA ── */
.hfb-memory-landing__cta-section {
    text-align: center;
    padding-top: 100px;
    padding-bottom: 100px;
}

.hfb-memory-landing__login-link {
    font-size: 14px;
    color: var(--hfb-text-muted);
    margin-top: 16px;
}

.hfb-memory-landing__login-link a {
    color: var(--hfb-primary-light);
    text-decoration: none;
}

.hfb-memory-landing__login-link a:hover {
    text-decoration: underline;
}

/* ── Landing Page Responsive ── */
@media (max-width: 768px) {
    .hfb-memory-landing__hero {
        padding: 60px 5% 50px;
    }

    .hfb-memory-landing__section {
        padding: 60px 5%;
    }

    .hfb-memory-landing__steps {
        flex-direction: column;
        align-items: center;
    }

    .hfb-memory-landing__step {
        max-width: 400px;
    }

    .hfb-memory-landing__step-arrow {
        transform: rotate(90deg);
        padding-top: 0;
    }

    .hfb-memory-landing__price-card--featured {
        transform: none;
    }

    .hfb-memory-landing__price-card--featured:hover {
        transform: none;
    }

    .hfb-memory-landing__pricing {
        grid-template-columns: 1fr;
        max-width: 400px;
    }

    .hfb-memory-landing__cta-section {
        padding-top: 60px;
        padding-bottom: 60px;
    }
}

@media (max-width: 480px) {
    .hfb-memory-landing__hero {
        padding: 40px 4% 36px;
    }

    .hfb-memory-landing__btn {
        padding: 14px 24px;
        font-size: 15px;
        width: 100%;
        justify-content: center;
    }

    .hfb-memory-landing__ctas {
        flex-direction: column;
        align-items: stretch;
    }

    .hfb-memory-landing__problems,
    .hfb-memory-landing__features {
        grid-template-columns: 1fr;
    }

    .hfb-memory-landing__section {
        padding: 48px 4%;
    }
}
