/* AI Chat Container */
.ai-chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: transparent;
    border-radius: 0;
    overflow: hidden;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    padding: 0 10px 0 0;
    box-sizing: border-box;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Message Styles */
.message {
    display: flex;
    max-width: 100%;
    width: 100%;
    gap: 6px;
    animation: fadeIn 0.3s ease-out;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.ai-message {
    align-self: flex-start;
}

.message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.2);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    margin-top: 4px;
}

.ai-avatar {
    background: rgba(29, 12, 70, 0.2);
    color: var(--text);
}

.message-content {
    padding: 4px 10px 4px 6px;
    border-radius: 12px;
    line-height: 1.25;
    font-size: 14px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.user-message .message-content {
    background: rgba(29, 12, 70, 0.15);
    color: var(--text);
    border-bottom-right-radius: 4px;
    backdrop-filter: blur(5px);
}

.ai-message .message-content {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(5px);
}

/* Campaign Summary - Compact */
.dashboard-header {
    margin: 0;
    padding: 4px 10px 0 10px;
}

.campaign-summary {
    margin: 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.campaign-summary h3 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 6px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    width: 100%;
}

.summary-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 6px;
    border-radius: 6px;
    text-align: center;
    border: 1px solid var(--glass-border);
}

.summary-item.highlight {
    background: rgba(124, 58, 237, 0.1);
    border-color: rgba(124, 58, 237, 0.3);
}

.summary-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    line-height: 1.2;
}

.summary-label {
    font-size: 11px;
    color: var(--text-secondary);
    opacity: 0.8;
    line-height: 1.2;
}

.positive, .highlight {
    font-size: 0.85em;
    white-space: nowrap;
}

.positive {
    color: #10b981;
    font-size: 0.9em;
}

.highlight {
    color: #7c3aed;
}

/* Traffic Sources */
.traffic-sources {
    margin: 20px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--glass-border);
}

.traffic-sources h4 {
    margin: 0 0 16px 0;
    font-size: 15px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.traffic-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
    table-layout: fixed;
}

.traffic-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    font-weight: 600;
    padding: 8px 0;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text);
}

.traffic-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    padding: 6px 0;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text);
    gap: 8px;
}

.ai-conclusion {
    margin: 5px 0 0 0;
    padding: 8px 0 0 0;
    border-top: 1px solid var(--border-light);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

.traffic-row:last-child {
    border-bottom: none;
}

/* Chain Distribution */
.chain-distribution {
    margin-top: 20px;
}

.chain-distribution h5 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: var(--text);
}

.chain-bars {
    display: flex;
    height: 28px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.chain-bar {
    height: 100%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

/* Key Findings */
.key-findings {
    margin-top: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

.key-findings h4 {
    margin: 0 0 10px 0;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    display: block;
}

.confidence-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.findings-list {
    margin: 0;
    padding: 0 0 0 16px;
    list-style-type: none;
}

.findings-list li {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
    margin-bottom: 6px;
    position: relative;
}

.findings-list li:before {
    content: "•";
    color: var(--primary);
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
    position: absolute;
    left: -12px;
}

.findings-list li:last-child {
    margin-bottom: 0;
}

.findings-list strong {
    color: var(--text);
    font-weight: 600;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary);
    border: 1px solid rgba(124, 58, 237, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: rgba(124, 58, 237, 0.2);
    transform: translateY(-1px);
}

.action-btn i {
    font-size: 12px;
}

/* Chat Input */
.chat-input-container {
    display: flex;
    padding: 12px 10px 0 10px;
    background: transparent;
    margin: 8px 0 0 0;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.chat-input {
    flex: 1;
    padding: 10px 18px;
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.12));
    border-radius: 20px;
    background: transparent;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.chat-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Light mode specific styles */
@media (prefers-color-scheme: light) {
    .chat-input {
        border-color: rgba(0, 0, 0, 0.15);
        background: rgba(255, 255, 255, 0.1);
    }
    
    .chat-input:focus {
        border-color: var(--primary);
        background: rgba(255, 255, 255, 0.15);
        box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.2);
    }
}

/* Dark mode specific styles */
@media (prefers-color-scheme: dark) {
    .chat-input {
        border-color: rgba(255, 255, 255, 0.1);
        background: rgba(30, 30, 30, 0.2);
    }
    
    .chat-input:focus {
        border-color: var(--primary);
        background: rgba(30, 30, 30, 0.3);
        box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.3);
    }
}

/* Send button adjustments */
.send-button {
    width: 40px;
    height: 40px;
    margin-left: 8px;
    border: 1px solid var(--border-light, rgba(0, 0, 0, 0.1));
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.send-button:hover {
    background: rgba(124, 58, 237, 0.2);
    transform: translateY(-1px);
}

/* Ensure the chat container has proper spacing */
.ai-chat-container {
    padding-bottom: 10px;
}

.send-button {
    width: 40px;
    height: 40px;
    margin-left: 8px;
    border: none;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.15);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.send-button:hover {
    background: rgba(124, 58, 237, 0.25);
    transform: translateY(-1px);
}

.send-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .traffic-header,
    .traffic-row {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }
    
    .traffic-header div:nth-child(5),
    .traffic-row div:nth-child(5) {
        display: none;
    }
}

@media (max-width: 768px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .traffic-header,
    .traffic-row {
        grid-template-columns: 2fr 1fr 1fr;
    }
    
    .traffic-header div:nth-child(4),
    .traffic-row div:nth-child(4) {
        display: none;
    }
}

@media (max-width: 480px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .summary-item {
        padding: 6px 4px;
    }
    
    .summary-value {
        font-size: 13px;
    }
    
    .summary-label {
        font-size: 10px;
    }
    
    .traffic-header,
    .traffic-row {
        grid-template-columns: 2fr 1fr;
    }
    
    .traffic-header div:nth-child(3),
    .traffic-row div:nth-child(3) {
        display: none;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }
}
