/*
Theme Name:  Wolfram Forum
Theme URI:   https://wolfram-industrie.de/
Author:      Wolfram Industrie (dev integration)
Description: Minimal Wolfram-branded forum theme used to test the Wolfram SSO Client plugin against the WolframAcademySso shop. Two-column layout (threads list + sidebar with SSO identity chip), Wolfram teal palette, the same shield+padlock motif as the shop's OAuth consent screen.
Version:     1.0.0
Requires PHP: 8.0
Tags: oauth, sso, wolfram, forum
Text Domain: wfa-forum
*/

/* ============================================================
   Wolfram brand palette
   ============================================================ */
:root {
    --wfa-teal:        #00847e;
    --wfa-teal-dark:   #006b66;
    --wfa-teal-light:  #5eb1ae;
    --wfa-teal-tint:   #e6f4f3;
    --wfa-yellow:      #facc15;
    --wfa-ink:         #0f172a;
    --wfa-text:        #1f2329;
    --wfa-muted:       #64748b;
    --wfa-line:        #e2e8f0;
    --wfa-bg:          #f8fafc;
    --wfa-card-bg:     #ffffff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--wfa-bg);
    color: var(--wfa-text);
    line-height: 1.5;
}

a { color: var(--wfa-teal); text-decoration: none; }
a:hover { color: var(--wfa-teal-dark); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ============================================================
   Layout
   ============================================================ */
.wfa-site {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.wfa-header {
    background: var(--wfa-ink);
    color: #fff;
    padding: 1rem 1.5rem;
}
.wfa-header__inner {
    max-width: 1080px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}
.wfa-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: #fff;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    text-decoration: none;
}
.wfa-brand:hover {
    color: #fff;
    text-decoration: none;
}
.wfa-brand__mark {
    width: 32px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
}
.wfa-brand__name-id { color: var(--wfa-yellow); }
.wfa-nav {
    display: flex; gap: 1.4rem;
    margin-left: auto;
    margin-right: 1rem;
}
.wfa-nav a {
    color: #cbd5e1;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.wfa-nav a:hover { color: #fff; text-decoration: none; }

.wfa-main {
    flex: 1;
    max-width: 1080px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}
.wfa-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 2rem;
    align-items: start;
}

.wfa-footer {
    background: var(--wfa-ink);
    color: #94a3b8;
    padding: 1.2rem 1.5rem;
    margin-top: auto;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    text-align: center;
}
.wfa-footer a { color: #cbd5e1; }
.wfa-footer__brand { color: var(--wfa-yellow); font-weight: 700; }

/* ============================================================
   Hero (front page only)
   ============================================================ */
.wfa-hero {
    background: linear-gradient(135deg, var(--wfa-teal) 0%, var(--wfa-teal-dark) 100%);
    color: #fff;
    padding: 3rem 1.5rem;
    margin: -2rem -1.5rem 2rem;
    position: relative;
    overflow: hidden;
}
.wfa-hero__inner {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 2;
}
.wfa-hero h1 {
    font-size: 2.4rem;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin: 0 0 0.7rem;
    text-transform: uppercase;
    font-weight: 800;
}
.wfa-hero p {
    font-size: 1.1rem;
    margin: 0 0 1.5rem;
    color: #d1fae5;
}
.wfa-hero::before,
.wfa-hero::after {
    content: "";
    position: absolute;
    width: 280px; height: 90px;
    background: var(--wfa-teal-light);
    transform: skewX(-22deg);
    opacity: 0.4;
    pointer-events: none;
    z-index: 1;
}
.wfa-hero::before { top: -10px; right: -60px; }
.wfa-hero::after  { bottom: -10px; left: -60px; }

/* ============================================================
   Threads list (front page + index)
   ============================================================ */
.wfa-section-title {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--wfa-teal);
    margin: 0 0 0.9rem;
}

.wfa-threads {
    background: var(--wfa-card-bg);
    border: 2px solid var(--wfa-line);
}
.wfa-thread {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 1rem;
    padding: 1rem 1.2rem;
    align-items: center;
    border-bottom: 1px solid var(--wfa-line);
    transition: background 140ms ease;
}
.wfa-thread:last-child { border-bottom: 0; }
.wfa-thread:hover { background: var(--wfa-teal-tint); }
.wfa-thread__avatar {
    width: 44px; height: 44px;
    background: var(--wfa-teal);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; font-weight: 800;
}
.wfa-thread__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--wfa-ink);
    line-height: 1.3;
}
.wfa-thread__title a { color: inherit; }
.wfa-thread__title a:hover { color: var(--wfa-teal); text-decoration: none; }
.wfa-thread__meta {
    font-size: 0.82rem;
    color: var(--wfa-muted);
    margin-top: 2px;
}
.wfa-thread__count {
    background: var(--wfa-teal-tint);
    color: var(--wfa-teal);
    font-weight: 800;
    font-size: 0.85rem;
    padding: 0.3rem 0.7rem;
    min-width: 48px;
    text-align: center;
}

