/* FloCard — app-specific layout only.
 * The FloForge design system (ffl.css) provides the reset, base typography,
 * theme tokens, buttons, cards, inputs and the auth card. Everything here uses
 * --ffl-* tokens exclusively — no hardcoded colours, fonts, or brand values. */

/* ─── Auth screen extras (on top of .ffl-auth-wrap/.ffl-auth-card) ─── */
.fc-auth-logo {
    font-size: var(--ffl-text-2xl);
    margin-bottom: 0.25rem;
}
.fc-auth-tagline {
    margin-bottom: 1.5rem;
    font-size: var(--ffl-text-base);
}
.fc-field {
    display: block;
    margin-bottom: 0.875rem;
}
.fc-field .ffl-label {
    display: block;
    margin-bottom: 0.3rem;
}
.fc-hint {
    margin: -0.5rem 0 0.875rem;
    font-size: var(--ffl-text-xs);
}
.fc-auth-error {
    margin: 0 0 0.875rem;
    color: var(--ffl-accent);
    font-size: var(--ffl-text-sm);
}
.fc-auth-submit {
    width: 100%;
    justify-content: center;
}

/* ─── App shell ─────────────────────────────────────────────────── */
.fc-topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    padding-top: max(0.75rem, env(safe-area-inset-top));
    background: var(--ffl-panel);
    border-bottom: 1px solid var(--ffl-line);
}
.fc-brand {
    font-size: var(--ffl-text-xl);
    text-decoration: none;
}
.fc-brand:hover {
    text-decoration: none;
    opacity: 1;
}
/* "Lock" button in the Vault view header sits to the right */
.fc-vault-lock {
    margin-left: auto;
}

/* ─── Burger + off-canvas drawer nav ────────────────────────────── */
.fc-burger {
    background: none;
    border: none;
    color: var(--ffl-ink); /* contrasts with the panel top bar in both themes */
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    flex-shrink: 0;
}
/* Search lives in the sticky top bar (Home only) */
.fc-topbar-search {
    flex: 1;
    min-width: 0;
}
.fc-burger-dark {
    color: var(--ffl-sb-text);
    font-size: 1.25rem;
}
.fc-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 30;
}
.fc-drawer-nav {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: min(82vw, 280px);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 31;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    overflow-y: auto;
    padding-top: max(0.75rem, env(safe-area-inset-top));
}
.fc-drawer-nav.open {
    transform: translateX(0);
}
.fc-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding: 0.25rem;
}
.fc-drawer-foot {
    margin-top: auto;
    border-top: 1px solid var(--ffl-sb-border);
    padding-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.fc-main {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem 1rem 4rem;
}
.fc-loading,
.fc-empty {
    text-align: center;
    padding: 2.5rem 0;
}

/* ─── View header: title + primary action, left-aligned ─────────── */
.fc-view-head {
    display: flex;
    align-items: baseline;
    gap: 0.875rem;
    margin: 0.25rem 0 1rem;
}
.fc-title {
    font-size: var(--ffl-text-2xl);
}

/* Muted text action (New category / Add field) — accent on hover, never a
 * loud filled button, never top-right. */
.fc-action-link {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: var(--ffl-text-sm);
    font-weight: 600;
    color: var(--ffl-muted);
    cursor: pointer;
    transition: color var(--ffl-trans);
}
.fc-action-link:hover {
    color: var(--ffl-accent);
}
.fc-add-field {
    margin: 0.4rem 0 0.1rem;
}

/* ─── Accordion sections + quick-jump chips (Home) ──────────────── */
.fc-acc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    /* Buttons don't inherit text colour by default — without this the heading
       inside renders in the UA's dark button colour (dark-on-dark in dark mode). */
    color: inherit;
    text-align: left;
    padding: 0.45rem 0.5rem 0.55rem;
}
.fc-acc-chevron {
    color: var(--ffl-muted);
    flex-shrink: 0;
    transition: transform 0.15s ease;
}
.fc-accordion.collapsed .fc-acc-chevron {
    transform: rotate(-90deg);
}
.fc-accordion.collapsed .fc-acc-body {
    display: none;
}
.fc-acc-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.fc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.fc-chip {
    cursor: pointer;
}
.fc-acc-all {
    display: flex;
    gap: 0.75rem;
}

