/**
 * Part of LinkMyGoals.com project.
 * GitHub: https://github.com/ChadsCode/LinkMyGoals
 * License: MIT Open-Source
 * Website: https://www.linkmygoals.com/
 *
 * Copyright (c) 2025 Chad Wigington
 * LinkedIn: https://www.linkedin.com/in/chadwigington/
 */

/* Main Content */
.main-content {
    flex: 1;
    margin-top: var(--header-height);
    margin-bottom: var(--footer-height);
    display: flex;
    justify-content: center;
    align-items: stretch;
    padding: 20px;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    overflow: visible;
    flex: 1;
    min-width: 0;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    min-width: 0;
}

.message.user {
    align-self: flex-end;
}

.message.assistant,
.message.system {
    align-self: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    overflow-wrap: break-word;
    word-wrap: break-word;
    max-width: 100%;
    overflow-x: hidden;
}

.message.user .message-content {
    background: var(--pearl);
    color: var(--text-primary);
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: var(--pure);
    color: var(--charcoal);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}

.message.system .message-content {
    background: var(--pure);
    color: var(--charcoal);
    border: 1px solid var(--border);
}

.message-content p {
    margin-bottom: 8px;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

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

/* Post Preview in Chat */
.post-preview {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
    font-family: inherit;
    white-space: pre-wrap;
    line-height: 1.6;
}

.post-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.post-preview-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--linkedin-blue);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.post-preview-actions {
    display: flex;
    gap: 8px;
}

.post-preview-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.post-preview-btn.copy-btn {
    background: transparent;
    color: var(--linkedin-blue);
}

.post-preview-btn.copy-btn:hover {
    background: rgba(10, 102, 194, 0.1);
}

.post-preview-btn.post-btn {
    background: var(--linkedin-blue);
    color: white;
}

.post-preview-btn.post-btn:hover {
    background: #004182;
}

.chat-input-container {
    padding: 20px 24px 28px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.chat-input-wrapper {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--surface);
    overflow: hidden;
}

.chat-input-wrapper:focus-within {
    border-color: var(--linkedin-blue);
    box-shadow: 0 0 0 3px var(--linkedin-blue-alpha);
}

.chat-input-wrapper:has(.chat-input[style*="border-color"]) {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(178, 64, 32, 0.15);
}

.chat-input {
    flex: 1;
    padding: 14px 16px;
    border: none;
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 80px;
    max-height: 500px;
    background: var(--surface);
    color: var(--text-primary);
    overflow-y: hidden;
}

.chat-input:focus {
    outline: none;
}

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

/* Input Footer (inside input wrapper) */
.input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--surface);
    border-top: none;
    flex-wrap: nowrap;
}

.input-actions {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

.input-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.input-action-btn:hover:not(:disabled) {
    color: var(--text-primary);
    background: var(--pearl);
}

.input-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.linkedin-post-btn:not(:disabled) {
    color: #0a66c2;
}

.linkedin-post-btn:not(:disabled):hover {
    background: rgba(10, 102, 194, 0.1);
    color: #0a66c2;
}

.goal-info-btn {
    color: var(--text-secondary);
}

.goal-info-btn:hover {
    color: var(--linkedin-blue);
    background: rgba(10, 102, 194, 0.1);
}

.input-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.input-action-btn:disabled:hover {
    background: transparent;
    color: var(--text-secondary);
}

.send-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border: none;
    background: var(--linkedin-blue);
    color: var(--pure);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.send-btn:hover {
    background: var(--linkedin-blue-dark);
}

.send-btn:disabled {
    background: var(--silver);
    cursor: not-allowed;
}

/* Legacy Chat Actions (if still needed) */
.chat-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover:not(:disabled) {
    border-color: var(--linkedin-blue);
    color: var(--linkedin-blue);
    background: var(--linkedin-blue-alpha);
}

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