/*
 * Feel Good MSP member area: shared variables and page layout.
 * Used by resources/views/app/layouts/default.blade.php.
 */

:root {
    --fg-font: InterVariable, sans-serif;
    --fg-ink: #0b2f2c;
    --fg-ink-muted: #3d5f5b;
    /* Sidebar gradient, as in Craft: cyan-200 at the top to teal-300 at the bottom. */
    --fg-sidebar-top: oklch(.917 .08 205.041);
    --fg-sidebar-bottom: oklch(.855 .138 181.071);
    --fg-accent: #14a894;
    --fg-accent-strong: #0f766e;
    --fg-nav-hover: #00786f;
    --fg-support-bg: #0e5f58;
    --fg-page-bg: #f1f2f6;
    --fg-surface: #ffffff;
    --fg-border: #e4e7ec;
    --fg-toggle-knob: #fcc93a;
    --fg-footer-bg: #005f5a;
    --fg-footer-text: #cbfbf1;
    --fg-sidebar-width: 327px;
    --fg-topbar-height: 64px; /* Craft: h-16 */

    /* Accent-coloured text (links, icons) and form fields. */
    --fg-link: #00786f;
    --fg-field-bg: #ffffff;
    --fg-field-border: #d1d5dc;
    --fg-field-text: #111827;
}

/* Dark mode: the top bar switch sets data-theme="dark" on <html> (global/theme-init.js,
   feelgood-app.js). Colours follow Tailwind's teal / gray scales. Files that hard-code a
   colour override it in their own "Dark mode" section at the end. */
:root[data-theme="dark"] {
    color-scheme: dark;

    --fg-ink: #cbfbf1;
    --fg-ink-muted: #d1d5dc;
    /* Craft dark: cyan-800 at the top to teal-950 at the bottom. */
    --fg-sidebar-top: oklch(.45 .085 224.283);
    --fg-sidebar-bottom: oklch(.277 .046 192.524);
    --fg-accent: #009689;
    --fg-accent-strong: #00786f;
    --fg-nav-hover: rgba(150, 247, 228, .14);
    --fg-support-bg: #00bba7;
    --fg-page-bg: #101828;
    --fg-surface: #022f2e;
    --fg-border: #0b4f4a;
    --fg-toggle-knob: #fef3c7;
    --fg-footer-bg: #005f5a; /* Craft's footer is teal-800 in both themes. */
    --fg-footer-text: #cbfbf1;

    --fg-link: #46ecd5;
    --fg-field-bg: #1e2939;
    --fg-field-border: #4a5565;
    --fg-field-text: #f3f4f6;
}

body.fg-body {
    margin: 0;
    background: var(--fg-page-bg);
    font-family: var(--fg-font);
    color: var(--fg-ink);
}

/* The old admin template sets its own heading font; use the member area font instead. */
.fg-body h1,
.fg-body h2,
.fg-body h3,
.fg-body h4,
.fg-body h5,
.fg-body h6 {
    font-family: var(--fg-font);
}

/* The old template colours every heading slate (#455a64), unreadable on dark backgrounds:
   in dark mode headings take the text colour around them. :where() keeps this at element
   specificity, so headings that components colour themselves keep their colour. */
:where([data-theme="dark"] .fg-body) :is(h1, h2, h3, h4, h5, h6) {
    color: inherit;
}

/* Alpine: hide x-cloak elements (e.g. closed dropdowns) until Alpine has started. */
[x-cloak] {
    display: none !important;
}

/* Bootstrap 5 underlines every link; keep Bootstrap 4's look (underline on hover only).
   :where() keeps this at element specificity so component styles still win. */
:where(.fg-body) a {
    text-decoration: none;
}

:where(.fg-body) a:hover {
    text-decoration: underline;
}

/* Logos come in a light-mode and a dark-mode file; show the one for the current theme.
   img. keeps these ahead of layout rules like .fg-logo { display: block }. */
img.fg-logo--dark,
[data-theme="dark"] img.fg-logo--light {
    display: none;
}

[data-theme="dark"] img.fg-logo--dark {
    display: block;
}

/* Visually hidden text that screen readers still announce. */
.fg-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.fg-icon {
    flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/* Layout                                                              */
/* ------------------------------------------------------------------ */

.fg-shell {
    min-height: 100vh;
}

.fg-main {
    margin-left: var(--fg-sidebar-width);
    /* Room for the fixed top bar. */
    padding-top: var(--fg-topbar-height);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.fg-content {
    flex: 1;
    padding: 32px;
}

/* Edge-to-edge pages, e.g. the embedded calendar. */
.fg-content.fg-content--flush {
    padding: 0;
}

@media (max-width: 1199.98px) {
    :root {
        --fg-sidebar-width: 272px;
    }
}

@media (max-width: 991.98px) {
    .fg-main {
        margin-left: 0;
    }

    .fg-content {
        padding: 16px;
    }
}

/* @mentions in saved rich text (App\Services\Mentions), in editors and when shown read-only.
   .is-highlighted: the member's own mention, opened from a notification (quill-editor.js).
   In the editor a mention is drawn as <fg-mention>, saved as the <span>. */
span[data-user-id][data-mention],
fg-mention[data-user-id] {
    padding: 0 3px;
    border-radius: 4px;
    background: #ccfbf1;
    color: #115e59;
    font-weight: 600;
    white-space: nowrap;
}

span[data-user-id][data-mention].is-highlighted,
fg-mention[data-user-id].is-highlighted {
    animation: fg-mention-pulse 2s ease-out;
}

@keyframes fg-mention-pulse {
    0%, 40% { background: #fde68a; box-shadow: 0 0 0 4px #fde68a; }
    100% { background: #ccfbf1; box-shadow: 0 0 0 0 transparent; }
}

[data-theme="dark"] span[data-user-id][data-mention],
[data-theme="dark"] fg-mention[data-user-id] {
    background: #134e4a;
    color: #99f6e4;
}

@media (prefers-reduced-motion: reduce) {
    span[data-user-id][data-mention].is-highlighted,
    fg-mention[data-user-id].is-highlighted {
        animation: none;
        outline: 2px solid #f59e0b;
    }
}