/* ============================================================
   Sidebar
   ============================================================ */
.wfa-sidebar { display: flex; flex-direction: column; gap: 1.25rem; }
.wfa-side-card {
    background: var(--wfa-card-bg);
    border: 2px solid var(--wfa-line);
    padding: 1.2rem;
}
.wfa-side-card h3 {
    margin: 0 0 0.8rem;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--wfa-teal);
}

.wfa-cats { list-style: none; padding: 0; margin: 0; }
.wfa-cats li {
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--wfa-line);
    display: flex; justify-content: space-between;
}
.wfa-cats li:last-child { border-bottom: 0; }
.wfa-cats a { color: var(--wfa-ink); font-weight: 600; }
.wfa-cats__count {
    color: var(--wfa-muted);
    font-size: 0.85rem;
    font-weight: 700;
}

/* Identity card */
.wfa-identity p { margin: 0 0 0.7rem; font-size: 0.92rem; color: var(--wfa-muted); }
.wfa-identity__notice {
    background: var(--wfa-teal-tint);
    color: var(--wfa-teal);
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 700;
    margin-top: 0.8rem;
}

/* ============================================================
   Single post / page
   ============================================================ */
.wfa-article {
    background: var(--wfa-card-bg);
    border: 2px solid var(--wfa-line);
    padding: 2rem;
}
.wfa-article h1 {
    margin: 0 0 0.8rem;
    font-size: 1.8rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--wfa-ink);
}
.wfa-article__meta {
    color: var(--wfa-muted);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--wfa-line);
}
.wfa-article__content { font-size: 1rem; line-height: 1.65; }
.wfa-article__content p { margin: 0 0 1rem; }
.wfa-article__content h2 { margin: 1.8rem 0 0.6rem; font-size: 1.3rem; color: var(--wfa-teal); }

.wfa-loginbox {
    background: var(--wfa-card-bg);
    border: 2px solid var(--wfa-line);
    padding: 2rem;
    text-align: center;
    margin-top: 1.5rem;
}
.wfa-loginbox h2 {
    margin: 0 0 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 1.2rem;
    color: var(--wfa-teal);
}
.wfa-loginbox p { margin: 0 0 1.2rem; color: var(--wfa-muted); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .wfa-grid { grid-template-columns: 1fr; }
    .wfa-nav { display: none; }
    .wfa-hero h1 { font-size: 1.7rem; }
}
@media (max-width: 600px) {
    .wfa-header__inner { flex-wrap: wrap; gap: 0.7rem; }
    .wfa-thread { grid-template-columns: 36px minmax(0, 1fr); }
    .wfa-thread__count { grid-column: 2; justify-self: start; }
}

/* ============================================================
   /login/  — three-option sign-in chooser
   ============================================================ */
