/* ==========================================================================
   Rich Tool Renderers
   ========================================================================== */

/* Common tool styling additions */
.tool-meta {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 1;
}

.tool-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: rgba(127, 132, 156, 0.2);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tool-badge.background {
    background: rgba(224, 175, 104, 0.2);
    color: #e0af68;
}

/* TodoWrite Tool */
.todowrite-tool {
    background: rgba(158, 206, 106, 0.08);
    border-left-color: var(--success);
}

.todo-list {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.todo-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.todo-status {
    flex-shrink: 0;
    width: 1.2rem;
    text-align: center;
    font-weight: bold;
}

.todo-content {
    flex: 1;
    color: var(--text-primary);
}

.todo-item.pending .todo-status {
    color: var(--text-muted);
}

.todo-item.in-progress .todo-status {
    color: #e0af68;
}

.todo-item.in-progress {
    background: rgba(224, 175, 104, 0.1);
}

.todo-item.completed .todo-status {
    color: var(--success);
}

.todo-item.completed .todo-content {
    color: var(--text-muted);
    text-decoration: line-through;
}

/* AskUserQuestion Tool */
.askuserquestion-tool {
    background: rgba(122, 162, 247, 0.08);
    border-left-color: var(--accent);
}

.question-list {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.question-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 0.75rem;
    border: 1px solid rgba(122, 162, 247, 0.2);
}

.question-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.question-badge {
    background: var(--accent);
    color: var(--bg-darker);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    text-transform: uppercase;
}

.multi-select-badge {
    background: rgba(187, 154, 247, 0.3);
    color: var(--link-color);
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
}

.question-text {
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.question-options {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.option-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.option-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.option-item.selected {
    background: rgba(122, 162, 247, 0.15);
    border-color: var(--accent);
}

.option-icon {
    flex-shrink: 0;
    width: 1.2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.option-item.selected .option-icon {
    color: var(--accent);
}

.option-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.option-label {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

.option-description {
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.3;
}

.question-answer {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(122, 162, 247, 0.2);
    font-size: 0.85rem;
}

.answer-label {
    color: var(--text-muted);
}

.answer-value {
    color: var(--success);
    font-weight: 500;
}

/* ExitPlanMode Tool */
.exitplanmode-tool {
    background: rgba(158, 206, 106, 0.08);
    border-left-color: var(--success);
}

.permissions-section {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.permissions-header {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.permissions-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.permission-item {
    display: flex;
    align-items: baseline;
    font-size: 0.85rem;
    font-family: var(--font-mono);
}

.permission-bullet {
    color: var(--success);
    margin-right: 0.5rem;
}

.permission-tool {
    color: var(--accent);
    font-weight: 500;
}

.permission-separator {
    color: var(--text-muted);
}

.permission-prompt {
    color: var(--text-primary);
}

/* Bash Tool */
.bash-tool {
    background: rgba(127, 132, 156, 0.1);
    border-left-color: var(--text-secondary);
}

.bash-tool .tool-icon {
    color: var(--success);
    font-weight: bold;
}

.bash-tool .tool-use-header {
    min-width: 0;
}

/* Inline code snippets in tool headers (commands, patterns, etc.) */
.bash-command-inline,
.glob-pattern-inline,
.grep-pattern-inline {
    flex: 0 1 auto;
    min-width: 0;
    padding: 0.15rem 0.4rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bash-command-inline {
    max-width: 70%;
}

.tool-header-spacer {
    flex: 1 1 auto;
}

.tool-meta.timeout {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.bash-description {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
    padding: 0.25rem 0;
    margin-top: 0.25rem;
}

.bash-command {
    margin: 0;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Read Tool */
.read-tool {
    background: rgba(122, 162, 247, 0.08);
    border-left-color: var(--accent);
}

.file-path {
    color: var(--accent);
    font-size: 0.85rem;
    word-break: break-all;
}

/* Glob Tool */
.glob-tool {
    background: rgba(122, 162, 247, 0.08);
    border-left-color: var(--accent);
}

.glob-pattern {
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 0.25rem 0;
}

.glob-path {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Grep Tool */
.grep-tool {
    background: rgba(122, 162, 247, 0.08);
    border-left-color: var(--accent);
}

.grep-pattern {
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 0.25rem 0;
}

.grep-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.grep-option {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Task Tool */
.task-tool {
    background: rgba(158, 206, 106, 0.08);
    border-left-color: var(--success);
}

.task-agent-type {
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: rgba(158, 206, 106, 0.2);
    color: var(--success);
}

.task-description {
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: 0.25rem 0;
}

/* WebFetch Tool */
.webfetch-tool {
    background: rgba(122, 162, 247, 0.08);
    border-left-color: var(--accent);
}

.webfetch-url {
    padding: 0.25rem 0;
}

.webfetch-url a {
    color: var(--accent);
    text-decoration: none;
    word-break: break-all;
}

.webfetch-url a:hover {
    text-decoration: underline;
}

.webfetch-prompt {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
}

/* WebSearch Tool */
.websearch-tool {
    background: rgba(122, 162, 247, 0.08);
    border-left-color: var(--accent);
}

.websearch-query {
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 0.25rem 0;
}

/* Thinking Block Styling */
.thinking-block {
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
    border-left: 2px solid var(--border-color);
    opacity: 0.6;
}

.thinking-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.25rem;
}

.thinking-content {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Result Message - Compact stats bar */
.result-message {
    margin-bottom: 0.5rem;
    border: none;
    background: transparent;
}

.result-message .result-stats-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    font-size: 0.8rem;
}

.result-message .result-status {
    font-weight: bold;
}

.result-message .result-status.success {
    color: var(--success);
}

.result-message .result-status.error {
    color: var(--error);
}

.result-message .stat-item {
    color: var(--text-secondary);
    cursor: help;
}

.result-message .stat-item.cost {
    color: var(--success);
    font-weight: 500;
}

.result-message .stat-item.tokens {
    color: var(--text-secondary);
}

.result-message .stat-item.turns {
    color: var(--accent);
}

.result-message.error .stat-item.cost {
    color: var(--error);
}

/* User Message */
.user-message {
    border-left: 3px solid var(--accent);
}

.user-message .user-text {
    color: var(--text-primary);
    line-height: 1.6;
}

/* Error Message */
.error-message-display {
    border-left: 3px solid var(--error);
}

.error-message-display .error-text {
    color: var(--error);
}

.error-type {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.15rem 0.4rem;
    background: rgba(247, 118, 142, 0.15);
    border-radius: 3px;
}

/* Overload/Busy Message */
.overload-message {
    border-left: 3px solid #e0af68;
    background: rgba(224, 175, 104, 0.08);
}

.message-type-badge.overload {
    background: rgba(224, 175, 104, 0.2);
    color: #e0af68;
}

.overload-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.overload-icon {
    font-size: 1.5rem;
    line-height: 1;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.overload-text {
    flex: 1;
}

.overload-title {
    font-weight: 600;
    color: #e0af68;
    margin-bottom: 0.25rem;
}

.overload-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.overload-details {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.overload-details .request-id {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Compaction/Summary Message */
.compaction-message {
    border-left: 3px solid #7aa2f7;
    background: rgba(122, 162, 247, 0.08);
}

.message-type-badge.compaction {
    background: rgba(122, 162, 247, 0.2);
    color: #7aa2f7;
}

.compaction-stat {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.5rem;
}

.compaction-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.compaction-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.compaction-text {
    flex: 1;
}

.compaction-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.compaction-summary {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.compaction-summary .summary-label {
    font-weight: 600;
    color: #7aa2f7;
    font-size: 0.85rem;
}

.compaction-summary .summary-text {
    color: var(--text);
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
}

/* Raw Message */
.raw-message .raw-json {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
}

/* Tooltip styling for native title attribute */
.claude-message [title] {
    position: relative;
}

/* Success/Error state colors */
.result-message.success {
    border-left: 3px solid var(--success);
}

.result-message.error {
    border-left: 3px solid var(--error);
}

