/**
 * AI Assistant Styles
 * Self-contained CSS - all styles scoped to .ai-assistant-widget
 * Can be easily deleted to remove AI assistant entirely
 */

/* AI Assistant Trigger Button in Left Panel */
.ai-assistant-trigger-container {
    margin: 10px 0;
    padding: 0 15px;
}

.ai-assistant-trigger-btn {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.ai-assistant-trigger-btn:hover {
    background: linear-gradient(135deg, #1d4ed8, #1e3a8a);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.ai-assistant-trigger-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

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

.ai-label {
    font-size: 14px;
    line-height: 1;
}

/* Left Panel Specific Positioning */
.ai-assistant-widget.left-panel-mode {
    position: fixed;
    left: 20px;
    bottom: 20px;
    width: 300px;
    /* No size constraints - can be resized freely */
    height: 500px;
    /* No max-height constraint */
    z-index: 9999;
}

.ai-assistant-widget.left-panel-mode.minimized {
    height: 60px;
    width: 280px;
}

/* Main widget container - positioned absolutely to not interfere with existing layout */
.ai-assistant-widget {
    position: fixed;
    width: 520px; /* Increased from 400px to 520px (30% wider) */
    height: 500px;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(59, 130, 246, 0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    z-index: 10000;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Position variants */
.ai-assistant-widget.position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.ai-assistant-widget.position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.ai-assistant-widget.position-top-right {
    top: 20px;
    right: 20px;
}

.ai-assistant-widget.position-top-left {
    top: 20px;
    left: 20px;
}

/* Minimized state - now unused since we hide/show entire widget */
.ai-assistant-widget.minimized {
    /* This class is no longer used for partial hiding */
}

/* Header */
.ai-chat-header {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

.ai-chat-header .ai-header-title {
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chat-header .ai-header-controls {
    display: flex;
    gap: 5px;
}

.ai-header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    transition: background 0.2s;
}

.ai-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Status indicator */
.ai-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    margin-left: 5px;
}

.ai-status-indicator.connected {
    background: #10b981;
}

/* Chat body */
.ai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: #020617;
}

.ai-chat-messages {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 100%;
    scroll-behavior: smooth;
}

/* Message styles */
.ai-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
    animation: fadeInUp 0.3s ease;
}

.ai-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
}

.ai-message.user .ai-message-avatar {
    background: #3b82f6;
    color: white;
}

.ai-message.assistant .ai-message-avatar {
    background: #10b981;
    color: white;
}

.ai-message.system .ai-message-avatar {
    background: #6b7280;
    color: white;
}

.ai-message-bubble {
    background: #1e293b;
    color: #f1f5f9;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    border: 1px solid rgba(59, 130, 246, 0.1);
}

.ai-message.user .ai-message-bubble {
    background: #3b82f6;
    color: white;
}

.ai-message.system .ai-message-bubble {
    background: #6b7280;
    font-style: italic;
    font-size: 13px;
}

/* Typing indicator */
.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    background: #374151;
    color: #9ca3af;
    border-radius: 18px;
    font-size: 14px;
}

.ai-typing-dots {
    display: flex;
    gap: 4px;
}

.ai-typing-dot {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: aiTypingBounce 1.4s infinite;
}

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

/* Preset Questions */
.ai-preset-questions {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    padding: 0 2px;
}

.ai-preset-btn {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 20px;
    color: #60a5fa;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ai-preset-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.5);
    color: #93c5fd;
    transform: translateY(-1px);
}

.ai-preset-btn:active {
    transform: translateY(0);
}

/* Input container */
.ai-chat-input-container {
    padding: 20px;
    background: #0f172a;
    border-top: 1px solid #1e293b;
}

.ai-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.ai-chat-input {
    flex: 1;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 20px;
    padding: 12px 16px;
    color: #f1f5f9;
    font-size: 14px;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    min-height: 20px;
    max-height: 100px;
}

.ai-chat-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ai-chat-input::placeholder {
    color: #9ca3af;
}

.ai-send-btn {
    background: #3b82f6;
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.ai-send-btn:hover:not(:disabled) {
    background: #1d4ed8;
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.ai-send-btn:disabled {
    background: #6b7280;
    cursor: not-allowed;
}

/* Settings panel */
.ai-settings-panel {
    position: absolute;
    top: 60px;
    right: 0;
    left: 0;
    background: #1f2937;
    border-top: 1px solid #374151;
    padding: 20px;
    z-index: 1;
}

.ai-settings-panel.hidden {
    display: none;
}

.ai-setting-group {
    margin-bottom: 15px;
}

.ai-setting-label {
    display: block;
    color: #f9fafb;
    font-size: 13px;
    margin-bottom: 5px;
    font-weight: 500;
}

.ai-setting-input {
    width: 100%;
    background: #374151;
    border: 1px solid #4b5563;
    border-radius: 6px;
    padding: 8px 12px;
    color: #f9fafb;
    font-size: 14px;
    outline: none;
}

.ai-setting-input:focus {
    border-color: #10b981;
}

.ai-setting-select {
    width: 100%;
    background: #374151;
    border: 1px solid #4b5563;
    border-radius: 6px;
    padding: 8px 12px;
    color: #f9fafb;
    font-size: 14px;
    outline: none;
}

.ai-settings-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.ai-settings-btn {
    flex: 1;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.ai-settings-btn.primary {
    background: #10b981;
    color: white;
}

.ai-settings-btn.primary:hover {
    background: #059669;
}

.ai-settings-btn.secondary {
    background: #6b7280;
    color: white;
}

.ai-settings-btn.secondary:hover {
    background: #4b5563;
}

/* Scrollbar styling */
.ai-chat-body::-webkit-scrollbar {
    width: 4px;
}

.ai-chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-body::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 2px;
}

.ai-chat-body::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes aiTypingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* Responsive design - removed size constraints */
@media (max-width: 768px) {
    .ai-assistant-widget {
        /* No size constraints on mobile either - user can resize as needed */
    }
    
    .ai-assistant-widget.minimized {
        /* No size constraints when minimized */
    }
}

/* Light theme variant */
.ai-assistant-widget.theme-light {
    background: #ffffff;
    border-color: #e5e7eb;
}

.ai-assistant-widget.theme-light .ai-chat-body {
    background: #f9fafb;
}

.ai-assistant-widget.theme-light .ai-message-bubble {
    background: #f3f4f6;
    color: #1f2937;
}

.ai-assistant-widget.theme-light .ai-message.user .ai-message-bubble {
    background: #3b82f6;
    color: white;
}

.ai-assistant-widget.theme-light .ai-chat-input {
    background: #ffffff;
    border-color: #d1d5db;
    color: #1f2937;
}

.ai-assistant-widget.theme-light .ai-chat-input::placeholder {
    color: #6b7280;
}

.ai-assistant-widget.theme-light .ai-settings-panel {
    background: #ffffff;
    border-color: #e5e7eb;
}

.ai-assistant-widget.theme-light .ai-setting-input,
.ai-assistant-widget.theme-light .ai-setting-select {
    background: #ffffff;
    border-color: #d1d5db;
    color: #1f2937;
}

/* Resize handles */
.ai-resize-handle {
    position: absolute;
    background: transparent;
    z-index: 10;
}

.ai-resize-handle:hover {
    background: rgba(16, 185, 129, 0.2);
}

/* Corner handles */
.resize-handle-se {
    bottom: 0;
    right: 0;
    width: 6px;
    height: 6px;
    cursor: se-resize;
}

.resize-handle-sw {
    bottom: 0;
    left: 0;
    width: 6px;
    height: 6px;
    cursor: sw-resize;
}

.resize-handle-nw {
    top: 0;
    left: 0;
    width: 6px;
    height: 6px;
    cursor: nw-resize;
}

.resize-handle-ne {
    top: 0;
    right: 0;
    width: 6px;
    height: 6px;
    cursor: ne-resize;
}

/* Edge handles */
.resize-handle-n {
    top: 0;
    left: 6px;
    right: 6px;
    height: 3px;
    cursor: n-resize;
}

.resize-handle-s {
    bottom: 0;
    left: 6px;
    right: 6px;
    height: 3px;
    cursor: s-resize;
}

.resize-handle-e {
    top: 6px;
    right: 0;
    bottom: 6px;
    width: 3px;
    cursor: e-resize;
}

.resize-handle-w {
    top: 6px;
    left: 0;
    bottom: 6px;
    width: 3px;
    cursor: w-resize;
}

/* Hide resize handles when minimized */
.ai-assistant-widget.minimized .ai-resize-handle {
    display: none;
}

/* Setup Guide Styling */
.ai-setup-actions {
    border: none;
    background: transparent;
    padding: 0;
    margin-top: 15px;
}

.ai-setup-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 15px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-setup-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    outline: none;
}

.ai-setup-btn.primary {
    background: #10b981;
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.ai-setup-btn.primary:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.ai-setup-btn.secondary {
    background: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.ai-setup-btn.secondary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.ai-setup-btn.tertiary {
    background: rgba(255, 255, 255, 0.05);
    color: #9ca3af;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-setup-btn.tertiary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f9fafb;
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}
