/* PCA Global AI Chatbot Styles */

#pca-chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    border: none;
    font-size: 28px;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    outline: none;
}

#pca-chat-button:hover {
    background: linear-gradient(135deg, #005a87 0%, #004470 100%);
    box-shadow: 0 6px 16px rgba(0, 115, 170, 0.5);
    transform: scale(1.1);
}

#pca-chat-button:active {
    transform: scale(0.95);
}

#pca-chat-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    overflow: hidden;
    transition: all 0.3s ease;
}

#pca-chat-window.pca-chat-hidden {
    display: none;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
}

.pca-chat-header {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.pca-chat-header > div {
    flex: 1;
}

.pca-chat-header strong {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.pca-chat-header small {
    display: block;
    font-size: 12px;
    opacity: 0.85;
}

#pca-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 10px;
    transition: all 0.2s ease;
    outline: none;
}

#pca-chat-close:hover {
    transform: scale(1.2);
    opacity: 0.8;
}

#pca-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

.pca-message {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    max-width: 85%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pca-message.pca-bot {
    background: white;
    color: #333;
    border-left: 3px solid #0073aa;
    align-self: flex-start;
}

.pca-message.pca-user {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    align-self: flex-end;
    max-width: 85%;
    border-radius: 10px;
}

.pca-message.pca-bot:first-child {
    margin-top: auto;
}

.pca-chat-input {
    padding: 12px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    background: white;
    align-items: flex-end;
}

#pca-chat-text {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    outline: none;
    transition: border-color 0.2s ease;
}

#pca-chat-text:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

#pca-chat-send {
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: white;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    outline: none;
    flex-shrink: 0;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#pca-chat-send:hover:not(:disabled) {
    background: linear-gradient(135deg, #005a87 0%, #004470 100%);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

#pca-chat-send:active:not(:disabled) {
    transform: scale(0.95);
}

#pca-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #pca-chat-window {
        width: calc(100% - 40px);
        height: 70vh;
        max-height: 600px;
        bottom: 80px;
        right: 20px;
        left: 20px;
    }
    
    #pca-chat-button {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
    
    .pca-message {
        max-width: 90%;
    }
}

/* Scrollbar styling */
#pca-chat-messages::-webkit-scrollbar {
    width: 6px;
}

#pca-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#pca-chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

#pca-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Loading indicator animation */
.pca-thinking {
    display: inline-flex;
    gap: 4px;
}

.pca-thinking span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #0073aa;
    animation: pulse 1.4s infinite;
}

.pca-thinking span:nth-child(2) {
    animation-delay: 0.2s;
}

.pca-thinking span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 1;
    }
}

/* Markdown rendering inside bot messages */
.pca-message.pca-bot p {
    margin: 0 0 6px 0;
}
.pca-message.pca-bot p:last-child {
    margin-bottom: 0;
}
.pca-message.pca-bot ul {
    margin: 4px 0 6px 0;
    padding-left: 18px;
}
.pca-message.pca-bot ul li {
    margin-bottom: 3px;
    line-height: 1.4;
}
.pca-message.pca-bot strong {
    font-weight: 700;
    color: #004a6e;
}
.pca-message.pca-bot em {
    font-style: italic;
}
