/* WAI-Core: src/app/static/css/shell/chat/chat.css v10 */

/*==============================
=         CONTAINER           =
==============================*/

.chat-container {
    z-index: 2000;
    display: flex;
}

/*==============================
=         CHAT BOX            =
==============================*/

.chat-box {
    position: fixed;
    bottom: 10px;
    right: 10px;
    width: 500px;
    max-width: 90vw;
    max-height: 0;
    background: #111;
    border-radius: 16px;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    z-index: 100000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 5px -10px 10px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease-in-out;
}

.chat-box.active {
    opacity: 1;
    max-height: 78vh;
    height: 600px;
    padding: 10px;
    visibility: visible;
    transform: translateY(0);
}

/*==============================
=         CHAT HEADER         =
==============================*/

.chat-header {
    background-color: #222255;
    color: white;
    padding: 6px;
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: bold;
    font-size: 1.2em;
    cursor: move;
}

.chat-user-select {
    background-color: #333366;
    color: #fff;
    border: 1px solid #777;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    max-width: 200px;
}

.chat-user-select option {
    background-color: #222255;
    color: #fff;
}

.chat-tools-button,
.clear-chat,
.chat-close-button {
    background: none;
    border: none;
    color: white;
    font-size: 1.1em;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s ease;
}

.chat-tools-button:hover {
    color: #ffaa33;
}

.clear-chat:hover,
.chat-close-button:hover {
    color: #ff6666;
}

/* File: src/app/static/css/shell/chat/chat.css */

/*==============================
=       STATUS SELECTOR       =
==============================*/

.chat-status-select {
    background-color: #222255;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 0.95em;
    font-weight: normal;
    cursor: pointer;
    margin-left: 10px;
    max-width: 140px;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23ccc" height="20" viewBox="0 0 24 24" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    padding-right: 24px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.chat-status-select option {
    background-color: #222255;
    color: #ccc;
}


/*==============================
=         TOOL POPUP          =
==============================*/

#chat-tools-popup {
    position: absolute;
    right: 15px;
    top: 45px;
    background: #1a1a1a;
    color: #f0f0f0;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 12px 14px;
    font-size: 13px;
    max-width: 320px;
    z-index: 999;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
    line-height: 1.4em;
    white-space: normal;
}

#chat-tools-popup.hidden {
    display: none;
}

#chat-tools-popup h4 {
    margin-bottom: 8px;
    font-size: 14px;
    color: #ffaa33;
    border-bottom: 1px solid #333;
    padding-bottom: 6px;
}

#chat-tools-popup ul {
    padding-left: 16px;
    list-style: disc;
    margin: 0;
}

#chat-tools-popup li {
    margin-bottom: 8px;
}

#chat-tools-popup code {
    color: #ffdd88;
    font-weight: bold;
}

/*==============================
=         MESSAGES            =
==============================*/

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, rgba(80,80,80,0.9), rgba(120,120,120,0.9));
    border-radius: 0 0 12px 12px;
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.1);
}

.user-message,
.self-message,
.daemon-message {
    margin-bottom: 8px;
    padding: 8px;
    border-radius: 12px;
    max-width: 95%;
    word-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: 3px 2px 3px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s ease;
}

.server-message {
    color: #fff;
    background: none;
    border: none;
    font-size: 0.85em;
    font-style: italic;
    padding: 4px 8px;
    margin: 4px 0;
    align-self: center;
    text-align: center;
    box-shadow: none;
}

.user-message {
    background-color: #555588;
    color: white;
    align-self: flex-start;
    text-align: left;
}

.self-message {
    background-color: #4a7aa3;
    color: white;
    align-self: flex-end;
    text-align: right;
    margin-left: 30px;
    padding: 8px;
    border-radius: 12px;
    max-width: 95%;
    word-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.daemon-message {
    background-color: seagreen;
    color: white;
}

/*==============================
=         CHAT FOOTER         =
==============================*/

.chat-footer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 8px 12px;
    margin-right: 0;
    border: 2px solid #555;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(80,80,80,0.9), rgba(120,120,120,0.9));
    color: #fff;
    outline: none;
    transition: all 0.3s ease;
}

.chat-input:focus {
    box-shadow: 0 0 8px #d17218;
}

.chat-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-action-button {
    appearance: none;
    background: linear-gradient(135deg, rgba(209, 114, 24, 0.9), rgba(255, 165, 66, 0.9));
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-action-button:hover,
.chat-action-button:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    outline: none;
}

.chat-action-button:active {
    transform: scale(0.95);
}

.chat-action-icon {
    width: 40px;
    height: 40px;
}

.chat-send-button {
    background: linear-gradient(135deg, rgba(209, 114, 24, 0.95), rgba(255, 180, 90, 0.95));
}

.chat-voice-button {
}

.chat-voice-button.recording {
    background: linear-gradient(135deg, rgba(212, 63, 63, 0.95), rgba(255, 115, 115, 0.95));
    animation: chat-voice-recording 1.2s ease-in-out infinite;
}

@keyframes chat-voice-recording {
    0% {
        box-shadow: 0 0 0 0 rgba(212, 63, 63, 0.6);
        transform: scale(1);
    }
    60% {
        box-shadow: 0 0 0 10px rgba(212, 63, 63, 0);
        transform: scale(1.05);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(212, 63, 63, 0);
        transform: scale(1);
    }
}

