/* Port of the Teams app look (TeamsAppMultiLang.v2/assets/styles.css). */

@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url('../fonts/material-symbols-outlined.woff2') format('woff2');
}

:root {
    color-scheme: light;
    --brand: #ffd500;
    --brand-hover: #e6c000;
    --bg: #f5f5f7;
    --text: #111;
    --muted: #5f6368;
    --card: #fff;
    --border: #b8b8b8;
    --tile: #fff;
    --cta-bg: #000;
    --cta-text: #fff;
    --cta-hover: rgba(0, 0, 0, .8);
    --secondary-bg: #fff;
    --secondary-text: var(--muted);
    --secondary-hover: rgba(238, 238, 238, .85);
    --back-hover: rgba(0, 0, 0, .04);
    --toast-bg: #fff;
    --toast-border: #fff;
    --toast-text: inherit;
}

/* Dark: Teams dark theme, or the OS setting when Teams has not chosen a theme (Razor always renders data-theme, empty when unset). */
:root[data-theme='dark'] {
    color-scheme: dark;
    --bg: #0f1115;
    --text: #e5e7eb;
    --muted: #9aa4b2;
    --card: #2b2b40;
    --border: #2b2b40;
    --tile: #2f2f46;
    --cta-bg: #fff;
    --cta-text: #000;
    --cta-hover: #e5e7eb;
    --secondary-text: var(--tile);
    --secondary-hover: #e5e7eb;
    --back-hover: #0c1016;
    --toast-bg: transparent;
    --toast-border: #9aa4b2;
    --toast-text: #e5e7eb;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme]),
    :root[data-theme=''] {
        color-scheme: dark;
        --bg: #0f1115;
        --text: #e5e7eb;
        --muted: #9aa4b2;
        --card: #2b2b40;
        --border: #2b2b40;
        --tile: #2f2f46;
        --cta-bg: #fff;
        --cta-text: #000;
        --cta-hover: #e5e7eb;
        --secondary-text: var(--tile);
        --secondary-hover: #e5e7eb;
        --back-hover: #0c1016;
        --toast-bg: transparent;
        --toast-border: #9aa4b2;
        --toast-text: #e5e7eb;
    }
}

:root[data-theme='contrast'] {
    color-scheme: dark;
    --bg: #000;
    --text: #fff;
    --muted: #d1d5db;
    --card: #000;
    --border: #fff;
    --tile: #000;
    --cta-bg: #fff;
    --cta-text: #000;
    --cta-hover: #d1d5db;
    --secondary-bg: #000;
    --secondary-text: #fff;
    --secondary-hover: #1f1f1f;
    --back-hover: #1f1f1f;
    --toast-bg: #000;
    --toast-border: #fff;
    --toast-text: #fff;
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-family-base, "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif);
    font-size: 16px;
    line-height: 1.5;
    padding-bottom: env(safe-area-inset-bottom);
}

.wrap { max-width: 860px; margin: 0 auto; padding: 28px 20px; }
header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
h1 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 6px; }
.sub { color: var(--muted); margin: 0 0 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Icons */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 48px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.material-symbols-outlined.greet-ico { font-size: 32px; vertical-align: -.1em; }

/* Navigation */
.back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 28px;
    border: 1px solid var(--border);
    background: transparent;
    color: inherit;
    font: inherit;
    line-height: inherit;
    text-decoration: none;
    cursor: pointer;
}
.back:hover { background: var(--back-hover); }

