/* ============================================
File: app/static/css/main.css
Description:
  Core styles for Quite/ContactFlow web UI.
  - Responsive layout, navbar, hero, cards
  - Landing sections: how-it-works, features, CTA
  - Dashboard grids and common components
  - Storyboard page support
  - Footer with Rootwork AI block

Notes (2026-01 Unified Presentment Pass):
  - Removes duplicate/competing "add-on" styles that redefined core classes.
  - Keeps a single token system: --primary, --muted, etc.
  - Ensures updated index.html classes are fully styled (hero-layout, preview-card, steps-grid, etc.)
=============================================== */

/* ---- Design tokens ---- */
:root {
    --bg: #ffffff;
    --bg-muted: #f6f7fb;
    --text: #0f172a;
    --muted: #64748b;
    --border: rgba(15, 23, 42, 0.12);
    --shadow: 0 10px 30px rgba(2, 6, 23, 0.08);

    --primary: #2563eb;
    --primary-700: #1d4ed8;
    --primary-50: #eff6ff;

    --card: #ffffff;
    --radius: 16px;

    --container: 1120px;
    --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";

    /* Forward-friendly */
    --focus-ring: 0 0 0 4px rgba(37, 99, 235, 0.16);
    --focus-border: rgba(37, 99, 235, 0.55);
}

/* ---- Base ---- */
* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

/* Forward-friendly: visible keyboard focus without wrecking mouse UX */
:focus {
    outline: none;
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: 10px;
}

/* Links */
a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Images (global)
   Note: keep display:block to prevent baseline misalignment, and ensure responsive rendering.
*/
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Prevent broken-image alt text from "painting" inside circular avatars (fixes screenshot issue).
   This is intentionally scoped to avatar-class images so we don't hide meaningful alt text elsewhere. */
.nav-avatar,
.avatar-img {
    display: block;
    background: rgba(2, 6, 23, 0.04);
    color: transparent;
    /* hides broken-image alt text */
    text-indent: -9999px;
    /* extra safety */
    overflow: hidden;
}

.muted {
    color: var(--muted);
}

.dot-sep {
    margin: 0 8px;
    color: var(--muted);
}

/* ---- Container ---- */
.container {
    width: 100%;
    max-width: var(--container);
    padding: 0 18px;
    margin: 0 auto;
}

/* ---- Buttons ---- */
.btn,
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 12px;
    padding: 10px 14px;
    border: 1px solid transparent;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    text-decoration: none !important;
    transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary,
.btn.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-700);
}

.btn-secondary,
.btn.btn-secondary {
    background: #eef2ff;
    color: #1e293b;
    border-color: rgba(37, 99, 235, 0.18);
}

.btn-secondary:hover {
    background: #e0e7ff;
}

.btn-outline,
.btn.btn-outline {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: #f8fafc;
}

.btn-large {
    padding: 12px 16px;
    border-radius: 14px;
}

.btn-small,
.btn.btn-small {
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
}

/* ---- Inputs (forward-friendly shared class) ---- */
.input {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}

.input:focus,
.input:focus-visible {
    outline: none;
    border-color: var(--focus-border);
    box-shadow: var(--focus-ring);
}

textarea.input {
    resize: vertical;
}

/* ---- Navbar ---- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.nav-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none !important;
    font-weight: 800;
}

.logo {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    background: var(--primary-50);
    transform: scale(3);
    transform-origin: left center;
    position: relative;
    z-index: 10;
}

.brand-name {
    font-size: 16px;
    letter-spacing: 0.2px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-link {
    color: var(--text);
    font-weight: 600;
    text-decoration: none !important;
    padding: 8px 10px;
    border-radius: 10px;
}

.nav-link:hover {
    background: rgba(2, 6, 23, 0.04);
}

.nav-link.btn-primary {
    background: var(--primary);
    color: #fff;
    padding: 10px 12px;
}

.nav-link.btn-primary:hover {
    background: var(--primary-700);
}

.nav-toggle {
    display: none;
    width: 42px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--border);
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    background: #fff;
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: #111827;
    border-radius: 999px;
}

/* Dropdown */
.nav-dropdown {
    position: relative;
}

