/* ChatHR — ChatGPT-inspired styling (light + dark). */

:root {
        --chathr-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
        --chathr-max: 48rem;

        --bg: #ffffff;
        --text: #0d0d0d;
        --secondary: #5d5d5d;
        --muted: #9b9b9b;
        --user-bubble: #f4f4f4;
        --input-bg: #ffffff;
        --input-border: rgba(13, 13, 13, 0.14);
        --input-shadow: 0 0 0 1px rgba(0, 0, 0, 0.02), 0 6px 18px rgba(0, 0, 0, 0.06);
        --header-bg: rgba(255, 255, 255, 0.8);
        --send-bg: #0d0d0d;
        --send-fg: #ffffff;
        --send-disabled-bg: #e3e3e3;
        --send-disabled-fg: #ffffff;
        --hover: #ececec;
        --avatar-bg: #0d0d0d;
        --avatar-fg: #ffffff;
        --border: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
        /* Dark mode intentionally disabled — ChatHR is light mode only. */
}

* {
        box-sizing: border-box;
}

html,
body.chathr-body {
        margin: 0;
        padding: 0;
        height: 100%;
        width: 100%;
        overflow: hidden;
        background: var(--bg);
}

.chathr-app {
        font-family: var(--chathr-font);
        background: var(--bg);
        color: var(--text);
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        -webkit-font-smoothing: antialiased;
        text-rendering: optimizeLegibility;
        transition: background-color 0.25s ease, color 0.25s ease;
}

/* ---------- Header ---------- */
.chathr-header {
        position: sticky;
        top: 0;
        z-index: 10;
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 54px;
        padding: 0 12px;
        background: var(--header-bg);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
}

.chathr-header-left,
.chathr-header-right {
        display: flex;
        align-items: center;
        gap: 2px;
}

.chathr-brand {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        border: 0;
        background: transparent;
        color: var(--text);
        font-family: inherit;
        font-size: 17px;
        font-weight: 600;
        letter-spacing: -0.01em;
        padding: 8px 10px;
        border-radius: 10px;
        cursor: pointer;
        transition: background-color 0.15s ease;
}

.chathr-brand:hover {
        background: var(--hover);
}

.chathr-brand .chathr-chevron {
        color: var(--muted);
        display: inline-flex;
}

.chathr-icon-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border: 0;
        background: transparent;
        color: var(--text);
        border-radius: 10px;
        cursor: pointer;
        transition: background-color 0.15s ease, transform 0.15s ease;
}

.chathr-icon-btn:hover {
        background: var(--hover);
}

.chathr-icon-btn:active {
        transform: scale(0.92);
}

/* ---------- Thread ---------- */
.chathr-main {
        flex: 1 1 auto;
        overflow-y: auto;
        overflow-x: hidden;
        scroll-behavior: smooth;
}

.chathr-thread {
        width: 100%;
        max-width: var(--chathr-max);
        margin: 0 auto;
        padding: 28px 20px 12px;
        display: flex;
        flex-direction: column;
        gap: 6px;
}

.chathr-msg {
        display: flex;
        gap: 14px;
        padding: 10px 0;
        animation: chathr-rise 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes chathr-rise {
        from {
                opacity: 0;
                transform: translateY(8px);
        }
        to {
                opacity: 1;
                transform: translateY(0);
        }
}

.chathr-msg-user {
        justify-content: flex-end;
}

.chathr-avatar {
        flex: 0 0 auto;
        width: 30px;
        height: 30px;
        border-radius: 50%;
        background: var(--avatar-bg);
        color: var(--avatar-fg);
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: 2px;
}

.chathr-msg-assistant .chathr-bubble {
        max-width: 100%;
        padding-top: 4px;
        color: var(--text);
        font-size: 16px;
        line-height: 1.75;
        word-wrap: break-word;
}

.chathr-msg-user .chathr-bubble {
        max-width: 75%;
        background: var(--user-bubble);
        color: var(--text);
        padding: 10px 16px;
        border-radius: 22px;
        font-size: 16px;
        line-height: 1.6;
        white-space: pre-wrap;
        word-wrap: break-word;
}

.chathr-text {
        white-space: pre-wrap;
}

.chathr-cursor {
        display: inline-block;
        width: 8px;
        height: 1.05em;
        margin-left: 1px;
        vertical-align: text-bottom;
        background: var(--text);
        border-radius: 1px;
        animation: chathr-blink 1s steps(2, start) infinite;
}

@keyframes chathr-blink {
        50% {
                opacity: 0;
        }
}

/* ---------- Typing dots ---------- */
.chathr-typing {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        height: 28px;
}

.chathr-typing span {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--secondary);
        opacity: 0.5;
        animation: chathr-bounce 1.2s infinite ease-in-out;
}

.chathr-typing span:nth-child(2) {
        animation-delay: 0.18s;
}

.chathr-typing span:nth-child(3) {
        animation-delay: 0.36s;
}

@keyframes chathr-bounce {
        0%,
        60%,
        100% {
                transform: translateY(0);
                opacity: 0.4;
        }
        30% {
                transform: translateY(-5px);
                opacity: 1;
        }
}

/* ---------- Composer ---------- */
.chathr-composer-wrap {
        flex: 0 0 auto;
        width: 100%;
        max-width: var(--chathr-max);
        margin: 0 auto;
        padding: 6px 20px 14px;
}

