/* Copilot Chat Widget */
.copilot-chat-container {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 9999;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Toggle Button */
.copilot-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #e87722;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
}

.copilot-chat-toggle:hover {
    transform: scale(1.1);
    background: #d06a1e;
}

.copilot-chat-toggle.active {
    display: none;
}

/* Chat Window */
.copilot-chat-window {
    position: fixed;
    bottom: 160px;
    right: 20px;
    width: 400px;
    height: 580px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
}

/* Header */
.copilot-chat-header {
    background: #e87722;
    color: white;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.copilot-chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.copilot-chat-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.copilot-chat-title {
    display: flex;
    flex-direction: column;
}

.copilot-chat-title span {
    font-weight: 600;
    font-size: 16px;
    line-height: 1.2;
}

.copilot-powered-by {
    font-size: 11px;
    opacity: 0.85;
    line-height: 1.3;
}

.copilot-chat-actions {
    display: flex;
    gap: 6px;
}

.copilot-chat-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
}

.copilot-chat-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Web Chat container */
.copilot-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.copilot-chat-iframe {
    flex: 1;
    width: 100%;
    border: none;
    min-height: 0;
}

/* New Chat Footer */
.copilot-chat-footer {
    text-align: center;
    padding: 4px 0 0;
}

.copilot-chat-reset-btn {
    background: none;
    border: 1px solid #ddd;
    color: #555;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 16px;
    transition: background 0.2s, color 0.2s;
}

.copilot-chat-reset-btn:hover {
    background: #f5f5f5;
    color: #333;
}

.copilot-chat-reset-btn i {
    margin-right: 4px;
}

/* Chat iframe */
.copilot-chat-iframe {
    flex: 1;
    width: 100%;
    border: none;
    min-height: 0;
}

/* Chat Messages */
.copilot-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.copilot-msg {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    max-width: 90%;
}

.copilot-msg-bot {
    align-self: flex-start;
}

.copilot-msg-user {
    align-self: flex-end;
}

.copilot-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e87722;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
}

.copilot-msg-bubble {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.copilot-msg-bot .copilot-msg-bubble {
    background: #f0f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

.copilot-msg-bot .copilot-msg-bubble a {
    color: #e87722;
    text-decoration: underline;
    word-break: break-all;
}

.copilot-msg-bot .copilot-msg-bubble a:hover {
    color: #d06a1e;
}

.copilot-msg-user .copilot-msg-bubble {
    background: #e87722;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.copilot-status {
    text-align: center;
    color: #999;
    font-size: 13px;
    padding: 8px;
}

.copilot-dots span {
    animation: copilotDot 1.4s infinite;
    font-size: 20px;
    line-height: 1;
}
.copilot-dots span:nth-child(2) { animation-delay: 0.2s; }
.copilot-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes copilotDot {
    0%, 80%, 100% { opacity: 0.2; }
    40% { opacity: 1; }
}

/* Input Area */
.copilot-chat-input-area {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}

.copilot-chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.copilot-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.copilot-chat-input:focus {
    border-color: #e87722;
}

.copilot-chat-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e87722;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    transition: background 0.2s;
}

.copilot-chat-send-btn:hover {
    background: #d06a1e;
}

/* Responsive */
@media (max-width: 480px) {
    .copilot-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 190px);
        right: 10px;
        bottom: 150px;
        border-radius: 12px;
    }
}

/* Attachments */
.copilot-chat-attach-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f2f2f2;
    color: #666;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: background 0.2s;
}

.copilot-chat-attach-btn:hover {
    background: #e4e4e4;
    color: #e87722;
}

.copilot-chat-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.copilot-chat-attachments:empty {
    display: none;
}

.copilot-chat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fdf1e7;
    border: 1px solid #f0cdae;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    color: #8a4b12;
    max-width: 100%;
}

.copilot-chat-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 180px;
}

.copilot-chat-chip button {
    border: none;
    background: none;
    color: #b06a2a;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
}

.copilot-message-content code {
    background: #f4f4f4;
    border-radius: 3px;
    padding: 1px 4px;
    font-size: 12px;
}

/* Message bubbles (the old .copilot-msg styles belonged to the WebChat widget) */
.copilot-message {
    max-width: 85%;
    display: flex;
}

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

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

.copilot-message-content {
    font-size: 14px;
    line-height: 1.5;
    padding: 9px 13px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.copilot-message-user .copilot-message-content {
    background: #e87722;
    color: #fff;
    border-radius: 14px 14px 4px 14px;
}

.copilot-message-bot .copilot-message-content {
    background: #eef0f1;
    color: #2b2b2b;
    border-radius: 14px 14px 14px 4px;
}

.copilot-message-bot .copilot-message-content a {
    color: #b35a12;
}

.copilot-chat-header {
    cursor: move;
    user-select: none;
    touch-action: none;
}

.copilot-chat-header .copilot-chat-btn {
    cursor: pointer;
}

/* Voice mode */
.copilot-chat-attach-btn.voice-active {
    background: #e87722;
    color: #fff;
    animation: copilot-voice-pulse 1.6s ease-in-out infinite;
}

@keyframes copilot-voice-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(232, 119, 34, 0.45); }
    50% { box-shadow: 0 0 0 8px rgba(232, 119, 34, 0); }
}

.copilot-voice-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    color: #8a4b12;
    padding: 2px 4px;
}

.copilot-voice-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e87722;
    animation: copilot-voice-pulse 1.6s ease-in-out infinite;
}

.copilot-chat-btn.copilot-chat-new {
    width: auto;
    padding: 0 12px;
    border-radius: 15px;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.copilot-chat-btn.copilot-chat-new:hover {
    background: rgba(255, 255, 255, 0.3);
}