/* Forward fix: ensure avatar + Account aligns properly and doesn't "float" */
.dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    line-height: 1;
    /* reduces vertical drift */
}

/* Avatar (nav) — slightly larger + consistent shape */
.nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    object-fit: cover;
    border: 1px solid var(--border);
    flex: 0 0 auto;
}

/* If you ever show long emails in nav, avoid layout blow-ups */
.nav-username {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 42px;
    min-width: 180px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 8px;
    display: none;
}

.nav-dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 10px 10px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none !important;
    background: transparent;
    width: 100%;
    text-align: left;
    font: inherit;
    border: none;
    cursor: pointer;
}

.dropdown-item:hover {
    background: rgba(2, 6, 23, 0.04);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 2px;
}

/* ---- Hero ---- */
.hero-section {
    padding: 42px 0 26px;
}

.hero-section--landing {
    padding-top: 36px;
}

.hero-kicker {
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.2px;
    margin-bottom: 10px;
}

.hero-title {
    font-size: 44px;
    line-height: 1.08;
    margin: 0 0 12px;
}

.brand-text {
    color: var(--primary);
}

.hero-subtitle {
    margin: 0 0 18px;
    color: #334155;
    font-size: 16px;
    max-width: 64ch;
}

.hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.hero-trust {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.trust-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
}

.trust-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.35);
}

/* Hero layout: text + preview card */
.hero-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 22px;
    align-items: start;
}

.preview-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.preview-title {
    font-weight: 800;
    color: var(--text);
}

.preview-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pill {
    font-size: 12px;
    font-weight: 700;
    background: rgba(37, 99, 235, 0.08);
    color: #1e3a8a;
    border: 1px solid rgba(37, 99, 235, 0.18);
    padding: 5px 8px;
    border-radius: 999px;
}

.preview-body {
    display: grid;
    gap: 10px;
}

.preview-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
    padding: 10px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.preview-label {
    font-weight: 800;
    color: #0f172a;
}

.preview-value {
    color: #334155;
}

.preview-footer {
    margin-top: 12px;
}

/* ---- Sections ---- */
.section {
    padding: 34px 0;
}

.section--muted {
    background: var(--bg-muted);
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.section-head {
    margin-bottom: 16px;
}

.section-head h2 {
    margin: 0 0 6px;
    font-size: 26px;
}

.section-subtitle {
    margin: 0;
    color: var(--muted);
    font-weight: 600;
}

.section-cta-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

/* How it works */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 16px;
}

.step-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 10px 22px rgba(2, 6, 23, 0.04);
}

.step-top {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(37, 99, 235, 0.12);
    color: #1e3a8a;
    font-weight: 900;
}

.step-title {
    font-weight: 900;
}

.step-desc {
    margin: 0;
    color: #334155;
}

/* Features */
.features-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 16px;
}

.features-grid--tight {
    grid-template-columns: repeat(4, 1fr);
}

.feature-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 10px 22px rgba(2, 6, 23, 0.04);
}

.feature-icon {
    font-size: 18px;
}

.feature-card h3 {
    margin: 8px 0 6px;
    font-size: 16px;
}

.feature-card p {
    margin: 0;
    color: #334155;
}

/* ---- Dashboard ---- */
.hero-section--dashboard {
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.08), rgba(37, 99, 235, 0.00));
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.hero-content--dashboard .hero-title {
    font-size: 34px;
}

.hero-actions--dashboard {
    margin-top: 12px;
}

.hero-badges {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.member-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 10px;
}

.badge-image {
    width: 22px;
    height: 22px;
}

.badge-level {
    font-weight: 800;
    color: #0f172a;
    font-size: 13px;
}