/* Compact pill for account actions and language choice; same look as "Tillbaka". */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 28px;
    border: 1px solid var(--border);
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 14px;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
.pill:hover { background: var(--back-hover); }
.pill[aria-current='page'] { background: var(--brand); border-color: var(--brand); color: #000; }
.account { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; align-self: flex-start; }
.account form { margin: 0; }

/* Grid */
.grid { display: grid; gap: 18px; grid-template-columns: 1fr; align-items: stretch; }
@media (min-width: 768px) {
    .grid { grid-template-columns: 1.618fr 1fr; }
    .span-2 { grid-column: span 2; }
}
.span-all { grid-column: 1 / -1; }

/* Cards */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 170px;
    height: 100%;
    padding: 28px;
    border-radius: 28px;
    background: var(--card);
    transform: scale(1);
    transition: transform .3s cubic-bezier(0, 0, .5, 1);
}
/* High contrast: outline cards without changing their size. */
:root[data-theme='contrast'] .card,
:root[data-theme='contrast'] .chat-slot { box-shadow: inset 0 0 0 1px var(--border); }
.card.card-clickable { cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
    .card.card-clickable:hover { transform: scale(1.02); background: var(--tile); }
}
@media (prefers-reduced-motion: reduce) {
    .card { transition: none; }
}
.card-ico { font-size: 26px; line-height: 1; }
.card h2 { margin: 0; font-size: 28px; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--muted); padding-bottom: 5px; }
.card p.gap-top { margin-top: 10px; }

/* Links */
a.link { color: inherit; text-decoration: underline; transition: filter 200ms ease; }
a.link:hover { filter: brightness(.6); }
.card a.link { color: var(--muted); }
.card p a { color: inherit; text-decoration: underline; }

/* Calls to action */
.card .cta,
.editor-actions .cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    align-self: flex-start;
    min-height: 48px;
    margin-top: auto;
    padding: 12px 22px;
    border: 1px solid var(--cta-bg);
    border-radius: 28px;
    background: var(--cta-bg);
    color: var(--cta-text);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.card .cta:hover { background: var(--cta-hover); }

/* "Sätt igång" is always Azeo yellow. */
.card .cta.cta-primary,
.editor-actions .cta.cta-primary { background: var(--brand); border-color: var(--brand); color: #000; }
.card .cta.cta-primary:hover,
.editor-actions .cta.cta-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

.card .cta.cta-secondary { background: var(--secondary-bg); border-color: var(--border); color: var(--secondary-text); }
.card .cta.cta-secondary:hover { background: var(--secondary-hover); }

/* New replies in the chat, shown on "Sätt igång" while the chat is closed. */
#help247-link { position: relative; }
.chat-badge {
    position: absolute;
    top: 0;
    right: 0;
    transform: translate(35%, -35%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border: 2px solid var(--card);
    border-radius: 999px;
    background: #d62f3d;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
}
.chat-badge[hidden] { display: none; }

/* Status message */
.toast {
    margin: 12px 0 18px;
    padding: 28px;
    border-radius: 28px;
    border: 1px solid var(--toast-border);
    background: var(--toast-bg);
    color: var(--toast-text);
}
.toast b { display: block; margin-bottom: 2px; }
.toast .material-symbols-outlined { font-size: 20px; vertical-align: -3px; margin-right: 6px; }
.toast a { color: inherit; text-decoration: underline; }
.toast a:hover { opacity: .9; }

/* Tips: icon flashes like a lamp when the tip changes. */
@keyframes brandFlash {
    0% { color: var(--brand); }
    12% { color: var(--text); }
    24% { color: var(--brand); }
    36% { color: var(--text); }
    100% { color: var(--text); }
}
.material-symbols-outlined.flash-brand { animation: brandFlash .7s steps(1, end); will-change: color; }
#ai-tip { opacity: 1; transition: opacity 220ms ease; will-change: opacity; }
#ai-tip.tip-fade-out { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
    .material-symbols-outlined.flash-brand { animation: none; }
    #ai-tip { transition: none; }
}

/* Greeting hand wave */
@keyframes waveHand {
    0% { transform: rotate(0deg); }
    10% { transform: rotate(14deg); }
    20% { transform: rotate(-8deg); }
    30% { transform: rotate(14deg); }
    40% { transform: rotate(-4deg); }
    50% { transform: rotate(10deg); }
    60%, 100% { transform: rotate(0deg); }
}
.greet-ico.wave { animation: waveHand 1.1s ease-in-out; transform-origin: 50% 100%; }
@media (prefers-reduced-motion: reduce) {
    .greet-ico.wave { animation: none; }
}

/* Large chat: same column as the page, with the back button placed as on the contact page. */
body.chat-is-open { overflow: hidden; }
.chat-layer {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: var(--bg);
}
.chat-layer[hidden] { display: none; }
.chat-layer:focus { outline: none; }
.chat-panel { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: 860px; height: 100%; padding: 28px 20px; }
.chat-bar { flex: 0 0 auto; display: flex; margin-top: 16px; }
.chat-slot { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; border-radius: 28px; background: var(--card); }
.chat-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    color: var(--muted);
    text-align: center;
}
.chat-state p { margin: 0; max-width: 420px; }
.chat-state a { color: inherit; }
.chat-frame { display: block; width: 100%; height: 100%; border: 0; }
.chat-frame[data-ready='false'] { visibility: hidden; }
/* Narrow screens show HubSpot's own full-screen widget, which brings its own close button. */
.chat-layer[data-view='mobile'] .chat-frame { position: fixed; inset: 0; z-index: 1; }
.chat-status[hidden] { display: none; }
.chat-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: chatSpin .9s linear infinite;
}
.chat-status[data-state='failed'] .chat-spinner { display: none; }
@keyframes chatSpin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .chat-spinner { animation-duration: 2.4s; }
}
body.chat-frame-page { margin: 0; height: 100vh; overflow: hidden; background: var(--card); }
/* HubSpot's widget is light only; matching its color scheme keeps the browser from painting a backdrop behind it. */
.chat-host,
#hubspot-messages-iframe-container { color-scheme: light; }
.chat-host,
.chat-host #hubspot-conversations-inline-parent,
.chat-host #hubspot-conversations-inline-iframe {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    border: 0 !important;
}

