/*
What this file does:
- Full path: /var/www/html/ai_agent/style.css
- Provides the dark AI Agent shared workspace UI
- Makes the assistant page a left-to-right three column layout
- Left column shows online users, middle column shows general chat, right column shows assistant chat
*/

:root {
    --app-bg: #0f1115;
    --panel-bg: #171a21;
    --panel-soft: #11141a;
    --input-bg: #0f131a;
    --border: #2b3240;
    --border-strong: #323b4d;
    --text: #eef2f7;
    --muted: #9aa6bb;
    --primary: #3d73ff;
    --primary-hover: #285ce0;
    --bubble: #1b2029;
    --success: #24cca1;
}

body {
    background:
        radial-gradient(circle at top left, rgba(61, 115, 255, 0.14), transparent 34%),
        radial-gradient(circle at bottom right, rgba(36, 204, 161, 0.08), transparent 30%),
        var(--app-bg);
    color: var(--text);
    font-family: Inter, Arial, sans-serif;
    margin: 0;
    min-height: 100vh;
}

.app-shell {
    width: min(1780px, calc(100vw - 28px));
    max-width: none;
}

.panel-card {
    background: rgba(23, 26, 33, 0.96);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.panel-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    color: #ffffff;
}

.panel-subtitle,
.small-note,
.status-line {
    color: var(--muted);
}

.login-card {
    margin-top: 10vh;
}

.brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(61, 115, 255, 0.16);
    color: #87a6ff;
    border: 1px solid rgba(135, 166, 255, 0.22);
}

.form-label {
    color: #d7deea;
}

.form-control-dark,
.form-control-dark:focus,
.form-control,
.form-control:focus {
    background: var(--input-bg);
    color: var(--text);
    border-color: var(--border-strong);
    box-shadow: none;
}

.form-control-dark::placeholder,
.form-control::placeholder {
    color: #8e99ad;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.assistant-layout {
    max-width: none;
    margin: 0 auto;
}

.assistant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.assistant-user-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.shared-workspace {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) minmax(0, 1fr);
    gap: 14px;
    height: calc(100vh - 142px);
    min-height: 560px;
}

.users-panel,
.chat-panel {
    min-width: 0;
    min-height: 0;
}

.users-panel {
    display: flex;
    flex-direction: column;
}

.chat-panel {
    display: flex;
    flex-direction: column;
}

.chat-panel-title {
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
}

.online-users-list {
    flex: 1;
    overflow-y: auto;
    background: var(--panel-soft);
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    padding: 10px;
}

.online-user-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 8px;
    border-radius: 10px;
    color: #e9ecef;
    border: 1px solid transparent;
}

.online-user-item + .online-user-item {
    margin-top: 6px;
}

.online-user-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.06);
}

.online-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 10px rgba(36, 204, 161, 0.55);
    flex: 0 0 auto;
}

.chat-box {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    background: var(--panel-soft);
    border-radius: 12px;
    border: 1px solid var(--border-strong);
    padding: 14px;
}

.shared-chat-box {
    height: 100%;
}

.chat-row {
    display: flex;
    margin-bottom: 12px;
}

.chat-row.user {
    justify-content: flex-end;
}

.chat-row.assistant {
    justify-content: flex-start;
}

.chat-row.general {
    justify-content: flex-start;
}

.chat-bubble {
    max-width: 88%;
    padding: 12px 14px;
    border-radius: 16px;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.45;
    border: 1px solid #2d3440;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
    background: var(--bubble);
    color: #e9ecef;
}

.chat-row.user .chat-bubble {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.chat-row.assistant .chat-bubble {
    background: #202633;
    border-color: #38445a;
}

.chat-author {
    display: block;
    margin-bottom: 5px;
    color: #b8c4d8;
    font-size: 12px;
    font-weight: 700;
}

.chat-row.user .chat-author {
    color: rgba(255, 255, 255, 0.78);
}

.chat-time {
    display: block;
    margin-top: 6px;
    color: rgba(184, 196, 216, 0.75);
    font-size: 11px;
}

.chat-row.user .chat-time {
    color: rgba(255, 255, 255, 0.7);
}

.empty-chat-note {
    color: var(--muted);
    text-align: center;
    padding: 60px 20px;
}

.small-empty-note {
    padding: 18px 8px;
    font-size: 13px;
}

.assistant-input-wrap {
    flex: 0 0 auto;
}

.chat-input,
#assistantMessage,
#generalMessage {
    resize: none;
    min-height: 96px;
    max-height: 160px;
}

#assistantMessage:focus,
#generalMessage:focus {
    border-color: #4c8dff;
    box-shadow: 0 0 0 0.2rem rgba(76, 141, 255, 0.18);
}

.assistant-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 22px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.35;
    animation: aiAgentTypingBounce 1.2s infinite ease-in-out;
}

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

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

@keyframes aiAgentTypingBounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.35;
    }

    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@media (max-width: 1180px) {
    .shared-workspace {
        grid-template-columns: 180px minmax(0, 1fr) minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .app-shell {
        width: min(100%, calc(100vw - 18px));
    }

    .assistant-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .assistant-user-box {
        width: 100%;
        justify-content: space-between;
    }

    .shared-workspace {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 0;
    }

    .users-panel {
        min-height: 170px;
    }

    .chat-panel {
        min-height: 520px;
    }

    .chat-bubble {
        max-width: 94%;
    }

    .assistant-actions {
        flex-direction: column;
    }

    .assistant-actions .btn {
        width: 100%;
    }
}
