/**
 * Component Styles
 * Reusable UI components
 */

/* Buttons */
.action-btn {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    border: 1px solid #e5e7eb;
    background: var(--surface);
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-base);
    font-size: 1.125rem;
}

.action-btn.send {
    background: var(--primary-500);
    border-color: var(--primary-500);
    color: white;
}

.action-btn.computer-view {
    border: 1px solid #e5e7eb;
    background: var(--surface);
    color: var(--text-tertiary);
}

.action-btn:hover:not(.send):not(.computer-view) {
    background: var(--surface-secondary);
    color: var(--text-secondary);
}

.control-btn {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-base);
    color: var(--text-secondary);
    font-size: 1.125rem;
}

.control-btn:hover {
    background: var(--surface-secondary);
    color: var(--text-primary);
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-base);
}

.btn-secondary {
    background: var(--surface-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--surface-tertiary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 38px;
    height: 20px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: var(--primary-500);
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active .toggle-slider {
    transform: translateX(18px);
}

/* Agent Badges */
.agent-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.625rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.5rem;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.typing-dots {
    display: flex;
    gap: 0.125rem;
}

.typing-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-tertiary);
    animation: typingPulse 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

.typing-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Message Copy Button */
.message-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    opacity: 0;
    transition: var(--transition-base);
}

.message-bubble:hover .message-copy-btn {
    opacity: 1;
}

.message-copy-btn:hover {
    background: var(--primary-500);
    color: white;
}

.message-copy-btn.copied {
    background: var(--success-500);
    color: white;
}

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

/* File Preview */
.file-preview {
    margin-bottom: 0.875rem;
    padding: 0.5rem;
    background: var(--surface-secondary);
    border-radius: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.file-preview-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.file-preview-item i {
    color: var(--primary-500);
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
}

.file-size {
    color: var(--text-secondary);
    margin-left: auto;
}

.remove-file-btn {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: none;
    background: var(--error-500);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: var(--transition-base);
}

.remove-file-btn:hover {
    background: #d32f2f;
    transform: scale(1.05);
}

/* Error Toast */
.error-toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--error-500);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    z-index: var(--z-toast);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition-slow);
    max-width: 300px;
    box-shadow: var(--shadow-xl);
}

.error-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Generated Images */
.message-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
    width: 100%;
}

.generated-image {
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
    background: var(--surface-secondary);
    aspect-ratio: 1;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

.generated-image:hover {
    box-shadow: var(--shadow-lg);
}

.generated-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    opacity: 0;
    transition: var(--transition-base);
}

.generated-image:hover .image-actions {
    opacity: 1;
}

.image-download-btn,
.image-fullscreen-btn {
    padding: 0.5rem;
    border-radius: 0.375rem;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-base);
    font-size: 1rem;
    backdrop-filter: blur(8px);
}

.image-download-btn:hover,
.image-fullscreen-btn:hover {
    background: white;
    transform: scale(1.05);
}

.image-download-btn:active,
.image-fullscreen-btn:active {
    transform: scale(0.95);
}

/* Image Fullscreen Overlay */
.image-fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.fullscreen-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-2xl);
}

.fullscreen-close {
    position: absolute;
    top: -3rem;
    right: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: var(--transition-base);
    backdrop-filter: blur(8px);
}

.fullscreen-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}
