/* Agent Intercom Panel Styles
   Dark theme per CLAUDE.md: var(--bg-primary)/#0d1520 backgrounds, #00cfff accent */

.intercom-section {
    padding: 0 16px;
    margin-bottom: 16px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.intercom-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 0;
}

.intercom-tab {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 0.75rem;
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s, transform 0.2s;
}

.intercom-tab:hover {
    color: rgba(255,255,255,0.8);
}

.intercom-tab.active {
    color: #00cfff;
    border-bottom-color: #00cfff;
}

.intercom-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #ff4444;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 4px;
}

.intercom-panel {
    display: none;
}

.intercom-panel.active {
    display: block;
}

/* DM Thread List */
.dm-thread-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dm-thread-item {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.dm-thread-item:hover {
    border-color: rgba(0,207,255,0.4);
}

.dm-thread-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.dm-thread-agent {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
}

.dm-thread-time {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.35);
}

.dm-thread-preview {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dm-thread-unread {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #00cfff;
    color: var(--bg-primary);
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 8px;
}

/* Message Bubbles */
.dm-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

.dm-bubble {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: var(--panel-radius);
    font-size: 0.75rem;
    line-height: 1.4;
    word-wrap: break-word;
}

.dm-bubble.outbound {
    align-self: flex-end;
    background: rgba(0,207,255,0.15);
    border: 1px solid rgba(0,207,255,0.25);
    color: #e2e8f0;
    border-bottom-right-radius: 4px;
}

.dm-bubble.inbound {
    align-self: flex-start;
    background: rgba(19, 23, 40,0.8);
    border: 1px solid var(--panel-border);
    color: #cbd5e1;
    border-bottom-left-radius: 4px;
}

.dm-bubble-sender {
    font-size: 0.75rem;
    font-weight: 600;
    color: #00cfff;
    margin-bottom: 2px;
}

.dm-bubble-time {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.3);
    margin-top: 4px;
    text-align: right;
}

/* DM Compose */
.dm-compose {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.dm-compose input {
    flex: 1;
    background: rgba(19, 23, 40,0.8);
    border: 1px solid var(--panel-border-hover);
    border-radius: 6px;
    padding: 8px 10px;
    color: #e2e8f0;
    font-size: 0.75rem;
    outline: none;
}

.dm-compose input:focus {
    border-color: #00cfff;
}

.dm-compose button {
    background: rgba(0,207,255,0.2);
    border: 1px solid rgba(0,207,255,0.4);
    border-radius: 6px;
    color: #00cfff;
    padding: 8px 14px;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
}

.dm-compose button:hover {
    background: rgba(0,207,255,0.3);
}

/* AgentBook Activity */
.agentbook-post-item {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
}

.agentbook-post-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 4px;
}

.agentbook-post-meta {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
}

.agentbook-post-body {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    margin-top: 4px;
    max-height: 60px;
    overflow: hidden;
}

/* Post Form */
.agentbook-post-form {
    background: rgba(19, 23, 40,0.4);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 12px;
    margin-top: 10px;
}

.agentbook-post-form input,
.agentbook-post-form textarea,
.agentbook-post-form select {
    width: 100%;
    background: rgba(19, 23, 40,0.8);
    border: 1px solid var(--panel-border-hover);
    border-radius: 6px;
    padding: 8px 10px;
    color: #e2e8f0;
    font-size: 0.75rem;
    margin-bottom: 8px;
    outline: none;
    box-sizing: border-box;
}

.agentbook-post-form textarea {
    min-height: 60px;
    resize: vertical;
}

.agentbook-post-form select {
    appearance: auto;
}

/* Discover Agents */
.discover-agent-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.discover-agent-info {
    flex: 1;
}

.discover-agent-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
}

.discover-agent-stats {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
}

.discover-agent-dm-btn {
    background: rgba(0,207,255,0.15);
    border: 1px solid rgba(0,207,255,0.3);
    border-radius: 6px;
    color: #00cfff;
    padding: 10px 14px;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
    min-height: 44px;
}

.discover-agent-dm-btn:hover {
    background: rgba(0,207,255,0.25);
}

/* Empty state */
.intercom-empty {
    text-align: center;
    padding: 24px 16px;
    color: rgba(255,255,255,0.35);
    font-size: 0.75rem;
}

.intercom-empty svg {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
    opacity: 0.3;
}

/* Back button for thread view */
.dm-back-btn {
    background: none;
    border: none;
    color: #00cfff;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 10px 0;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
}

.dm-back-btn:hover {
    text-decoration: underline;
}

/* Start chat button */
.intercom-start-chat-btn {
    display: block;
    width: 100%;
    background: rgba(0,207,255,0.1);
    border: 1px dashed rgba(0,207,255,0.3);
    border-radius: 8px;
    color: #00cfff;
    padding: 10px;
    font-size: 0.75rem;
    cursor: pointer;
    margin-top: 10px;
    text-align: center;
}

.intercom-start-chat-btn:hover {
    background: rgba(0,207,255,0.2);
    border-style: solid;
}

/* Light theme */
[data-theme="light"] .dm-thread-item,
[data-theme="light"] .agentbook-post-item,
[data-theme="light"] .discover-agent-card {
    background: var(--panel-bg);
    border-color: var(--panel-border);
}

[data-theme="light"] .dm-thread-agent,
[data-theme="light"] .agentbook-post-title,
[data-theme="light"] .discover-agent-name {
    color: var(--text-heading);
}

[data-theme="light"] .dm-bubble.outbound {
    background: rgba(0, 207, 255, 0.1);
}

[data-theme="light"] .dm-bubble.inbound {
    background: var(--panel-bg);
}
