/* Windows XP ("Luna" blue) theme.
   Colours, button gradients, hover/focus rings and the title-bar gradient come from
   XP.css by Adam Hammad and Jordan Scales (MIT licence, https://github.com/botoxparty/XP.css),
   adapted to this app's class names. Active only with <html data-theme="xp">. */

:root[data-theme="xp"] {
    --bg: #2a64c5;
    --panel: #ece9d8;
    --panel-light: #fbfbf8;
    --text: #000000;
    --muted: #3b3b3b;
    --accent: #0c3a9e;
    --focus: #c25b00;
    --focus-on-bar: #ffffff;
    --link: #0b3fbf;
    --visited: #5b2a8e;
    --shadow: rgba(0, 0, 0, 0.35);
}

:root[data-theme="xp"] body {
    font-family: Tahoma, "Segoe UI", Verdana, sans-serif;
    /* A nod to the "Bliss" wallpaper: blue sky over a green hill. */
    background:
        radial-gradient(ellipse 120% 40% at 30% 100%, #5fa83a 0%, #3f8a24 45%, transparent 46%) fixed,
        linear-gradient(180deg, #1f55b8 0%, #3f7fd8 50%, #8cbcef 78%, #4c9a2c 79%, #2f6d19 100%) fixed;
}

/* ── Windows ───────────────────────────────────────────────────────────── */

:root[data-theme="xp"] .rooms-panel,
:root[data-theme="xp"] .auth-panel,
:root[data-theme="xp"] .side-panel,
:root[data-theme="xp"] .chat-panel,
:root[data-theme="xp"] .admin-form-section,
:root[data-theme="xp"] .stat-card,
:root[data-theme="xp"] .faq-section {
    background: var(--panel);
    border: 1px solid #001ea0;
    border-radius: 8px 8px 0 0;
    box-shadow: inset 0 0 0 2px #0855dd, inset 0 0 0 3px #166aee, 2px 3px 8px var(--shadow);
}

:root[data-theme="xp"] .stat-card,
:root[data-theme="xp"] .admin-form-section {
    border-radius: 3px;
    border-color: #7f9db9;
    box-shadow: 1px 2px 4px var(--shadow);
}

/* Title bars: the panel headings, the room bar, the page headers. */
:root[data-theme="xp"] .rooms-panel h2,
:root[data-theme="xp"] .auth-panel h2,
:root[data-theme="xp"] .side-panel h2,
:root[data-theme="xp"] .chat-top,
:root[data-theme="xp"] .faq-section-title,
:root[data-theme="xp"] .faq-title,
:root[data-theme="xp"] .app-header,
:root[data-theme="xp"] .admin-header {
    background: linear-gradient(180deg, #0997ff, #0053ee 8%, #0050ee 40%, #0066ff 88%, #0066ff 93%, #005bff 95%, #003dd7 96%, #003dd7);
    color: #ffffff;
    border: 0;
    border-radius: 7px 7px 0 0;
    text-shadow: 1px 1px #0f1089;
}

:root[data-theme="xp"] .rooms-panel h2,
:root[data-theme="xp"] .auth-panel h2,
:root[data-theme="xp"] .side-panel h2,
:root[data-theme="xp"] .faq-section-title,
:root[data-theme="xp"] .faq-title {
    font-family: "Trebuchet MS", Tahoma, sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    padding: 5px 10px;
}

:root[data-theme="xp"] .rooms-panel h2,
:root[data-theme="xp"] .auth-panel h2,
:root[data-theme="xp"] .side-panel h2 {
    margin: -12px -12px 10px;
}

:root[data-theme="xp"] .faq-section-title {
    margin: -10px -10px 10px;
}

:root[data-theme="xp"] .faq-title {
    font-size: 1.1rem;
    border: 1px solid #001ea0;
}

:root[data-theme="xp"] .chat-top {
    margin: -12px -12px 0;
    padding: 6px 12px;
}

:root[data-theme="xp"] .chat-top h2 {
    font-family: "Trebuchet MS", Tahoma, sans-serif;
    color: #ffffff;
    text-transform: none;
    letter-spacing: 0;
}

:root[data-theme="xp"] .chat-top p,
:root[data-theme="xp"] .app-header .brand-tag,
:root[data-theme="xp"] .admin-header .brand-tag {
    color: #ffffff;
}

:root[data-theme="xp"] .app-header,
:root[data-theme="xp"] .admin-header {
    border: 1px solid #001ea0;
    border-radius: 8px 8px 0 0;
    box-shadow: 2px 3px 8px var(--shadow);
}

:root[data-theme="xp"] .brand-name {
    color: #ffffff;
    font-family: "Trebuchet MS", Tahoma, sans-serif;
    text-transform: none;
    font-size: 1.1rem;
}

/* Controls on the blue title bars: a white focus outline (orange is too faint there). */
:root[data-theme="xp"] .chat-top :focus-visible,
:root[data-theme="xp"] .app-header :focus-visible,
:root[data-theme="xp"] .admin-header :focus-visible {
    outline: 3px solid var(--focus-on-bar);
    outline-offset: 1px;
}

/* Admin section headings: the Explorer task-pane header. */
:root[data-theme="xp"] .section-title {
    background: linear-gradient(90deg, #ffffff, #c6d3f7);
    color: #0c3a9e;
    border: 1px solid #a9bde8;
    border-radius: 4px 4px 0 0;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 700;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

:root[data-theme="xp"] .button {
    color: #000000;
    border: 1px solid #003c74;
    border-radius: 3px;
    background: linear-gradient(180deg, #ffffff, #ecebe5 86%, #d8d0c4);
    box-shadow: none;
    font-weight: 400;
}

:root[data-theme="xp"] .button:hover {
    box-shadow: inset -1px 1px #fff0cf, inset 1px 2px #fdd889, inset -2px 2px #fbc761, inset 2px -2px #e5a01a;
}

:root[data-theme="xp"] .button:focus-visible {
    box-shadow: inset -1px 1px #cee7ff, inset 1px 2px #98b8ea, inset -2px 2px #bcd4f6, inset 1px -1px #89ade4, inset 2px -2px #89ade4;
}

:root[data-theme="xp"] .button:active {
    border-color: #003c74;
    background: linear-gradient(180deg, #cdcac3, #e3e3db 8%, #e5e5de 94%, #f2f2f1);
    box-shadow: none;
}

/* Default button: the blue inner ring XP draws on it. */
:root[data-theme="xp"] .button.primary {
    color: #000000;
    font-weight: 700;
    box-shadow: inset -1px 1px #cee7ff, inset 1px 2px #98b8ea, inset -2px 2px #bcd4f6, inset 1px -1px #89ade4, inset 2px -2px #89ade4;
}

/* Selected tab / room: the XP tab with its orange top edge. */
:root[data-theme="xp"] .button.active {
    background: #fcfcfe;
    color: #000000;
    font-weight: 700;
    border-color: #919b9c;
    box-shadow: inset 0 3px #e68b2c;
}

/* ── Fields ────────────────────────────────────────────────────────────── */

:root[data-theme="xp"] textarea,
:root[data-theme="xp"] input:not([type="checkbox"]):not([type="radio"]),
:root[data-theme="xp"] .admin-textarea,
:root[data-theme="xp"] .message-pane,
:root[data-theme="xp"] .ai-log-scroll {
    border: 1px solid #7f9db9;
    border-radius: 0;
    background-color: #ffffff;
}

/* Combo box: white field with the blue XP drop-down button. */
:root[data-theme="xp"] select {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #7f9db9;
    border-radius: 0;
    padding-right: 26px;
    background: #ffffff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='19' viewBox='0 0 17 19'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23e1eafe'/%3E%3Cstop offset='1' stop-color='%23aec8f7'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect x='.5' y='.5' width='16' height='18' rx='2' fill='url(%23g)' stroke='%23b9cbf3'/%3E%3Cpath d='M5 8l3.5 3.5L12 8' fill='none' stroke='%234d6185' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 1px center;
}

:root[data-theme="xp"] .status-pill {
    border: 1px solid #7f9db9;
    border-radius: 2px;
    background: #ffffff;
    color: #000000;
    text-shadow: none;
}

:root[data-theme="xp"] .ai-fieldset {
    border: 1px solid #d0d0bf;
    border-radius: 4px;
}

:root[data-theme="xp"] .ai-fieldset legend {
    color: #0046d5;
}

/* ── Messages, lists ───────────────────────────────────────────────────── */

:root[data-theme="xp"] .message,
:root[data-theme="xp"] .msg-row,
:root[data-theme="xp"] .faq-item {
    background: #fbfbf8;
    border: 1px solid #d4d0c8;
    border-radius: 3px;
}

:root[data-theme="xp"] .message.own {
    background: #e8f0fc;
    border-color: #a9c2ea;
}

:root[data-theme="xp"] .message.mentions-me {
    background: #fff4e0;
    border-left: 4px solid #e68b2c;
}

:root[data-theme="xp"] .message-header {
    font-family: Tahoma, Verdana, sans-serif;
}

:root[data-theme="xp"] .participant {
    background: #ffffff;
    border: 1px solid #d4d0c8;
    border-radius: 3px;
}

:root[data-theme="xp"] .participant.outside {
    border-style: dashed;
    background: #f7f7f2;
}

:root[data-theme="xp"] .mention-list {
    background: #ffffff;
    border: 1px solid #7f9db9;
    box-shadow: 2px 2px 6px var(--shadow);
}

:root[data-theme="xp"] .mention-list li.active,
:root[data-theme="xp"] .mention-list li:hover {
    background: #316ac5;
    color: #ffffff;
}

:root[data-theme="xp"] .mention {
    color: #0c3a9e;
    background: #dde8fb;
}

:root[data-theme="xp"] .history-indicator {
    background: #ffffe1;
    border-color: #000000;
}

/* Admin tables: the list-view header. */
:root[data-theme="xp"] .admin-table {
    background: #ffffff;
    border: 1px solid #7f9db9;
}

:root[data-theme="xp"] .admin-table th {
    background: linear-gradient(180deg, #ffffff, #ebeadb);
    color: #000000;
    border: 1px solid #c7c5b2;
    border-bottom: 3px solid #d6d2c2;
    text-transform: none;
    letter-spacing: 0;
}

:root[data-theme="xp"] .admin-table td {
    border-color: #e0dfd3;
}

:root[data-theme="xp"] .admin-table tbody tr:nth-child(even) td {
    background: #f3f3ee;
}

/* FAQ page text sits on the desktop. */
:root[data-theme="xp"] .faq-back,
:root[data-theme="xp"] .faq-back:visited,
:root[data-theme="xp"] .faq-subtitle {
    color: #ffffff;
    text-shadow: 1px 1px 2px #001a5c;
}
