/* Joshua's Copilot Chat Styles */

/* Chat Toggle Button */
#chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50px;
    padding: 15px 20px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    user-select: none;
}

#chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

#chat-toggle.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

#chat-toggle.dragging {
    transition: none !important;
    user-select: none;
    z-index: 1002;
    cursor: move;
}

.chat-toggle-icon {
    font-size: 1.2rem;
    animation: pulse 2s infinite;
}

.chat-toggle-text {
    font-weight: 600;
    font-size: 0.9rem;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Chat Container */
#joshua-copilot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 500px;
    min-width: 320px;
    min-height: 400px;
    max-width: 90vw;
    max-height: 90vh;
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transform: translateY(100%) scale(0.8);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

#joshua-copilot.open {
    transform: translateY(0) scale(1);
    opacity: 1;
}

#joshua-copilot.dragging {
    transition: none !important;
    user-select: none;
}

#joshua-copilot.resizing {
    transition: none !important;
}

/* Custom Resize Handles - Invisible but functional */
.resize-handle {
    position: absolute;
    background: transparent;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

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

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

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

/* Edge resize handles */
.resize-e {
    top: 15px;
    right: 0;
    width: 8px;
    bottom: 15px;
    cursor: e-resize;
}

.resize-w {
    top: 15px;
    left: 0;
    width: 8px;
    bottom: 15px;
    cursor: w-resize;
}

.resize-n {
    top: 0;
    left: 15px;
    right: 15px;
    height: 8px;
    cursor: n-resize;
}

.resize-s {
    bottom: 0;
    left: 15px;
    right: 15px;
    height: 8px;
    cursor: s-resize;
}

/* Show a subtle indicator only on hover of the entire chat window */
#joshua-copilot:hover .resize-handle {
    background: rgba(72, 118, 236, 0.1);
    opacity: 1;
}

.resize-handle:hover {
    background: rgba(72, 118, 236, 0.3) !important;
}

/* Chat Header */
.chat-header {
    background: var(--gradient-primary);
    color: white;
    padding: 20px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    position: relative;
}

.chat-header:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary-color));
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.chat-title h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.chat-title p {
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.9;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

/* Message Styles */
.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.user-message {
    align-self: flex-end;
}

.bot-message {
    align-self: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.user-message .message-content {
    background: var(--gradient-primary);
    color: white;
    border-bottom-right-radius: 6px;
}

.bot-message .message-content {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 6px;
}

.message-sources {
    margin-top: 5px;
    padding: 0 16px;
    opacity: 0.7;
}

.message-timestamp {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 4px;
    align-self: flex-end;
    padding: 0 16px;
}

.bot-message .message-timestamp {
    align-self: flex-start;
}

/* Typing Indicator */
.typing .message-content {
    padding: 16px;
}

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

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0ms;
}

.typing-dots span:nth-child(2) {
    animation-delay: 200ms;
}

.typing-dots span:nth-child(3) {
    animation-delay: 400ms;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    30% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Input */
.chat-input-container {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 0 0 16px 16px;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

#chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

#chat-input:focus {
    border-color: var(--primary-color);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--gradient-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* Suggestion Chips */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-chip {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    user-select: none;
}

.suggestion-chip:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Dark Mode Support */
[data-theme="dark"] #joshua-copilot {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .bot-message .message-content {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] #chat-input {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

[data-theme="dark"] .suggestion-chip {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    #joshua-copilot {
        width: calc(100vw - 20px);
        height: calc(100vh - 40px);
        bottom: 10px;
        right: 10px;
    }
    
    #chat-toggle {
        bottom: 10px;
        right: 10px;
    }
    
    .chat-toggle-text {
        display: none;
    }
    
    .chat-suggestions {
        flex-direction: column;
    }
    
    .suggestion-chip {
        text-align: center;
    }
}

/* Smooth Animations */
.message {
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
} 