.chathr-composer {
        display: flex;
        align-items: flex-end;
        gap: 6px;
        background: var(--input-bg);
        border: 1px solid var(--input-border);
        border-radius: 28px;
        padding: 8px 8px 8px 12px;
        box-shadow: var(--input-shadow);
        transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chathr-composer:focus-within {
        border-color: var(--input-border);
}

.chathr-attach {
        flex: 0 0 auto;
        width: 36px;
        height: 36px;
        border: 0;
        background: transparent;
        color: var(--secondary);
        border-radius: 50%;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: background-color 0.15s ease;
}

.chathr-attach:hover {
        background: var(--hover);
}

.chathr-input {
        flex: 1 1 auto;
        border: 0;
        outline: none;
        resize: none;
        background: transparent;
        color: var(--text);
        font-family: inherit;
        font-size: 16px;
        line-height: 1.5;
        max-height: 200px;
        padding: 8px 4px;
        overflow-y: auto;
}

.chathr-input::placeholder {
        color: var(--muted);
}

.chathr-send {
        flex: 0 0 auto;
        width: 36px;
        height: 36px;
        border: 0;
        border-radius: 50%;
        background: var(--send-bg);
        color: var(--send-fg);
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: background-color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.chathr-send:hover:not(:disabled) {
        opacity: 0.85;
}

.chathr-send:active:not(:disabled) {
        transform: scale(0.9);
}

.chathr-send:disabled {
        background: var(--send-disabled-bg);
        color: var(--send-disabled-fg);
        cursor: default;
}

.chathr-disclaimer {
        text-align: center;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.4;
        margin-top: 10px;
}

.chathr-credit {
        text-align: center;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.4;
        margin-top: 4px;
}

.chathr-credit a {
        color: var(--secondary);
        text-decoration: underline;
        text-underline-offset: 2px;
        transition: color 0.15s ease;
}

.chathr-credit a:hover {
        color: var(--text);
}

/* ---------- Scrollbar ---------- */
.chathr-main::-webkit-scrollbar {
        width: 8px;
}

.chathr-main::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 8px;
}

.chathr-main::-webkit-scrollbar-track {
        background: transparent;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
        .chathr-thread {
                padding: 18px 14px 8px;
        }
        .chathr-composer-wrap {
                padding: 6px 12px 12px;
        }
        .chathr-msg-user .chathr-bubble {
                max-width: 85%;
        }
}

/* ---------- Toast ---------- */
.chathr-toast {
        position: fixed;
        left: 50%;
        bottom: 104px;
        transform: translate(-50%, 12px);
        background: var(--text);
        color: var(--bg);
        font-size: 14px;
        font-weight: 500;
        padding: 11px 18px;
        border-radius: 999px;
        box-shadow: 0 10px 34px rgba(0, 0, 0, 0.22);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease, transform 0.25s ease;
        z-index: 50;
        max-width: 90vw;
        text-align: center;
}

.chathr-toast-show {
        opacity: 1;
        transform: translate(-50%, 0);
}

/* ---------- Certificate modal ---------- */
.chathr-modal-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
        z-index: 100;
        animation: chathr-fade 0.2s ease both;
}

.chathr-modal-overlay[hidden] { display: none !important; }


@keyframes chathr-fade {
        from {
                opacity: 0;
        }
        to {
                opacity: 1;
        }
}

.chathr-modal {
        width: 100%;
        max-width: 540px;
        animation: chathr-pop 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes chathr-pop {
        from {
                opacity: 0;
                transform: translateY(14px) scale(0.97);
        }
        to {
                opacity: 1;
                transform: translateY(0) scale(1);
        }
}

.chathr-cert {
        background: #fffdf7;
        color: #1a1a1a;
        border: 1px solid #e6ddc4;
        border-top: 6px solid #0d0d0d;
        border-radius: 16px;
        box-shadow: 0 24px 70px rgba(0, 0, 0, 0.4);
        padding: 40px 34px;
}

.chathr-cert-frame {
        border: 1.5px double #d9cfae;
        border-radius: 12px;
        padding: 30px 24px;
        text-align: center;
}

.chathr-cert-seal {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #0d0d0d;
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto 14px;
}

.chathr-cert-kicker {
        text-transform: uppercase;
        letter-spacing: 0.24em;
        font-size: 11.5px;
        color: #8a7a53;
        margin-bottom: 8px;
}

.chathr-cert-title {
        font-size: 24px;
        line-height: 1.25;
        margin: 0 0 16px;
        font-weight: 700;
        letter-spacing: -0.01em;
        color: #141414;
}

.chathr-cert-text {
        font-size: 15.5px;
        line-height: 1.7;
        color: #383838;
        max-width: 42ch;
        margin: 0 auto 12px;
}

.chathr-cert-fine {
        font-size: 12px;
        font-style: italic;
        color: #9a9a9a;
        margin: 0 0 20px;
}

.chathr-cert-meta {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        font-size: 12px;
        color: #7a7a7a;
        border-top: 1px dashed #ddd3b8;
        padding-top: 14px;
}

.chathr-cert-sign {
        margin-top: 14px;
        font-size: 13px;
        color: #444;
}

.chathr-modal-actions {
        display: flex;
        gap: 10px;
        justify-content: center;
        margin-top: 16px;
        flex-wrap: wrap;
}

.chathr-btn {
        border: 1px solid var(--input-border);
        background: var(--bg);
        color: var(--text);
        font-family: inherit;
        font-size: 14px;
        font-weight: 600;
        padding: 10px 20px;
        border-radius: 999px;
        cursor: pointer;
        transition: opacity 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
}

.chathr-btn:hover {
        background: var(--hover);
}

.chathr-btn:active {
        transform: scale(0.96);
}

.chathr-btn-primary {
        background: var(--send-bg);
        color: var(--send-fg);
        border-color: transparent;
}

.chathr-btn-primary:hover {
        opacity: 0.85;
        background: var(--send-bg);
}

@media (max-width: 640px) {
        .chathr-cert {
                padding: 28px 20px;
        }
        .chathr-cert-frame {
                padding: 24px 16px;
        }
        .chathr-cert-title {
                font-size: 21px;
        }
}