/* ─── Category cards ────────────────────────────────────────────── */
.fc-category {
    padding: 0.5rem 0.5rem 0.65rem;
    margin-bottom: 1rem;
}
.fc-cat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem 0.5rem;
}
.fc-cat-name {
    font-size: var(--ffl-text-lg);
    font-weight: 700;
}
.fc-cat-actions {
    display: flex;
    gap: 0.1rem;
    flex-shrink: 0;
}
.fc-cat-edit {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
}
.fc-cat-edit .ffl-input {
    flex: 1;
}

/* Square icon buttons with adequate touch targets (override .ffl-btn-ghost) */
.fc-icon {
    justify-content: center;
    min-width: 2.2rem;
    min-height: 2.2rem;
    padding: 0.35rem;
    border-color: transparent;
    font-size: var(--ffl-text-base);
    line-height: 1;
}

/* Theme toggle as an icon-only square button (universally understood) */
.fc-theme-toggle {
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    font-size: var(--ffl-text-lg);
}

/* ─── Field rows ────────────────────────────────────────────────── */
.fc-fields {
    display: flex;
    flex-direction: column;
}
.fc-field-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-top: 1px solid var(--ffl-line);
}
.fc-field-main {
    flex: 1;
    min-width: 0;
}
.fc-field-label {
    display: block;
    margin-bottom: 0.1rem;
}
.fc-value {
    display: block;
    font-size: var(--ffl-text-base);
    color: var(--ffl-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fc-value-empty {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.1rem 0;
    font-family: inherit;
    font-size: var(--ffl-text-base);
    color: var(--ffl-muted);
    font-style: italic;
    cursor: pointer;
}
/* Tap the value itself to copy (frontend) */
.fc-copyable {
    cursor: pointer;
}
.fc-copyable:active {
    color: var(--ffl-accent);
}
.fc-field-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}
/* Primary copy affordance — icon + text, touch-friendly on mobile & desktop. */
.fc-copy {
    min-height: 2.4rem;
    padding: 0.45rem 0.9rem;
    font-size: var(--ffl-text-sm);
    font-weight: 600;
}

/* Field picker grouping (Cards) */
.fc-avail-cat {
    margin-top: 0.5rem;
}
.fc-avail-cat-name {
    display: block;
    margin: 0.4rem 0 0.1rem;
}

/* ─── Entities (sub-headings inside a section) ───────────────────── */
.fc-entity {
    border-top: 1px solid var(--ffl-line);
    margin-top: 0.4rem;
    padding: 0.3rem 0.25rem 0.25rem;
}
.fc-entity-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.25rem 0.25rem 0.35rem;
}
.fc-entity-name {
    font-weight: 700;
    font-size: var(--ffl-text-base);
}
.fc-entity-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.75rem;
    margin: 0.4rem 0;
}

/* ─── Inline field editor (Admin auto-save) ─────────────────────── */
.fc-fe {
    padding: 0.4rem 0.5rem;
    border-top: 1px solid var(--ffl-line);
}
.fc-fe-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.fc-fe-label {
    flex: 1;
    min-width: 0;
    font-weight: 600;
}
.fc-fe-val {
    margin-top: 0.35rem;
}
.fc-fe-opts {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}
.fc-fe-opt {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-width: 140px;
}
/* Section/entity name inputs read as headings until focused */
.fc-sec-name,
.fc-ent-name {
    flex: 1;
    min-width: 0;
    border-color: transparent;
    background: transparent;
    font-weight: 700;
    font-family: "Barlow Condensed", sans-serif;
}
.fc-sec-name {
    font-size: var(--ffl-text-lg);
    letter-spacing: 0.01em;
}
.fc-sec-name:focus,
.fc-ent-name:focus {
    border-color: var(--ffl-focus);
    background: var(--ffl-bg);
}

/* ─── Inline forms ──────────────────────────────────────────────── */
.fc-cat-form {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-bottom: 1rem;
}
.fc-field-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.625rem 0.5rem;
    border-top: 1px solid var(--ffl-line);
}
.fc-form-actions {
    display: flex;
    gap: 0.5rem;
}

