/* ContPark AI Chat Widget Styles */

#cpac-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    z-index: 999998;
}

#cpac-container * {
    box-sizing: border-box;
}

/* Button - Bottom position */
#cpac-btn {
    position: fixed;
    bottom: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 2147483646;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 0;
}

#cpac-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

#cpac-btn svg {
    width: 28px;
    height: 28px;
}

#cpac-btn img {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    object-fit: cover;
}

/* Position - Left */
.cpac-position-left #cpac-btn {
    left: 20px;
    right: auto;
}

.cpac-position-left #cpac-window {
    left: 20px;
    right: auto;
    bottom: 90px;
}

/* Position - Right */
.cpac-position-right #cpac-btn {
    right: 20px;
    left: auto;
}

.cpac-position-right #cpac-window {
    right: 20px;
    left: auto;
    bottom: 90px;
}

/* Chat Window */
#cpac-window {
    position: fixed;
    bottom: 90px;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 110px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
    z-index: 2147483647;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

#cpac-window.cpac-open {
    display: flex;
}

/* Header */
#cpac-header {
    color: #fff;
    padding: 16px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#cpac-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

#cpac-close:hover {
    background: rgba(255,255,255,0.2);
}

/* Messages */
#cpac-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cpac-msg-container {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: flex-start;
}

.cpac-msg-container:has(.cpac-user) {
    align-self: flex-end;
}

.cpac-msg {
    width: 100%;
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    position: relative;
    transition: max-height 0.3s ease;
}

.cpac-msg.cpac-collapsed {
    max-height: 180px;
    overflow: hidden;
    position: relative;
}

.cpac-msg.cpac-collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, rgba(240,240,240,0), rgba(240,240,240,1));
    pointer-events: none;
}

.cpac-expand-btn {
    align-self: flex-start;
    background: transparent;
    border: none;
    color: var(--cpac-color, #0066cc);
    font-size: 13px;
    padding: 4px 8px;
    cursor: pointer;
    text-decoration: underline;
    transition: opacity 0.2s;
    margin-left: 16px;
}

.cpac-expand-btn:hover {
    opacity: 0.8;
}

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

.cpac-user {
    background: var(--cpac-color, #0066cc);
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.cpac-typing {
    color: #888;
    font-style: italic;
}

/* Input */
#cpac-input-box {
    padding: 12px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    background: #fff;
}

#cpac-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#cpac-input:focus {
    border-color: var(--cpac-color, #0066cc);
}

#cpac-send {
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    flex-shrink: 0;
}

#cpac-send:hover {
    transform: scale(1.05);
}

#cpac-send svg {
    width: 20px;
    height: 20px;
}

#cpac-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobile */
@media (max-width: 480px) {
    #cpac-window {
        width: calc(100% - 20px);
        height: 70vh;
        bottom: 90px;
    }
    
    .cpac-position-left #cpac-window {
        left: 10px;
    }
    
    .cpac-position-right #cpac-window {
        right: 10px;
    }
}

/* AI Icons (Font Awesome) */
#cpac-btn .fa-robot {
    transition: transform 0.3s ease;
}

#cpac-btn:hover .fa-robot {
    transform: scale(1.1) rotate(10deg);
}

/* AI Badge animation */
@keyframes ai-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

#cpac-header .fa-microchip {
    animation: ai-pulse 2s ease-in-out infinite;
}
