/* ChatKit Product Assistant Styles v3.0.1 - Bottom Right Position */

.chatkit-hidden {
    display: none !important;
}

.chatkit-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px; /* CHANGED from left to right */
    background: #E91E8C; /* PINK */
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    font-size: 14px;
    font-weight: 600;
    z-index: 9998;
    transition: all 0.3s ease;
}

.chatkit-trigger:hover {
    background: #C2185B; /* Darker Pink */
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

#chatkit-sidebar-wrapper {
    position: fixed;
    bottom: 20px;
    right: 20px; /* CHANGED from left to right */
    width: 380px;
    max-height: 600px;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    border-radius: 12px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

#chatkit-sidebar {
    background: white;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.chatkit-header {
    background: #E91E8C; /* PINK */
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatkit-header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatkit-icon {
    font-size: 24px;
}

.chatkit-header h3 {
    margin: 0;
    font-size: 16px;
}

.chatkit-subtitle {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.chatkit-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.chatkit-close:hover {
    opacity: 0.8;
}

.chatkit-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f5f5f5;
    max-height: 450px;
}

.chatkit-message {
    margin-bottom: 12px;
    display: flex;
}

.chatkit-message-content {
    padding: 10px 15px;
    border-radius: 8px;
    max-width: 85%;
    word-wrap: break-word;
    line-height: 1.5;
}

.chatkit-user .chatkit-message-content {
    background: #E91E8C; /* PINK */
    color: white;
    margin-left: auto;
}

.chatkit-assistant .chatkit-message-content {
    background: white;
    color: #333;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.chatkit-quick-starters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.chatkit-starter-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    transition: all 0.2s;
}

.chatkit-starter-btn:hover {
    background: #E91E8C; /* PINK */
    color: white;
    border-color: #E91E8C;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.chatkit-back-btn {
    grid-column: span 2; 
    text-align: center;
    background-color: #f0f0f0;
}

.chatkit-back-btn:hover {
    background-color: #e0e0e0;
    color: #333;
    border-color: #bbb;
}

.chatkit-input-wrapper {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chatkit-input-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

#chatkit-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

#chatkit-input:focus {
    border-color: #E91E8C;
}

.chatkit-file-btn {
    padding: 8px 12px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}

.chatkit-file-btn:hover {
    background: #e0e0e0;
}

.chatkit-send-btn {
    padding: 10px 15px;
    background: #E91E8C;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.chatkit-send-btn:hover {
    background: #C2185B;
}

.chatkit-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatkit-guest-notice {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    text-align: center;
}

.chatkit-guest-notice a {
    color: #E91E8C;
    text-decoration: none;
}

.chatkit-guest-notice a:hover {
    text-decoration: underline;
}

.chatkit-attachment-preview {
    padding: 10px 15px;
    background: #f9f9f9;
    border-top: 1px solid #e0e0e0;
    display: none;
}

.chatkit-attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: white;
    border-radius: 4px;
    margin-bottom: 5px;
    border: 1px solid #e0e0e0;
}

.chatkit-attachment-icon {
    font-size: 20px;
}

.chatkit-attachment-name {
    flex: 1;
    font-size: 13px;
    color: #333;
}

.chatkit-attachment-remove {
    margin-left: auto;
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 0 5px;
}

.chatkit-attachment-remove:hover {
    color: #d32f2f;
}

/* --- Form Styles --- */
.chatkit-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.chatkit-form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chatkit-form-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-left: 2px;
}

.chatkit-form-input, 
.chatkit-form-textarea {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}

.chatkit-form-input:focus, 
.chatkit-form-textarea:focus {
    outline: none;
    border-color: #E91E8C;
    background-color: #fafafa;
}

.chatkit-form-textarea {
    resize: vertical;
    min-height: 60px;
}

.chatkit-form-submit {
    background: #E91E8C;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 5px;
    transition: background 0.2s;
}

.chatkit-form-submit:hover {
    background: #C2185B;
}

/* Animations */
.chatkit-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.chatkit-typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #E91E8C;
    opacity: 0.6;
    animation: chatkit-typing-bounce 1.4s infinite ease-in-out both;
}

.chatkit-typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.chatkit-typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.chatkit-typing-indicator span:nth-child(3) { animation-delay: 0s; }

@keyframes chatkit-typing-bounce {
    0%, 80%, 100% { transform: scale(0); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.chatkit-thinking-indicator {
    animation: chatkit-fade-in 0.3s ease-in;
}

@keyframes chatkit-fade-in {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

#chatkit-status-message-wrapper { padding-top: 5px; }

.chatkit-status-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
    color: #666;
    padding: 4px 0;
    margin-top: 5px;
    animation: chatkit-fade-in 0.3s ease-in;
}

.chatkit-status-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    color: #C2185B;
}

.chatkit-status-time {
    font-size: 11px;
    color: #999;
    font-style: italic;
    margin-left: 20px;
}

.chatkit-progress-bar {
    width: 100%;
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    margin-top: 8px;
    overflow: hidden;
}

.chatkit-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #E91E8C 0%, #F48FB1 50%, #E91E8C 100%);
    background-size: 200% 100%;
    animation: progress-animation 1.5s ease-in-out infinite;
    border-radius: 2px;
}

@keyframes progress-animation {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

#streaming-message {
    animation: pulse-subtle 2s ease-in-out infinite;
}

@keyframes pulse-subtle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.95; }
}

.chatkit-persistent-actions {
    border-top: 1px solid #e0e0e0;
    margin-top: 10px;
    padding-top: 10px;
    background: #f9f9f9 !important;
}

.chatkit-persistent-actions .chatkit-message-content {
    background: #f9f9f9 !important;
    box-shadow: none !important;
}

/* Responsive adjustment for Right Positioning */
@media (max-width: 480px) {
    #chatkit-sidebar-wrapper {
        width: calc(100% - 40px);
        right: 20px;
        left: auto; /* Ensure left doesn't override */
        max-height: 500px;
    }
    
    .chatkit-quick-starters {
        grid-template-columns: 1fr;
    }
}