/* ─── Admin: add actions, group form, drawers ───────────────────── */
.fc-add-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0.4rem 0 0.1rem;
}
.fc-value-multi {
    white-space: pre-wrap;
    overflow: visible;
}
.fc-opt {
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    color: var(--ffl-done);
}
.fc-group-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.625rem 0.5rem;
    border-top: 1px solid var(--ffl-line);
}

/* A repeatable structured item (e.g. an address) */
.fc-drawer {
    padding: 0.5rem;
    border-top: 1px solid var(--ffl-line);
}
.fc-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.fc-drawer-title {
    font-weight: 700;
    font-size: var(--ffl-text-base);
}
/* Subsection accordion: the heading toggles; "Copy all" stays put alongside. */
.fc-ent-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    color: inherit;
    padding: 0.15rem 0;
}
.fc-ent-accordion.collapsed .fc-ent-toggle .fc-acc-chevron {
    transform: rotate(-90deg);
}
.fc-ent-accordion.collapsed .fc-ent-body {
    display: none;
}
.fc-drawer-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.35rem;
    padding-left: 0.25rem;
}
.fc-drawer-line {
    display: flex;
    flex-direction: column;
}

/* Frontend: a copyable address line (label/value + its own Copy button) */
.fc-addr-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
}
.fc-addr-line .fc-field-main {
    flex: 1;
    min-width: 0;
}
.fc-copy-sm {
    min-height: 2rem;
    padding: 0.3rem 0.6rem;
    font-size: var(--ffl-text-xs);
}

/* ─── Search bar (frontend) ─────────────────────────────────────── */
.fc-search-bar {
    position: sticky;
    top: 0;
    z-index: 4;
    max-width: 720px;
    margin: 0 auto;
    padding: 0.75rem 1rem 0.25rem;
    background: var(--ffl-bg);
}
.fc-search {
    width: 100%;
}

/* ─── Auth switch / multi-user bits ─────────────────────────────── */
.fc-auth-switch {
    margin-top: 0.875rem;
    text-align: center;
    font-size: var(--ffl-text-sm);
}
.fc-admin-notice {
    display: block;
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
    background: var(--ffl-accent-soft);
    color: var(--ffl-link);
    font-weight: 600;
    border: 1px solid var(--ffl-accent);
}
.fc-pending-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.6rem 0;
    border-top: 1px solid var(--ffl-line);
}

/* ─── Publish toggles ───────────────────────────────────────────── */
.fc-pubtoggle {
    background: none;
    border: 1px solid var(--ffl-line);
    color: var(--ffl-muted);
    border-radius: var(--ffl-r-pill);
    padding: 0.2rem 0.75rem;
    font-size: var(--ffl-text-xs);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
}
.fc-pubtoggle.on {
    background: var(--ffl-blue-soft);
    border-color: var(--ffl-blue);
    color: var(--ffl-blue-text);
}
.fc-pub-name {
    flex: 1;
    min-width: 0;
    font-size: var(--ffl-text-base);
}

/* ─── Settings cards ────────────────────────────────────────────── */
.fc-settings-card {
    margin-bottom: 1rem;
    padding: 1.25rem;
}
.fc-settings-card .fc-cat-name {
    margin-bottom: 0.5rem;
}
.fc-settings-note {
    margin-bottom: 0.875rem;
}
.fc-settings-status {
    margin-left: 0.6rem;
    font-size: var(--ffl-text-sm);
}

