/* WPExperti360 Frontend Styles */

:root {
    --expertibot-theme: #6366f1; /* Overriden by inline styles in JS if needed */
    --expertibot-bg: #2d3748;
    --expertibot-text: #ffffff;
    --expertibot-text-muted: #a0aec0;
}

/* Container */
.expertibot-container {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    display: flex;
    align-items: flex-end;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.expertibot-container.pos-right {
    right: 20px;
    flex-direction: row-reverse;
}

.expertibot-container.pos-left {
    left: 20px;
    flex-direction: row;
}

/* Sidebar Tab (The Trigger) */
.expertibot-tab {
    background: var(--expertibot-theme);
    color: white;
    padding: 12px 16px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    user-select: none;
    margin: 0 10px;
}

.expertibot-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.expertibot-tab svg {
    width: 20px;
    height: 20px;
}

/* Chat Window */
.expertibot-window {
    width: 350px;
    height: 500px;
    max-height: 80vh;
    background: var(--expertibot-bg);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255,255,255,0.1);
}

.expertibot-window.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

@media (max-width: 480px) {
    .expertibot-window {
        width: calc(100vw - 40px);
        height: 60vh;
    }
}

/* Header */
.expertibot-header {
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.0));
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.expertibot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.expertibot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--expertibot-theme);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.expertibot-title {
    color: var(--expertibot-text);
    font-weight: 700;
    font-size: 16px;
    margin: 0;
    line-height: 1.2;
}

.expertibot-status {
    color: #4ade80;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.expertibot-status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
}

.expertibot-close {
    background: transparent;
    border: none;
    color: var(--expertibot-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    transition: 0.2s;
}
.expertibot-close:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Messages Area */
.expertibot-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.expertibot-body::-webkit-scrollbar {
    width: 6px;
}
.expertibot-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

.expertibot-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    animation: fadeInMsg 0.3s ease forwards;
}

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

.expertibot-msg.bot {
    align-self: flex-start;
    background: rgba(255,255,255,0.05);
    color: var(--expertibot-text);
    border-bottom-left-radius: 4px;
}

.expertibot-msg.user {
    align-self: flex-end;
    background: var(--expertibot-theme);
    color: white;
    border-bottom-right-radius: 4px;
}

.expertibot-msg.loading {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 16px;
}

.expertibot-dot {
    width: 6px;
    height: 6px;
    background: var(--expertibot-text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.expertibot-dot:nth-child(1) { animation-delay: -0.32s; }
.expertibot-dot:nth-child(2) { animation-delay: -0.16s; }

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

/* Input Area */
.expertibot-footer {
    padding: 12px 16px;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    gap: 8px;
    align-items: center;
}

#expertibot-container .expertibot-input {
    flex: 1;
    background: rgba(255,255,255,0.05) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    color: #ffffff !important;
    padding: 10px 14px !important;
    border-radius: 20px !important;
    font-size: 14px !important;
    outline: none !important;
    transition: 0.2s;
}
#expertibot-container .expertibot-input::placeholder {
    color: rgba(255,255,255,0.4) !important;
}
#expertibot-container .expertibot-input:focus {
    border-color: var(--expertibot-theme) !important;
    background: rgba(255,255,255,0.1) !important;
    color: #ffffff !important;
}

.expertibot-btn {
    background: var(--expertibot-theme);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}
.expertibot-btn:hover {
    transform: scale(1.05);
}
.expertibot-btn:active {
    transform: scale(0.95);
}
.expertibot-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Voice Button (Optional) */
.expertibot-btn.voice {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--expertibot-text-muted);
}
.expertibot-btn.voice:hover {
    color: var(--expertibot-text);
    border-color: rgba(255,255,255,0.4);
}
.expertibot-btn.voice.recording {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    animation: pulseRecord 1.5s infinite;
}

@keyframes pulseRecord {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
