/**
 * JB Assistant - Chat Widget Styles
 * Jacques Best Brokerage
 */

/* Widget Container */
#jb-assistant {
    --jb-primary: #1a56db;
    --jb-primary-dark: #0d3d8c;
    --jb-secondary: #10b981;
    --jb-dark: #1e293b;
    --jb-light: #f8fafc;
    --jb-gray: #64748b;
    --jb-radius: 16px;

    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

/* Toggle Button */
.jb-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--jb-primary), var(--jb-primary-dark));
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(26, 86, 219, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.jb-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(26, 86, 219, 0.5);
}

.jb-toggle-icon,
.jb-toggle-close {
    font-size: 24px;
    position: absolute;
    transition: all 0.3s ease;
}

.jb-toggle-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

#jb-assistant.jb-open .jb-toggle-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

#jb-assistant.jb-open .jb-toggle-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* Chat Window */
.jb-chat {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: var(--jb-radius);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
}

#jb-assistant.jb-open .jb-chat {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.jb-header {
    background: linear-gradient(135deg, var(--jb-primary), var(--jb-primary-dark));
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.jb-avatar {
    width: 45px;
    height: 45px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.jb-info {
    flex: 1;
}

.jb-name {
    font-weight: 600;
    font-size: 16px;
}

.jb-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.jb-status-dot {
    width: 8px;
    height: 8px;
    background: var(--jb-secondary);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.jb-minimize {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.jb-minimize:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Area */
.jb-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--jb-light);
}

.jb-messages::-webkit-scrollbar {
    width: 6px;
}

.jb-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Welcome Message */
.jb-welcome {
    text-align: center;
    padding: 30px 20px;
}

.jb-welcome-avatar {
    font-size: 50px;
    margin-bottom: 15px;
}

.jb-welcome h4 {
    margin: 0 0 10px;
    color: var(--jb-dark);
}

.jb-welcome p {
    color: var(--jb-gray);
    margin: 0 0 20px;
    font-size: 14px;
}

.jb-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.jb-quick-btn {
    background: white;
    border: 1px solid #e2e8f0;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--jb-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.jb-quick-btn:hover {
    background: var(--jb-primary);
    color: white;
    border-color: var(--jb-primary);
}

/* Message Bubbles */
.jb-message {
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.jb-user {
    align-self: flex-end;
}

.jb-assistant {
    align-self: flex-start;
}

.jb-message-content {
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
}

.jb-user .jb-message-content {
    background: linear-gradient(135deg, var(--jb-primary), var(--jb-primary-dark));
    color: white;
    border-bottom-right-radius: 4px;
}

.jb-assistant .jb-message-content {
    background: white;
    color: var(--jb-dark);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.jb-message-content a {
    color: inherit;
    text-decoration: underline;
}

.jb-message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.jb-message-time {
    font-size: 11px;
    color: var(--jb-gray);
    margin-top: 4px;
    padding: 0 4px;
}

.jb-user .jb-message-time {
    text-align: right;
}

/* Typing Indicator */
.jb-typing {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
    background: white;
    width: fit-content;
    border-radius: 16px;
    margin: 0 16px 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.jb-typing-dot {
    width: 8px;
    height: 8px;
    background: var(--jb-gray);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.jb-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.jb-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-5px);
    }
}

/* Input Area */
.jb-input-area {
    display: flex;
    gap: 10px;
    padding: 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
}

#jb-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

#jb-input:focus {
    border-color: var(--jb-primary);
}

#jb-input::placeholder {
    color: #94a3b8;
}

#jb-send {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--jb-primary), var(--jb-primary-dark));
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#jb-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(26, 86, 219, 0.4);
}

#jb-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 480px) {
    #jb-assistant {
        bottom: 10px;
        right: 10px;
    }

    .jb-chat {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -10px;
        border-radius: 12px;
    }

    .jb-toggle {
        width: 55px;
        height: 55px;
    }
}