/* ─── Cards builder ─────────────────────────────────────────────── */
.fc-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.fc-card-row-main {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.fc-card-row-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.fc-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 0.75rem;
    font-size: var(--ffl-text-sm);
    cursor: pointer;
}
.fc-block-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.5rem;
}
.fc-block-item {
    border-top: 1px solid var(--ffl-line);
    padding-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.fc-vr {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.fc-add-block {
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.fc-editor-save {
    position: sticky;
    bottom: 0;
    padding: 0.75rem 0;
    background: linear-gradient(transparent, var(--ffl-bg) 45%);
}
.fc-editor-save .ffl-btn {
    width: 100%;
    justify-content: center;
}

/* "Save contact" CTA on public card / profile */
.fc-pc-actions {
    display: flex;
    margin: 0.5rem 0 0.75rem;
}
.fc-pc-actions .ffl-btn {
    width: 100%;
    justify-content: center;
}

/* ─── Reminders (Home) ──────────────────────────────────────────── */
.fc-reminders {
    margin-bottom: 1rem;
    border-left: 3px solid var(--ffl-accent);
}
.fc-reminders .fc-cat-name {
    color: var(--ffl-accent);
}
.fc-rem-name {
    display: block;
    font-weight: 600;
    font-size: var(--ffl-text-base);
}
.fc-rem-date {
    font-size: var(--ffl-text-xs);
}
.fc-rem-tag {
    font-size: var(--ffl-text-xs);
    color: var(--ffl-accent);
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
}

/* ─── QR code block ─────────────────────────────────────────────── */
.fc-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--ffl-line);
}
.fc-qr img {
    width: 180px;
    height: 180px;
    image-rendering: pixelated;
    background: #fff;
    border-radius: var(--ffl-r-sm);
    padding: 6px;
}

/* ─── Public card page ──────────────────────────────────────────── */
.fc-public {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.fc-card-public {
    max-width: 480px;
    width: 100%;
}
.fc-pc-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    margin-top: 1rem;
}
.fc-pc-identity {
    text-align: center;
}
.fc-pc-name {
    font-size: var(--ffl-text-2xl);
}
.fc-pc-title {
    color: var(--ffl-muted);
    margin-top: 0.15rem;
}
.fc-pc-socials {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}
.fc-pc-link,
.fc-pc-cta {
    width: 100%;
    justify-content: center;
}
.fc-pc-bio {
    line-height: 1.6;
}
.fc-public-footer {
    margin-top: auto;
    text-align: center;
    padding: 1.25rem;
}

/* ─── Modal dialogs (on-brand confirm/prompt) ───────────────────── */
.fc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 50;
}
.fc-modal {
    background: var(--ffl-panel);
    border: 1px solid var(--ffl-line);
    border-radius: var(--ffl-r-lg);
    box-shadow: var(--ffl-shadow-lg);
    padding: 1.25rem;
    width: 100%;
    max-width: 380px;
}
.fc-modal-title {
    font-size: var(--ffl-text-lg);
    margin-bottom: 0.5rem;
}
.fc-modal-body {
    margin-bottom: 1rem;
    line-height: 1.5;
}
.fc-modal-body .ffl-input {
    margin-top: 0.6rem;
}
.fc-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ─── Toast (one-tap copy confirmation) ─────────────────────────── */
.fc-toast {
    position: fixed;
    left: 50%;
    bottom: calc(1.75rem + env(safe-area-inset-bottom));
    transform: translate(-50%, 0.75rem);
    background: var(--ffl-ink);
    color: var(--ffl-panel);
    padding: 0.7rem 1.25rem;
    border-radius: var(--ffl-r-pill);
    font-size: var(--ffl-text-base);
    font-weight: 600;
    box-shadow: var(--ffl-shadow-md);
    opacity: 0;
    pointer-events: none;
    transition:
        opacity var(--ffl-trans),
        transform var(--ffl-trans);
    z-index: 20;
}
.fc-toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* ─── Mobile: stack the copy button under the text, full width ──── */
@media (max-width: 480px) {
    .fc-field-row,
    .fc-addr-line,
    .fc-drawer-head,
    .fc-fe-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    /* All these rows stack on mobile, so let their actions span the full width
       and sit on their own line. On the Edit field editor (`.fc-fe-row`) this
       gives the label input the whole first line instead of fighting the
       gear/reorder/delete icons for room. */
    .fc-field-row .fc-field-actions,
    .fc-addr-line .fc-field-actions,
    .fc-drawer-head .fc-field-actions,
    .fc-fe-row .fc-field-actions {
        width: 100%;
        justify-content: flex-end;
    }
    /* Copy buttons go full width and centred when stacked */
    .fc-copy {
        width: 100%;
        justify-content: center;
    }
    .fc-drawer-head .fc-copy {
        width: 100%;
    }
}