.dashboard-section {
    padding: 22px 0 40px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.dashboard-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 22px rgba(2, 6, 23, 0.04);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.card-header h3 {
    margin: 0;
    font-size: 16px;
}

.card-content {
    padding: 14px 16px;
}

.card-hint {
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 10px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12px;
    background: rgba(37, 99, 235, 0.12);
    color: #1e3a8a;
    border: 1px solid rgba(37, 99, 235, 0.18);
}

.text-link {
    color: var(--primary);
    font-weight: 700;
}

.initiative-list,
.followup-list,
.activity-feed {
    display: grid;
    gap: 10px;
}

.initiative-row,
.initiative-item {
    display: block;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 10px 22px rgba(2, 6, 23, 0.03);
    text-decoration: none !important;
    color: var(--text);
}

.initiative-row:hover,
.initiative-item:hover {
    border-color: rgba(37, 99, 235, 0.28);
    background: rgba(37, 99, 235, 0.03);
}

.initiative-title {
    font-weight: 900;
    margin-bottom: 4px;
}

.initiative-meta {
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
}

.chip {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    background: rgba(2, 6, 23, 0.04);
    border: 1px solid rgba(2, 6, 23, 0.06);
    color: #0f172a;
}

.followup-item {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    padding: 12px;
}

.followup-title {
    font-weight: 900;
}

.followup-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.activity-item {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 14px;
    padding: 12px;
}

.activity-title {
    font-weight: 900;
    margin-bottom: 6px;
}

.activity-body {
    color: #334155;
}

.activity-meta {
    margin-top: 8px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #fff;
    color: var(--text);
    font-weight: 800;
    text-decoration: none !important;
}

.quick-action:hover {
    border-color: rgba(37, 99, 235, 0.28);
    background: rgba(37, 99, 235, 0.03);
}

.action-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.10);
}

.quick-links {
    margin-top: 12px;
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
}

/* ---- CTA Section ---- */
.cta-section {
    padding: 42px 0;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.06), rgba(37, 99, 235, 0.00));
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.cta-content {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
}

.cta-content h2 {
    margin: 0 0 8px;
}

.cta-content p {
    margin: 0 0 12px;
    color: #334155;
}

.cta-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.cta-note {
    margin-top: 10px;
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
}

/* ---- Modal (used in storyboard) ---- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 9999;
}

.modal-content {
    width: 100%;
    max-width: 560px;
    background: #fff;
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.modal-close {
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
}

.modal-body {
    padding: 14px 16px;
}

.modal-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ---- Contacts modal (modal-card + backdrop) ---- */
#create-contact-modal.modal {
    background: transparent;
    /* use the dedicated backdrop element */
    display: block;
    /* you toggle via inline style display:none/block */
    padding: 0;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(2px);
}

.modal-card {
    position: fixed;
    left: 50%;
    top: 64px;
    transform: translateX(-50%);
    width: min(980px, calc(100% - 32px));
    /* key: friendly width */
    max-height: calc(100vh - 120px);
    overflow: auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 12px;
}

label {
    display: block;
    font-weight: 800;
    font-size: 13px;
    margin-bottom: 6px;
}

/* Preserve existing input/textarea styling for legacy pages;
   .input class is now the forward path. */
input,
textarea {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.14);
    padding: 10px 12px;
    font: inherit;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--focus-border);
    box-shadow: var(--focus-ring);
}

/* ---- Footer ---- */
.footer {
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    padding: 26px 0;
    background: #fff;
}

.footer-content {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 1fr;
    gap: 14px;
}

.footer-section h4,
.footer-section h5 {
    margin: 0 0 8px;
}

.footer-section p {
    margin: 0;
    color: #334155;
}

.footer-section a {
    display: block;
    margin: 6px 0;
    font-weight: 700;
    color: #0f172a;
}

.footer-section a:hover {
    color: var(--primary);
}

.footer-bottom {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    color: var(--muted);
    font-weight: 700;
    font-size: 13px;
}

/* ---- Responsive ---- */
@media (max-width: 980px) {
    .hero-layout {
        grid-template-columns: 1fr;
    }

    .features-grid,
    .features-grid--tight {
        grid-template-columns: repeat(2, 1fr);
    }

    .steps-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .hero-title {
        font-size: 34px;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .nav-menu {
        position: absolute;
        left: 0;
        right: 0;
        top: 58px;
        background: rgba(255, 255, 255, 0.98);
        border-bottom: 1px solid var(--border);
        padding: 10px 18px;
        display: none;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .nav-menu.open {
        display: flex;
    }

    .dropdown-menu {
        right: 0;
    }
}

/* Tags */
.tag-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.18);
    color: #1e3a8a;
    margin-right: 6px;
    margin-bottom: 4px;
}

/* ---- Forward-friendly: reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    * {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}