/* AI Agent Styling - PT. Kola Borasi Indonesia */
:root {
    --ai-primary: #FF7A00;
    --ai-secondary: #2D3436;
    --ai-bg: #ffffff;
    --ai-text: #2d3436;
    --ai-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    --ai-radius: 20px;
}

[data-theme="dark"] {
    --ai-bg: #1e1e1e;
    --ai-text: #e0e0e0;
    --ai-secondary: #f0f0f0;
}

/* Floating Button */
.ai-agent-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, var(--ai-primary), #ff9d42);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(255, 122, 0, 0.4);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    animation: ai-pulse 2s infinite;
}

@keyframes ai-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 122, 0, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(255, 122, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 122, 0, 0); }
}

.ai-agent-launcher:hover {
    transform: scale(1.1) rotate(5deg);
    animation: none;
}

.ai-agent-launcher .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff0000;
    color: white;
    font-size: 0.7rem;
    padding: 3px 7px;
    border-radius: 10px;
    font-weight: bold;
    border: 2px solid white;
}

/* Chat Container */
.ai-agent-container {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: var(--ai-bg);
    border-radius: var(--ai-radius);
    box-shadow: var(--ai-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid rgba(0,0,0,0.05);
}

.ai-agent-container.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* Chat Header */
.ai-agent-header {
    background: linear-gradient(135deg, var(--ai-primary), #ff9d42);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-agent-header .avatar {
    width: 45px;
    height: 45px;
    background: white;
    border-radius: 50%;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-agent-header .avatar img {
    width: 30px;
    height: auto;
}

.ai-agent-header .info h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.ai-agent-header .info p {
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.9;
}

.ai-agent-header .close-btn {
    margin-left: auto;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ai-agent-header .close-btn:hover {
    opacity: 1;
}

/* Chat Messages */
.ai-agent-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background-image: radial-gradient(var(--ai-primary) 0.5px, transparent 0.5px);
    background-size: 15px 15px;
    background-position: 0 0;
    opacity: 0.8;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.5;
    position: relative;
    animation: fadeIn 0.3s ease;
}

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

.message.bot {
    align-self: flex-start;
    background: #f0f0f0;
    color: var(--ai-text);
    border-bottom-left-radius: 2px;
}

[data-theme="dark"] .message.bot {
    background: #333;
}

.message.user {
    align-self: flex-end;
    background: var(--ai-primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #f0f0f0;
    border-radius: 15px;
    width: fit-content;
}

[data-theme="dark"] .typing-indicator {
    background: #333;
}

.dot {
    width: 6px;
    height: 6px;
    background: #888;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Chat Input */
.ai-agent-input {
    padding: 15px;
    border-top: 1px solid rgba(0,0,0,0.05);
    display: flex;
    gap: 10px;
    background: var(--ai-bg);
}

.ai-agent-input input {
    flex: 1;
    border: 1px solid #ddd;
    padding: 12px 15px;
    border-radius: 25px;
    outline: none;
    font-family: inherit;
    font-size: 0.9rem;
    background: var(--ai-bg);
    color: var(--ai-text);
}

.ai-agent-input button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: var(--ai-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.ai-agent-input button:hover {
    transform: scale(1.05);
}

/* Quick Replies */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.quick-reply {
    background: rgba(255, 122, 0, 0.1);
    color: var(--ai-primary);
    border: 1px solid var(--ai-primary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-reply:hover {
    background: var(--ai-primary);
    color: white;
}

/* Responsive */
@media (max-width: 480px) {
    .ai-agent-container {
        right: 10px;
        bottom: 10px;
        width: calc(100% - 20px);
        height: 80vh; /* Higher for mobile */
        z-index: 10001;
    }
    .ai-agent-launcher {
        right: 20px;
        bottom: 100px; /* Moved up to be above WhatsApp button */
        width: 55px;
        height: 55px;
        font-size: 1.5rem;
        z-index: 10001; /* Above everything */
    }
}