/* Content editor */
:root { --error: #b3261e; }
:root[data-theme='dark'],
:root[data-theme='contrast'] { --error: #ffb4ab; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]),
    :root[data-theme=''] { --error: #ffb4ab; }
}
.account-note { margin-top: 4px; }
.editor-langs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.notice { margin: 12px 0; padding: 14px 20px; border-radius: 20px; border: 1px solid var(--border); background: var(--card); }
.notice-ok { border-color: var(--brand); }
.notice-warn { border-color: var(--error); }
.editor { display: flex; flex-direction: column; gap: 18px; margin-top: 12px; }
.editor .editor-section { min-height: 0; height: auto; gap: 16px; }
.editor .card h2 { font-size: 22px; }
.editor .field { display: flex; flex-direction: column; gap: 6px; }
.editor .field label,
.editor .field-label { font-weight: 600; }
.editor .field input,
.editor .field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg);
    color: var(--text);
    font: inherit;
}
.editor .field textarea { min-height: 4.5em; resize: vertical; }
.editor .field input:focus-visible,
.editor .field textarea:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }
.editor .field-help,
.editor .field-default { margin: 0; padding: 0; color: var(--muted); font-size: 14px; }
.editor .field-default { white-space: pre-line; }
.editor .field-error { margin: 0; padding: 0; color: var(--error); font-size: 14px; font-weight: 600; }
.editor .field-check label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.editor .field-check input { width: 20px; height: 20px; margin: 0; padding: 0; flex: none; accent-color: var(--brand); }
.editor .editor-preview { margin: 0; background: var(--bg); }
.editor-tip { display: grid; gap: 12px; margin: 0; padding: 16px; border: 1px solid var(--border); border-radius: 20px; }
.editor-tip legend { padding: 0 6px; font-weight: 600; }
@media (min-width: 768px) {
    .editor-tip { grid-template-columns: 1.618fr 1fr; }
}
.editor-actions { position: sticky; bottom: 0; padding: 12px 0 20px; background: linear-gradient(transparent, var(--bg) 35%); }
.editor-actions .cta { margin-top: 0; }
.editor-actions .cta:disabled { opacity: .5; cursor: not-allowed; }