/*==============================
=        REPLY PREVIEW        =
==============================*/

.reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    margin-right: 8px;
    margin-bottom: 4px;
    font-size: 0.9em;
}

.reply-preview.hidden {
    display: none;
}

.reply-preview .cancel-reply {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 1em;
}

.reply-to {
    font-size: 0.8em;
    background-color: rgba(0,0,0,0.3);
    border-left: 2px solid #ffaa33;
    padding: 2px 6px;
    margin-bottom: 4px;
    border-radius: 4px;
}

.reply-btn {
    cursor: pointer;
    font-size: 0.8em;
    color: #ccc;
    margin-left: 6px;
}

.reply-btn:hover {
    color: #fff;
}

/*==============================
=        STATUS BAR           =
==============================*/

.chat-status-bar {
    padding: 4px;
    background-color: #111;
    color: #999;
    font-size: 0.9em;
    border-bottom: 1px solid #555;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
}

.chat-status-bar .chat-status-modifier::before {
    content: ">";
    margin-right: 5px;
    color: #999;
}

.chat-status-bar .chat-status-modifier:first-child::before {
    content: "";
    margin-right: 0;
}

.chat-status-modifier.clickable {
    cursor: pointer;
}

/*==============================
=      TYPING INDICATOR       =
==============================*/

.typing-indicator {
    display: none;
    align-items: center;
    margin: 10px;
    gap: 6px;
}

.typing-indicator.typing-indicator--visible {
    display: flex;
}

.typing-indicator .dot {
    height: 10px;
    width: 10px;
    background-color: #d17218;
    border-radius: 50%;
    animation: typing-indicator-bounce 1.2s infinite ease-in-out;
    opacity: 0.25;
}

.typing-indicator .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-indicator-bounce {
    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.25;
    }

    30% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/*==============================
=        CONTEXT PANEL        =
==============================*/

.chat-context {
    display: flex;
    align-items: center;
    overflow-x: auto;
    gap: 10px;
    background-color: #111;
    border: 1px solid #555;
    border-radius: 5px;
    white-space: nowrap;
    margin-bottom: 10px;
}

#context-list {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
}

#context-list .object {
    display: inline-block;
    color: #fff;
    transition: transform 0.2s ease, background-color 0.3s ease;
}

#context-list .object:hover {
    background-color: #bf620f;
    transform: scale(1.05);
}

.chat-context::-webkit-scrollbar {
    height: 8px;
}

.chat-context::-webkit-scrollbar-thumb {
    background-color: #555;
    border-radius: 4px;
}

.chat-context::-webkit-scrollbar-thumb:hover {
    background-color: #777;
}

/*==============================
=        UNREAD BUBBLE        =
==============================*/

.chat-unread-badge {
    background-color: rgba(209, 114, 24, 1);
    color: white;
    font-size: 0.75em;
    font-weight: bold;
    padding: 4px 7px;
    border-radius: 999px;
    position: absolute;
    z-index: 2000;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
    opacity: 1;
    top: 10px;
    right: 10px;
}

.chat-unread-popup {
    position: absolute;
    left: 80px;
    bottom: 80px;
    background-color: #1a1a1a;
    border: 1px solid #444;
    color: white;
    padding: 10px;
    border-radius: 6px;
    z-index: 3001;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    min-width: 180px;
}

.chat-unread-popup.hidden {
    display: none;
}

.chat-unread-popup ul {
    margin: 0;
    padding-left: 16px;
    list-style: disc;
}

.chat-unread-popup li {
    cursor: pointer;
    margin-bottom: 6px;
}

.chat-unread-popup li:hover {
    color: #ffaa33;
}

.chat-user-select.has-unread {
    border-color: #d17218;
    box-shadow: 0 0 4px #d17218;
}

/* WAI-Core: src/app/static/css/shell/chat/chat.css v5 (anonymous input block) */

#submit-name-form {
    background: linear-gradient(135deg, rgba(80,80,80,0.9), rgba(120,120,120,0.9));
    height: 100%;
    width: 100%;
}

#submit-name {
    padding: 16px;
    background-color: var(--brand-color-container-foreground-light);
    border-radius: 12px;
    border: 1px solid #333;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
    margin: 10px;
    color: white;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#submit-name input[type="text"] {
    padding: 10px 14px;
    border-radius: 8px;
    border: 2px solid #555;
    color: black;
    font-size: 1em;
    outline: none;
    transition: box-shadow 0.2s ease;
}

#submit-name input[type="text"]:focus {
    box-shadow: 0 0 8px #d17218;
    border-color: #d17218;
}

#submit-name button {
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    background-color: #d17218;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

#submit-name button:hover {
    background-color: #bf620f;
}

#submit-name label {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 4px;
    display: block;
    color: #ffaa33;
}

.chat-login-required {
    padding: 20px;
    text-align: center;
    color: #fff;
    background-color: var(--brand-color-container-background);
    border-radius: var(--brand-border-radius);
    margin: 20px;
}

.chat-login-required p {
    margin-bottom: 12px;
    font-size: 1.1em;
}

.chat-login-required a {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--brand-color-cta);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: bold;
}

.chat-login-required a:hover {
    background-color: var(--brand-color-cta-hover);
}