.wfa-login-wrap {
    background: rgba(0, 0, 0, .85);
    margin: -2rem -1.5rem -1.2rem;
    padding: 3rem 1.5rem;
    min-height: 70vh;
    display: flex; align-items: center; justify-content: center;
}
.wfa-login-shell {
    background: #fff;
    border: 2px solid var(--wfa-line);
    width: 100%; max-width: 480px;
    padding: 2.5rem 2.25rem;
}
.wfa-login-hero { margin-bottom: 1.5rem; }
.wfa-login-hero__eyebrow {
    font-size: 11px; font-weight: 800;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--wfa-teal);
    margin-bottom: 0.45rem;
}
.wfa-login-hero__title {
    margin: 0;
    font-size: 1.55rem; font-weight: 800;
    line-height: 1.2; letter-spacing: 0.2px;
    text-transform: uppercase;
    color: var(--wfa-teal);
}
.wfa-login-hero__sub {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.95rem; font-weight: 600;
    text-transform: none; letter-spacing: 0;
    color: var(--wfa-ink);
}
.wfa-login-error {
    display: flex; align-items: center; gap: 0.5rem;
    background: #fee2e2; color: #991b1b;
    padding: 0.7rem 0.9rem;
    font-size: 0.85rem; font-weight: 600;
    margin: 0 0 1.1rem;
}
.wfa-login-error__dot {
    display: inline-flex; align-items: center; justify-content: center;
    background: #ef4444; color: #fff;
    width: 22px; height: 22px;
    font-weight: 900;
    flex-shrink: 0;
}
.wfa-login-options { display: flex; flex-direction: column; gap: 0.7rem; }
.wfa-login-option {
    display: flex; align-items: center; gap: 0.9rem;
    padding: 0.95rem 1.1rem;
    background: #fff;
    border: 2px solid var(--wfa-line);
    color: var(--wfa-ink);
    font-family: inherit; text-decoration: none;
    cursor: pointer;
    transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
    text-align: left; width: 100%;
}
.wfa-login-option:hover {
    border-color: var(--wfa-teal);
    background: var(--wfa-bg);
    transform: translateY(-1px);
    text-decoration: none;
}
.wfa-login-option--primary {
    background: var(--wfa-teal);
    color: #fff;
    border-color: var(--wfa-teal);
}
.wfa-login-option--primary:hover {
    background: var(--wfa-teal-dark);
    border-color: var(--wfa-teal-dark);
    color: #fff;
}
.wfa-login-option__icon {
    flex: 0 0 36px;
    display: inline-flex; align-items: center; justify-content: center;
    line-height: 0;
}
.wfa-login-option__body { flex: 1; min-width: 0; }
.wfa-login-option__title {
    display: block;
    font-weight: 800; font-size: 0.95rem;
    letter-spacing: 0.02em;
}
.wfa-login-option__hint {
    display: block;
    font-size: 0.78rem;
    opacity: 0.85;
    margin-top: 0.15rem;
}
.wfa-login-option__arrow { font-size: 1.4rem; font-weight: 700; opacity: 0.6; }
.wfa-login-option--stub { color: #475569; }
.wfa-login-option--stub .wfa-login-option__hint { color: #94a3b8; }
.wfa-login-footer-hint {
    margin-top: 1.5rem;
    font-size: 0.78rem; color: var(--wfa-muted);
    text-align: center;
}

/* ============================================================
   Chat UI (post-login front-page)
   ============================================================ */
/* Hide the standard chrome only when the full-screen chat is rendered.
   We can't key off body.home because /login/ also routes through the
   home query and would have body.home — that would hide the login UI
   too. front-page.php injects body.wfa-chat-active when it actually
   renders the chat. */
body.wfa-chat-active .wfa-header,
body.wfa-chat-active .wfa-footer,
body.wfa-chat-active .wfa-main { display: none !important; }
body.wfa-chat-active { background: #f6f7f9; }

.wfa-chat {
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-rows: 64px 1fr;
    background: #f6f7f9;
    color: var(--wfa-ink);
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* TOP BAR */
.wfa-chat__top {
    background: var(--wfa-ink);
    color: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.25rem;
    border-bottom: 1px solid #1f2937;
}
.wfa-chat__top-left {
    display: flex; align-items: baseline; gap: 0.6rem;
    min-width: 0;
}
.wfa-chat__channel-hash {
    color: var(--wfa-yellow);
    font-size: 1.3rem; font-weight: 800;
    line-height: 1;
}
.wfa-chat__channel-name {
    font-weight: 800; font-size: 1.05rem;
    letter-spacing: 0.02em;
}
.wfa-chat__channel-desc {
    color: #94a3b8;
    font-size: 0.85rem;
    margin-left: 0.5rem;
    white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}

.wfa-chat__top-right {
    display: flex; align-items: center; gap: 1rem;
}
.wfa-chat__search {
    background: #1f2937;
    border: 0;
    color: #fff;
    padding: 0.45rem 0.8rem;
    width: 240px;
    font: inherit;
    font-size: 0.85rem;
    outline: 0;
}
.wfa-chat__search::placeholder { color: #64748b; }
.wfa-chat__search:focus { background: #273345; }

.wfa-chat__me {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.3rem 0.5rem 0.3rem 0.3rem;
    background: rgba(255, 255, 255, 0.07);
}
.wfa-chat__me-avatar {
    width: 36px; height: 36px;
    background: var(--wfa-teal);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1rem;
}
.wfa-chat__me-body { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.wfa-chat__me-name {
    font-weight: 700; font-size: 0.9rem; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 200px;
}
.wfa-chat__me-email {
    font-size: 0.72rem; color: #94a3b8;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 200px;
}
.wfa-chat__me-logout {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px;
    color: #94a3b8;
    transition: color 140ms ease, background 140ms ease;
}
.wfa-chat__me-logout:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* BODY GRID */
.wfa-chat__body {
    display: grid;
    grid-template-columns: 280px 1fr;
    overflow: hidden;
}

/* LEFT PANEL */
.wfa-chat__side {
    background: #0b1322;
    color: #e2e8f0;
    overflow-y: auto;
    display: flex; flex-direction: column;
    padding: 1rem 0;
    border-right: 1px solid #1e293b;
}
.wfa-chat__side-brand {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0 1.1rem 1rem;
    border-bottom: 1px solid #1e293b;
    margin-bottom: 0.6rem;
}
.wfa-chat__side-brand-name {
    font-weight: 800; font-size: 1.05rem;
    letter-spacing: -0.01em;
}
.wfa-chat__side-brand-id { color: var(--wfa-yellow); }
.wfa-chat__side-section { padding: 0.5rem 0; }
.wfa-chat__side-section--bottom {
    margin-top: auto;
    border-top: 1px solid #1e293b;
    padding-top: 0.7rem;
}
.wfa-chat__side-heading {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.35rem 1.1rem;
    font-size: 0.7rem; font-weight: 800;
    letter-spacing: 0.12em; text-transform: uppercase;
    color: #64748b;
}
.wfa-chat__side-add {
    background: transparent; border: 0;
    color: #64748b;
    font-size: 1.05rem; font-weight: 700;
    cursor: pointer;
    padding: 0 0.3rem;
}
.wfa-chat__side-add:hover { color: #fff; }
.wfa-chat__side-list { list-style: none; margin: 0; padding: 0; }
.wfa-chat__side-item {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0.4rem 1.1rem;
    font-size: 0.92rem;
    cursor: pointer;
    color: #cbd5e1;
    transition: background 140ms ease, color 140ms ease;
}
.wfa-chat__side-item:hover { background: #111e33; color: #fff; }
.wfa-chat__side-item.is-active {
    background: var(--wfa-teal);
    color: #fff;
    font-weight: 700;
}
.wfa-chat__side-item.is-active .wfa-chat__side-item-hash {
    color: #fff;
    opacity: 1;
}
.wfa-chat__side-item-hash {
    color: #64748b;
    font-weight: 700;
    width: 16px;
    text-align: center;
}
.wfa-chat__side-item-name {
    flex: 1; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wfa-chat__side-item-count {
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    padding: 0.05rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.3;
}
.wfa-chat__side-item-count--badge {
    background: var(--wfa-yellow);
    color: var(--wfa-ink);
}
.wfa-chat__side-item.is-active .wfa-chat__side-item-count {
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
}
.wfa-chat__side-dm-av {
    width: 22px; height: 22px;
    background: var(--wfa-teal-dark);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: 800;
    border-radius: 50%;
    flex-shrink: 0;
}
.wfa-chat__side-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #475569;
    flex-shrink: 0;
}
.wfa-chat__side-dot--on { background: #10b981; }
.wfa-chat__side-item-icon { width: 18px; text-align: center; flex-shrink: 0; }
.wfa-chat__side-item-link {
    display: flex; align-items: center; gap: 0.55rem;
    color: inherit;
    text-decoration: none;
    width: 100%;
}
.wfa-chat__side-item-link:hover { color: #fff; text-decoration: none; }

/* MAIN PANEL */
.wfa-chat__main {
    display: flex; flex-direction: column;
    background: #ffffff;
    overflow: hidden;
}
.wfa-chat__messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
    display: flex; flex-direction: column;
    gap: 0.6rem;
}
.wfa-chat__day-sep {
    display: flex; align-items: center; justify-content: center;
    margin: 0.7rem 0 0.5rem;
    position: relative;
}
.wfa-chat__day-sep::before,
.wfa-chat__day-sep::after {
    content: "";
    height: 1px;
    background: var(--wfa-line);
    flex: 1;
}
.wfa-chat__day-sep span {
    padding: 0 0.9rem;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--wfa-muted);
}
.wfa-chat__msg {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 0.7rem;
    padding: 0.45rem 0.5rem;
}
.wfa-chat__msg:hover { background: var(--wfa-bg); }
.wfa-chat__msg-avatar {
    width: 42px; height: 42px;
    background: var(--wfa-teal);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 1rem;
}
.wfa-chat__msg.is-me .wfa-chat__msg-avatar {
    background: var(--wfa-yellow);
    color: var(--wfa-ink);
}
.wfa-chat__msg-body { min-width: 0; }
.wfa-chat__msg-head {
    display: flex; align-items: baseline; gap: 0.5rem;
    margin-bottom: 0.1rem;
}
.wfa-chat__msg-author {
    font-weight: 800;
    color: var(--wfa-ink);
    font-size: 0.92rem;
}
.wfa-chat__msg.is-me .wfa-chat__msg-author { color: var(--wfa-teal-dark); }
.wfa-chat__msg-time {
    font-size: 0.72rem;
    color: var(--wfa-muted);
}
.wfa-chat__msg-text {
    font-size: 0.93rem;
    line-height: 1.45;
    color: var(--wfa-text);
    word-wrap: break-word;
}

/* COMPOSER */
.wfa-chat__composer {
    display: flex; align-items: flex-end; gap: 0.6rem;
    border-top: 1px solid var(--wfa-line);
    padding: 0.8rem 1.5rem;
    background: #fff;
}
.wfa-chat__composer-input {
    flex: 1;
    resize: none;
    min-height: 40px; max-height: 160px;
    padding: 0.65rem 0.9rem;
    border: 2px solid var(--wfa-line);
    font: inherit;
    color: var(--wfa-ink);
    background: #fff;
    outline: 0;
    line-height: 1.4;
}
.wfa-chat__composer-input:focus { border-color: var(--wfa-teal); }
.wfa-chat__composer-send {
    width: 44px; height: 40px;
    background: var(--wfa-teal);
    color: #fff;
    border: 0;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background 140ms ease;
}
.wfa-chat__composer-send:hover { background: var(--wfa-teal-dark); }

@media (max-width: 760px) {
    .wfa-chat { grid-template-rows: 56px 1fr; }
    .wfa-chat__body { grid-template-columns: 64px 1fr; }
    .wfa-chat__side-brand-name,
    .wfa-chat__side-heading,
    .wfa-chat__side-item-name,
    .wfa-chat__side-item-count,
    .wfa-chat__side-add { display: none; }
    .wfa-chat__side-section { padding: 0.3rem 0; }
    .wfa-chat__side-item { justify-content: center; padding: 0.6rem 0; }
    .wfa-chat__search { width: 120px; }
    .wfa-chat__me-body { display: none; }
    .wfa-chat__channel-desc { display: none; }
}
