/* ============================================
   Ask Shad Chat
   ============================================ */

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 20px);
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 20px 0;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    flex-shrink: 0;
}

.chat-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.chat-new-btn {
    padding: 6px 14px;
    font-size: 0.8rem;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.15s;
}

.chat-new-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

/* Messages area */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: var(--text-secondary);
    gap: 12px;
    text-align: center;
    padding: 40px 20px;
}

.chat-welcome-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chat-welcome-subtitle {
    font-size: 0.9rem;
    max-width: 400px;
    line-height: 1.5;
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
}

.chat-suggestion {
    padding: 8px 16px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-secondary);
}

.chat-suggestion:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #f0f4ff;
}

/* Message bubbles */

.chat-msg {
    display: flex;
    gap: 12px;
    max-width: 100%;
}

.chat-msg.user {
    flex-direction: row-reverse;
}

.chat-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    flex-shrink: 0;
}

.chat-msg.user .chat-msg-avatar {
    background: var(--accent);
    color: #fff;
}

.chat-msg.assistant .chat-msg-avatar {
    background: var(--bg-sidebar);
    color: #fff;
}

.chat-msg-content {
    max-width: 75%;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.6;
}

.chat-msg.user .chat-msg-content {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-msg.assistant .chat-msg-content {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.chat-msg-content p {
    margin: 0 0 8px;
}

.chat-msg-content p:last-child {
    margin-bottom: 0;
}

.chat-msg-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
    font-size: 0.8rem;
}

.chat-msg-content th,
.chat-msg-content td {
    padding: 6px 10px;
    border: 1px solid var(--border);
    text-align: left;
}

.chat-msg-content th {
    background: var(--hover-bg);
    font-weight: 600;
}

.chat-msg-content code {
    background: var(--hover-bg);
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.8rem;
}

.chat-msg-content strong {
    font-weight: 600;
}

/* Tool calls / progress */

.chat-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.chat-progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: chat-pulse 1s ease-in-out infinite;
}

@keyframes chat-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

.chat-tool-calls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.chat-tool-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: var(--hover-bg);
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Input area */

.chat-input-area {
    padding: 16px 0;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-input-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    resize: none;
    min-height: 42px;
    max-height: 120px;
    outline: none;
    transition: border-color 0.15s;
    line-height: 1.5;
}

.chat-input:focus {
    border-color: var(--accent);
}

.chat-send-btn {
    padding: 10px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.chat-send-btn:hover {
    background: var(--accent-hover);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
