/* Mac OS X (Aqua, 10.0–10.2) theme: pinstriped windows, glossy "gel" pill buttons,
   blue default button, traffic-light title bars, iChat-style rounded messages.
   No ready-made Aqua stylesheet exists to reuse; the gel buttons follow the technique of
   Bradley Taunt's "Aqua UI buttons" tutorial (white gloss over a base colour), written
   here for this app's class names. Active only with <html data-theme="macosx">. */

:root[data-theme="macosx"] {
    --bg: #1f5fb4;
    --panel: #ececec;
    --panel-light: #f6f6f6;
    --text: #000000;
    --muted: #3a3a3a;
    --accent: #0b4fa8;
    --focus: #3a7fd9;
    --link: #0645c2;
    --visited: #5b2a8e;
    --shadow: rgba(0, 0, 0, 0.45);
    --aqua-gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.45) 48%, rgba(255, 255, 255, 0) 50%);
    --aqua-blue: linear-gradient(180deg, #6aaef4 0%, #4b94ea 50%, #3d8be8 51%, #7fc0fa 100%);
    --aqua-white: linear-gradient(180deg, #f2f2f2 0%, #e3e3e3 50%, #d2d2d2 51%, #f4f4f4 100%);
    --pinstripe: repeating-linear-gradient(180deg, #f6f6f6 0, #f6f6f6 2px, #ebebeb 2px, #ebebeb 4px);
}

:root[data-theme="macosx"] body {
    font-family: "Lucida Grande", "Lucida Sans Unicode", "Helvetica Neue", Helvetica, Arial, sans-serif;
    /* The "Aqua Blue" desktop. */
    background: radial-gradient(ellipse 90% 80% at 50% 35%, #2f6fbf 0%, #1c56a8 45%, #0b2f6e 100%) fixed;
}

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

:root[data-theme="macosx"] .app-header,
:root[data-theme="macosx"] .admin-header,
:root[data-theme="macosx"] .rooms-panel,
:root[data-theme="macosx"] .auth-panel,
:root[data-theme="macosx"] .side-panel,
:root[data-theme="macosx"] .chat-panel,
:root[data-theme="macosx"] .admin-form-section,
:root[data-theme="macosx"] .stat-card,
:root[data-theme="macosx"] .faq-section {
    background: var(--pinstripe);
    border: 1px solid #8a8a8a;
    border-radius: 7px 7px 5px 5px;
    box-shadow: 0 6px 18px var(--shadow);
}

/* Title bars, with the three traffic lights on the left. */
:root[data-theme="macosx"] .rooms-panel h2,
:root[data-theme="macosx"] .auth-panel h2,
:root[data-theme="macosx"] .side-panel h2,
:root[data-theme="macosx"] .faq-section-title,
:root[data-theme="macosx"] .faq-title {
    position: relative;
    background: linear-gradient(180deg, #f4f4f4 0%, #dcdcdc 100%);
    color: #000000;
    border: 0;
    border-bottom: 1px solid #8f8f8f;
    border-radius: 6px 6px 0 0;
    font-size: 0.85rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    text-align: center;
    padding: 5px 66px;
    text-shadow: 0 1px 0 #ffffff;
}

:root[data-theme="macosx"] .rooms-panel h2::before,
:root[data-theme="macosx"] .auth-panel h2::before,
:root[data-theme="macosx"] .side-panel h2::before,
:root[data-theme="macosx"] .faq-section-title::before,
:root[data-theme="macosx"] .faq-title::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 50%;
    width: 12px;
    height: 12px;
    margin-top: -6px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 30%, #ffb3a8 0%, #ff5f52 45%, #c8291d 100%);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 18px 0 0 0 #f7bd3b, 18px 0 0 1px rgba(0, 0, 0, 0.35), 36px 0 0 0 #3ec84a, 36px 0 0 1px rgba(0, 0, 0, 0.35);
}

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

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

:root[data-theme="macosx"] .faq-title {
    font-size: 1rem;
    font-weight: 700;
    border: 1px solid #8a8a8a;
    border-radius: 7px;
    box-shadow: 0 6px 18px var(--shadow);
}

/* The room bar and the page headers: a toolbar. */
:root[data-theme="macosx"] .chat-top {
    margin: -12px -12px 0;
    padding: 6px 12px;
    background: linear-gradient(180deg, #f4f4f4 0%, #d6d6d6 100%);
    border-bottom: 1px solid #8f8f8f;
    border-radius: 6px 6px 0 0;
}

:root[data-theme="macosx"] .app-header,
:root[data-theme="macosx"] .admin-header {
    background: linear-gradient(180deg, #f4f4f4 0%, #cfcfcf 100%);
}

:root[data-theme="macosx"] .chat-top h2,
:root[data-theme="macosx"] .brand-name {
    text-transform: none;
    letter-spacing: 0;
    text-shadow: 0 1px 0 #ffffff;
}

:root[data-theme="macosx"] .section-title {
    background: linear-gradient(180deg, #f4f4f4 0%, #d6d6d6 100%);
    color: #000000;
    border: 1px solid #8f8f8f;
    border-radius: 5px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 700;
}

/* ── Buttons: gel pills ────────────────────────────────────────────────── */

:root[data-theme="macosx"] .button {
    color: #000000;
    background: var(--aqua-gloss), var(--aqua-white);
    border: 1px solid #707070;
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    padding-left: 16px;
    padding-right: 16px;
    font-weight: 400;
}

:root[data-theme="macosx"] .rooms-list .room-item > .button {
    border-radius: 6px;
}

:root[data-theme="macosx"] .button:hover {
    border-color: #555555;
}

/* Default button and pressed buttons: blue gel. */
:root[data-theme="macosx"] .button.primary,
:root[data-theme="macosx"] .button:active,
:root[data-theme="macosx"] .button.active {
    color: #000000;
    background: var(--aqua-gloss), var(--aqua-blue);
    border-color: #1c4f9c;
}

:root[data-theme="macosx"] .button.active {
    font-weight: 700;
}

:root[data-theme="macosx"] .button:active {
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.45);
}

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

:root[data-theme="macosx"] textarea,
:root[data-theme="macosx"] input:not([type="checkbox"]):not([type="radio"]),
:root[data-theme="macosx"] .admin-textarea,
:root[data-theme="macosx"] .message-pane,
:root[data-theme="macosx"] .ai-log-scroll {
    background-color: #ffffff;
    border: 1px solid #8c8c8c;
    border-top-color: #5e5e5e;
    border-radius: 0;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

:root[data-theme="macosx"] textarea:focus,
:root[data-theme="macosx"] input:focus,
:root[data-theme="macosx"] select:focus,
:root[data-theme="macosx"] .button:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 0;
}

/* Pop-up button: white gel with the blue double-arrow cap on the right. */
:root[data-theme="macosx"] select {
    appearance: none;
    -webkit-appearance: none;
    color: #000000;
    border: 1px solid #707070;
    border-radius: 5px;
    padding-right: 30px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    background:
        url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='12' viewBox='0 0 8 12'%3E%3Cpath d='M4 0l4 5H0zM4 12L0 7h8z' fill='%23fff'/%3E%3C/svg%3E") no-repeat right 7px center,
        var(--aqua-gloss) right / 22px 100% no-repeat,
        var(--aqua-blue) right / 22px 100% no-repeat,
        var(--aqua-gloss),
        var(--aqua-white);
}

:root[data-theme="macosx"] .status-pill {
    background: #ffffff;
    border: 1px solid #8c8c8c;
    border-radius: 999px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

:root[data-theme="macosx"] .ai-fieldset {
    border: 1px solid #b5b5b5;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.35);
}

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

:root[data-theme="macosx"] .message,
:root[data-theme="macosx"] .msg-row,
:root[data-theme="macosx"] .faq-item {
    background: #f2f2f2;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
}

:root[data-theme="macosx"] .msg-row,
:root[data-theme="macosx"] .faq-item {
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.85);
}

:root[data-theme="macosx"] .message.own {
    background: #d7e8fd;
    border-color: #9fc3ee;
}

:root[data-theme="macosx"] .message.mentions-me {
    background: #fff8d6;
    border-color: #e0c46a;
    border-left: 4px solid #d99a00;
}

:root[data-theme="macosx"] .message-header {
    font-family: Monaco, Menlo, "Courier New", monospace;
}

:root[data-theme="macosx"] .participant {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #c9c9c9;
    border-radius: 6px;
}

:root[data-theme="macosx"] .participant.outside {
    border-style: dashed;
    background: rgba(255, 255, 255, 0.6);
}

/* Menus: translucent white with the blue selection. */
:root[data-theme="macosx"] .mention-list {
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid #b0b0b0;
    border-radius: 6px;
    box-shadow: 0 4px 12px var(--shadow);
}

:root[data-theme="macosx"] .mention-list li.active,
:root[data-theme="macosx"] .mention-list li:hover {
    background: linear-gradient(180deg, #4f8fe8, #1f5fcf);
    color: #ffffff;
}

:root[data-theme="macosx"] .mention {
    color: #0b4fa8;
    background: #dceafc;
    border-radius: 3px;
}

:root[data-theme="macosx"] .history-indicator {
    background: #fffbe0;
    border-color: #b5a24a;
    border-radius: 6px;
}

:root[data-theme="macosx"] .admin-table {
    background: #ffffff;
    border: 1px solid #8c8c8c;
}

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

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

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

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