/**
 * Cursor IDE-style blocks for reasoning and tool calls
 */

/* ========== Reasoning Block ========== */

.reasoning-block {
    background-color: #f5f5f5;
    border-radius: 8px;
    margin: 12px 0;
    overflow: hidden;
    transition: all 0.2s ease;
}

.reasoning-block-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.reasoning-block-header:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.reasoning-block-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #666;
}

.reasoning-block-toggle {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #888;
    transition: transform 0.2s ease;
}

.reasoning-block.collapsed .reasoning-block-toggle .toggle-icon {
    transform: rotate(0deg);
}

.reasoning-block:not(.collapsed) .reasoning-block-toggle .toggle-icon {
    transform: rotate(180deg);
    display: inline-block;
}

.reasoning-block-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 12px;
}

.reasoning-block:not(.collapsed) .reasoning-block-content {
    max-height: none;
    padding: 0 12px 12px 12px;
}

.reasoning-block-text {
    font-size: 13px;
    color: #666;
    font-style: italic;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Shimmer effect for active reasoning */
.reasoning-shimmer {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: linear-gradient(90deg, #ddd 25%, #bbb 50%, #ddd 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.reasoning-block:not(.active) .reasoning-shimmer {
    display: none;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Finished reasoning block - slightly faded */
.reasoning-block:not(.active) {
    opacity: 0.85;
}

/* ========== Tool Call Block (Collapsible) ========== */

.tool-call-block {
    background-color: #e8f4f8;
    border-radius: 8px;
    margin: 12px 0;
    overflow: hidden;
    transition: all 0.2s ease;
}

.tool-call-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease;
}

.tool-call-header:hover {
    background-color: rgba(44, 82, 130, 0.08);
}

.tool-call-icon {
    font-size: 16px;
    line-height: 1;
}

.tool-call-message {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #2c5282;
}

.tool-call-toggle {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #2c5282;
    transition: transform 0.2s ease;
}

.tool-call-block.collapsed .tool-call-toggle .toggle-icon {
    transform: rotate(0deg);
}

.tool-call-block:not(.collapsed) .tool-call-toggle .toggle-icon {
    transform: rotate(180deg);
    display: inline-block;
}

.tool-call-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 12px;
}

.tool-call-block:not(.collapsed) .tool-call-content {
    max-height: none;
    padding: 0 12px 12px 12px;
}

.tool-call-text {
    font-size: 13px;
    color: #2c5282;
    line-height: 1.6;
    word-wrap: break-word;
}

.tool-call-text h3,
.tool-call-text h4 {
    margin: 12px 0 8px 0;
    color: #1e4063;
}

.tool-call-text h3 {
    font-size: 15px;
}

.tool-call-text h4 {
    font-size: 14px;
}

.tool-call-text a {
    color: #0066cc;
    text-decoration: none;
}

.tool-call-text a:hover {
    text-decoration: underline;
}

.tool-call-text strong {
    font-weight: 600;
}

.tool-call-text pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    font-size: 12px;
}

/* Spinner for active tool calls */
.tool-call-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(44, 82, 130, 0.2);
    border-top-color: #2c5282;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.tool-call-block:not(.active) .tool-call-spinner {
    display: none;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Finished tool call */
.tool-call-block:not(.active) {
    background-color: #e3f2fd;
    opacity: 0.9;
}

/* ========== Responsive adjustments ========== */

@media (max-width: 768px) {
    .reasoning-block {
        margin: 8px 0;
    }

    .reasoning-block-header {
        padding: 8px 10px;
    }

    .reasoning-block-title {
        font-size: 13px;
    }

    .reasoning-block-text {
        font-size: 12px;
    }

    .tool-call-block {
        margin: 8px 0;
    }

    .tool-call-header {
        padding: 8px 10px;
    }

    .tool-call-message {
        font-size: 13px;
    }

    .tool-call-text {
        font-size: 12px;
    }
}

/* ========== Dark mode support (future) ========== */
@media (prefers-color-scheme: dark) {
    .reasoning-block {
        background-color: #2a2a2a;
    }

    .reasoning-block-title {
        color: #aaa;
    }

    .reasoning-block-text {
        color: #999;
    }

    .reasoning-block-header:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }

    .tool-call-block {
        background-color: #1e3a4a;
    }

    .tool-call-header:hover {
        background-color: rgba(110, 181, 217, 0.15);
    }

    .tool-call-message {
        color: #6eb5d9;
    }

    .tool-call-text {
        color: #a3cfe5;
    }

    .tool-call-text h3,
    .tool-call-text h4 {
        color: #6eb5d9;
    }

    .tool-call-text pre {
        background: rgba(255, 255, 255, 0.05);
    }

    .tool-call-toggle {
        color: #6eb5d9;
    }

    .tool-call-block:not(.active) {
        background-color: #1a2f3f;
    }

    .reasoning-shimmer {
        background: linear-gradient(90deg, #444 25%, #666 50%, #444 75%);
        background-size: 200% 100%;
    }

    .tool-call-spinner {
        border: 2px solid rgba(110, 181, 217, 0.2);
        border-top-color: #6eb5d9;
    }
}