/* Buttons */
.btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-family);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.btn:hover {
    background: var(--border-hover);
    border-color: var(--text-secondary);
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    font-weight: 600;
}

.btn-primary:hover {
    background: #00e68e;
    box-shadow: var(--shadow-glow);
}

.btn-icon {
    padding: var(--spacing-sm);
    border-radius: var(--radius-full);
}

.btn-outline {
    background: transparent;
}

/* Inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
}

.input-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

input[type="text"],
input[type="number"],
textarea,
select {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    width: 100%;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Range Slider */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 10px var(--accent-glow);
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: var(--bg-tertiary);
    border-radius: 2px;
}

/* Chat Bubbles */
.message {
    display: flex;
    gap: var(--spacing-md);
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    animation: fadeIn 0.3s ease;
    margin-bottom: var(--spacing-lg);
}

.message.user {
    justify-content: flex-end;
}

/* Message Avatar */
.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.message.user .message-avatar {
    background: var(--bg-tertiary);
    color: var(--accent-secondary);
    order: 2;
}

.message.assistant .message-avatar {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.message-content {
    background: var(--bg-secondary);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    position: relative;
    min-width: 100px;
    max-width: 80%;
    overflow-wrap: break-word;
    word-break: break-word;
}

.message.user .message-content {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
    order: 1;
}

/* Markdown Styles within Chat */
.message-content pre {
    background: #000;
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: var(--spacing-sm) 0;
}

.message-content code {
    font-family: var(--font-mono);
    font-size: 0.9em;
}

.message-content p {
    margin-bottom: var(--spacing-sm);
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul,
.message-content ol {
    margin-left: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

.message-content li {
    margin-bottom: 4px;
}

/* Message Actions */
.message-actions {
    display: flex;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
}

.action-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.action-btn i {
    font-size: 0.9rem;
}

/* Reasoning Container */
.reasoning-container {
    margin-bottom: var(--spacing-md);
}

.reasoning-header {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    margin-bottom: 12px;
    transition: background 0.2s;
}

.reasoning-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.reasoning-chevron {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: transform 0.3s;
}

.reasoning-content {
    display: none;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-left: 2px solid var(--accent-secondary);
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Image Upload Preview */
.image-preview-container {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    overflow-x: auto;
}

.preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Chat Input Box */
.chat-input-wrapper {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s;
    box-shadow: var(--shadow-md);
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent-primary);
}

.chat-input-main {
    display: flex;
    gap: var(--spacing-sm);
    align-items: flex-end;
}

.chat-textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    resize: none;
    font-family: var(--font-family);
    font-size: 0.95rem;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
}

.chat-textarea:focus {
    outline: none;
}

/* Microphone Button */
#mic-btn {
    transition: all 0.3s ease;
}

#mic-btn.recording {
    background: var(--accent-primary);
    color: var(--bg-primary);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(0, 255, 157, 0.7);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(0, 255, 157, 0);
    }
}

/* Drag Overlay */
.drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 255, 157, 0.1);
    border: 2px dashed var(--accent-primary);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.drag-overlay.active {
    opacity: 1;
}

.drag-overlay-text {
    background: var(--bg-primary);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    color: var(--accent-primary);
    font-weight: bold;
    box-shadow: var(--shadow-md);
}