/* Growth surfaces: share dialogs, the Grow panel and the dashboard strip.
   Built on the app's theme tokens so light and dark mode both work. */

.growth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.growth-btn:hover { border-color: var(--primary-400); }
.growth-btn:active { transform: translateY(1px); }
.growth-btn:disabled { opacity: 0.6; cursor: progress; }
.growth-btn:focus-visible { outline: 2px solid var(--primary-400); outline-offset: 2px; }

.growth-btn-primary {
    background: var(--primary-600);
    border-color: var(--primary-600);
    color: #fff;
}

/* In dark mode --primary-600 becomes a pale slate, which white text cannot sit on.
   Follow the app's own dark primary button: accent fill, dark text. */
[data-theme="dark"] .growth-btn-primary {
    background: var(--accent-500);
    border-color: var(--accent-500);
    color: #111827;
}

/* WhatsApp's own green, darkened to pass contrast with white text. */
.growth-btn-whatsapp {
    background: #128c4a;
    border-color: #128c4a;
    color: #fff;
}

.growth-btn-whatsapp:hover { background: #0f7a40; border-color: #0f7a40; }

.growth-muted { color: var(--text-secondary); font-size: 13.5px; line-height: 1.5; }

.growth-field-label {
    display: block;
    margin: 14px 0 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.growth-field-input {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    font: inherit;
    font-size: 15px;
}

.growth-field-input:focus-visible { outline: 2px solid var(--primary-400); outline-offset: 1px; }
.growth-field-narrow { width: auto; flex: 0 0 auto; }
.growth-field-hint { margin-top: 6px; font-size: 12.5px; color: var(--text-tertiary); }

.growth-share-intro { color: var(--text-secondary); font-size: 14px; line-height: 1.5; }
.growth-share-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
/* Order matters: both selectors have equal specificity, so the primary action's
   full-width rule has to come after the generic one. */
.growth-share-actions .growth-btn { flex: 1 1 0; }
.growth-share-actions .growth-btn-whatsapp { flex: 1 1 100%; min-height: 46px; font-size: 15px; }

.growth-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.growth-inline .growth-field-input { flex: 1 1 160px; width: auto; }

.growth-panel { display: grid; gap: 18px; }

.growth-section {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.growth-section h3 { margin: 0 0 4px; font-size: 16px; color: var(--text-primary); }

.growth-code {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.growth-code > div { display: grid; margin-right: auto; }
.growth-code strong { font-size: 26px; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; color: var(--text-primary); }

.growth-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
    gap: 10px;
    margin: 14px 0 4px;
}

.growth-stats > div {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--background);
}

.growth-stats strong { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-primary); }
.growth-stats span { font-size: 12px; color: var(--text-secondary); }

.growth-list { list-style: none; margin: 14px 0 0; padding: 0; }

.growth-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border-light);
    font-size: 14px;
    color: var(--text-primary);
}

.growth-list .growth-empty { color: var(--text-tertiary); justify-content: flex-start; }
.growth-link { color: var(--primary-400); font-weight: 600; text-decoration: none; }

.growth-pill {
    flex: none;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--background);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.growth-pill[data-status="qualified"] { background: var(--warning-100); color: var(--warning-700); }
.growth-pill[data-status="rewarded"] { background: var(--success-100); color: var(--success-700); }

.growth-check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-primary); cursor: pointer; }
.growth-check input { width: 18px; height: 18px; }

/* Dashboard strip */
.growth-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.growth-strip[hidden] { display: none; }

.growth-strip-close {
    flex: none;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.growth-strip-close:hover { background: var(--background); color: var(--text-primary); }
.growth-strip-close:focus-visible { outline: 2px solid var(--primary-400); outline-offset: 2px; }

.growth-settings-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.growth-settings-card h3 { margin: 0 0 4px; }
.growth-strip-text { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }

/* Signup: referral code feedback */
#regReferralCodeStatus { min-height: 18px; margin-top: 6px; font-size: 12.5px; }
#regReferralCodeStatus[data-state="valid"] { color: var(--success-600); }
#regReferralCodeStatus[data-state="invalid"] { color: var(--warning-600); }

@media (max-width: 520px) {
    /* One compact row on phones: this sits above the owner's working dashboard. */
    .growth-strip { gap: 8px; padding: 8px 8px 8px 12px; margin-bottom: 12px; }
    .growth-strip-text { font-size: 13px; line-height: 1.35; }
    .growth-strip .growth-btn { flex: none; min-height: 38px; padding: 0 14px; }
    .growth-code .growth-btn { flex: 1 1 100%; }
}

/* The public demo shop: a bar on every screen with the way to a shop of their own */
.demo-shop-bar {
    position: fixed;
    left: 50%;
    /* --demo-bar-bottom is the height of the phone's bottom navigation, set by growth.js */
    bottom: calc(var(--demo-bar-bottom, 0px) + 16px);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 14px;
    max-width: calc(100vw - 24px);
    padding: 8px 8px 8px 18px;
    border-radius: 999px;
    background: #1a3862;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.3);
    transform: translateX(-50%);
}

.demo-shop-bar .growth-btn { flex: none; min-height: 38px; padding: 0 16px; border-radius: 999px; }
.demo-shop-bar-short { display: none; }
.demo-shop-bar-close {
    flex: none;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

/* Demo visitors share one shop: the customer support group and the set-up checklist are not theirs
   (its buttons change shop settings, which the demo blocks). */
body.demo-shop-session #whatsappBannerDashboard,
body.demo-shop-session #onboardingChecklistPanel { display: none !important; }

/* Room at the bottom of every screen, so the bar never hides the last rows or buttons */
body.demo-shop-active .main-content { padding-bottom: calc(var(--demo-bar-space, 64px) + 24px) !important; }

@media (max-width: 768px) {
    /* Phones and tablets: the bottom navigation needs its 80px, plus the bar above it */
    body.demo-shop-active .main-content {
        padding-bottom: calc(80px + var(--demo-bar-space, 56px) + env(safe-area-inset-bottom)) !important;
    }
}

@media (max-width: 640px) {
    /* One slim line just above the bottom navigation */
    .demo-shop-bar {
        left: 8px;
        right: 8px;
        bottom: calc(var(--demo-bar-bottom, 0px) + 6px);
        justify-content: space-between;
        gap: 8px;
        max-width: none;
        padding: 6px 6px 6px 12px;
        border-radius: 12px;
        font-size: 13px;
        transform: none;
    }
    .demo-shop-bar-long { display: none; }
    .demo-shop-bar-short { display: inline; }
    .demo-shop-bar .growth-btn { min-height: 34px; padding: 0 12px; font-size: 13px; }
    .demo-shop-bar-close { width: 30px; height: 30px; }
}
