/* Voidly Chatbot Styles - Based on Original */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

@keyframes subtle-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

@keyframes attention {
    0% {
        transform: scale(1);
    }
    5% {
        transform: scale(1.05);
    }
    10% {
        transform: scale(1);
    }
    15% {
        transform: scale(1.05);
    }
    20%, 100% {
        transform: scale(1);
    }
}

@keyframes gentle-float {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-4px) scale(1);
    }
}

@keyframes soft-pulse {
    0%, 100% {
        box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    }
    50% {
        box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 214, 125, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(0, 214, 125, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(0, 214, 125, 0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typing {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* Chat Button */
#voidly-container .chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #007bff;
    color: white;
    height: 46px;
    padding: 0 16px;
    border-radius: 100px;
    cursor: pointer;
    display: none;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    z-index: 1000;
    animation: gentle-float 3s ease-in-out infinite;
    transform-origin: center center;
    border: none;
}

.chat-button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    animation: none;
}

/* Chat Box */
.chat-box {
    border: none;
    border-radius: 12px;
    width: 360px;
    height: 600px;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #fff;
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    display: none;
    touch-action: none;
    -webkit-overflow-scrolling: touch;
}

/* Chat Header */
.chat-box .header {
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-box .logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-box .avatar-container {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: #007bff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    padding: 0;
    position: relative;
}

.chat-box .avatar-container .chat-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

.chat-box .text-container {
    display: flex;
    flex-direction: column;
    gap: 0px;
}

.chat-box .name-and-status {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.chat-box .agent-name {
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.2;
    font-size: 15px;
}

.chat-box .job-title {
    font-size: 11px;
    color: #8a9aa4;
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-box .job-title::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #22c55e;
    border-radius: 50%;
    margin-left: 4px;
}

.chat-box .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #22c55e;
    box-shadow: 0 0 0 2px #fff;
    position: absolute;
    bottom: -1px;
    right: -1px;
    animation: pulse 2s ease-in-out infinite;
}

.chat-box .header-controls {
    display: flex;
    gap: 8px;
}

.chat-box .minimize-button,
.chat-box .refresh-button,
.chat-box .new-chat-button {
    border: none;
    background: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

/* Chat Messages */
#chat-log {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scroll-behavior: smooth;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.message-container {
    display: flex;
    flex-direction: column;
    margin: 2px 0;
    max-width: 80%;
    animation: slideIn 0.3s ease-out;
}

.message-container[data-sender="user"] {
    align-items: flex-end;
    align-self: flex-end;
}

.message-container[data-sender="bot"] {
    align-items: flex-start;
    align-self: flex-start;
}

.message-element {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.message-container[data-sender="user"] .message-element {
    background-color: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-container[data-sender="bot"] .message-element {
    background-color: #f1f3f5;
    color: #2c3e50;
    border-bottom-left-radius: 4px;
}

.message-timestamp {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 2px;
    margin-left: 4px;
    margin-right: 4px;
}

.message-container[data-sender="user"] .message-timestamp {
    text-align: right;
    margin-right: 4px;
}

.message-container[data-sender="bot"] .message-timestamp {
    text-align: left;
    margin-left: 4px;
}

/* Typing Indicator */
.typing-indicator {
    background-color: #f1f3f5;
    padding: 8px 16px;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    margin: 4px 0;
    width: fit-content;
    align-self: flex-start;
    font-size: 14px;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-indicator::after {
    content: "...";
    animation: typing 1.4s infinite;
}

/* Chat Input */
.chat-box .input-container {
    padding: 16px;
    background-color: #f8f9fa;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
}

.chat-box .user-input {
    flex-grow: 1;
    padding: 0 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
    height: 40px;
    font-size: 16px;
    touch-action: manipulation;
}

.user-input:focus {
    border-color: #007bff;
}

.chat-box .send-button {
    border: none;
    background-color: #007bff;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background-color 0.3s ease;
    padding: 0;
    flex-shrink: 0;
}

.send-button:hover {
    background-color: #0056b3;
}

.send-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 14px;
}

/* Chat Button Inner Elements */
#voidly-container .chat-button .avatar-container {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    position: relative;
}

#voidly-container .chat-button .avatar-container .chat-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

#voidly-container .chat-button .text-container {
    display: flex;
    align-items: center;
    margin-left: 4px;
    transform: translateY(-1px);
}

#voidly-container .chat-button .name-and-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

#voidly-container .chat-button .agent-name {
    font-weight: 600;
    line-height: 1;
    font-size: 15px;
}

#voidly-container .chat-button .online-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

#voidly-container .chat-button .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #00d67d;
    box-shadow: 0 0 0 2px rgba(0, 214, 125, 0.3);
    animation: pulse 1.5s ease-in-out infinite;
    margin-left: 4px;
    flex-shrink: 0;
    transform: translateY(-1px);
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #voidly-container .chat-box {
        width: 100% !important;
        height: 100% !important;
        bottom: 0 !important;
        right: 0 !important;
        border-radius: 0 !important;
        position: fixed;
        overscroll-behavior: contain;
    }
    
    #voidly-container .chat-button {
        bottom: 10px !important;
        right: 10px !important;
        width: 46px;
        height: 46px;
        padding: 0;
        animation: gentle-float 3s ease-in-out infinite;
    }
    
    #voidly-container .chat-button:hover {
        transform: translateY(-2px) scale(1.02);
        box-shadow: 0 4px 16px rgba(0,0,0,0.2);
        animation: none;
    }
    
    #voidly-container .chat-button .text-container {
        display: none !important;
    }
    
    #voidly-container .chat-button .avatar-container {
        margin: auto;
        position: relative;
    }

    #voidly-container .chat-button .status-dot {
        display: block;
        position: absolute;
        bottom: -1px;
        right: -1px;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background-color: #00d67d;
        box-shadow: 0 0 0 2px rgba(0, 214, 125, 0.3);
        animation: pulse 1.5s ease-in-out infinite;
        margin: 0;
    }
    
    #chat-log {
        overscroll-behavior: contain;
        overscroll-behavior-y: contain;
    }
}