/* EkoChat Widget CSS */

#ekochat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#ekochat-widget.ekochat-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#ekochat-widget.ekochat-visible {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
}

/* Bubble button */
#ekochat-bubble {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ff6600, #cc4400);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 102, 0, 0.5);
    color: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: ekochat-pulse 2s ease-in-out infinite;
    position: relative;
}

#ekochat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(255, 102, 0, 0.7);
}

@keyframes ekochat-pulse {
    0%, 100% { box-shadow: 0 4px 20px rgba(255, 102, 0, 0.5); }
    50% { box-shadow: 0 4px 30px rgba(255, 102, 0, 0.9), 0 0 0 8px rgba(255, 102, 0, 0.15); }
}

.ekochat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e53e3e;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* Chat box */
.ekochat-box-hidden {
    display: none;
}

.ekochat-box-visible {
    display: flex;
    flex-direction: column;
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 360px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: ekochat-slide-up 0.3s ease;
}

@keyframes ekochat-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
#ekochat-header {
    background: linear-gradient(135deg, #0a1628, #1a3a6e);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ekochat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ekochat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 102, 0, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.ekochat-name {
    font-weight: 700;
    font-size: 14px;
}

.ekochat-status {
    font-size: 11px;
    color: #7fffb0;
    margin-top: 2px;
}

.ekochat-close-btn {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: color 0.2s;
    line-height: 1;
}

.ekochat-close-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.1);
}

/* Messages */
#ekochat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 320px;
}

#ekochat-messages::-webkit-scrollbar {
    width: 4px;
}

#ekochat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#ekochat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.ekochat-msg {
    max-width: 90%;
    animation: ekochat-msg-in 0.3s ease;
}

@keyframes ekochat-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.ekochat-msg-bot {
    align-self: flex-start;
}

.ekochat-msg-user {
    align-self: flex-end;
}

.ekochat-msg-text {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-line;
}

.ekochat-msg-bot .ekochat-msg-text {
    background: #fff;
    color: #1a1a2e;
    border: 1px solid #e8e8e8;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.ekochat-msg-user .ekochat-msg-text {
    background: linear-gradient(135deg, #ff6600, #cc4400);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.ekochat-msg-text a {
    color: #ff6600;
    font-weight: 700;
    text-decoration: none;
}

.ekochat-msg-user .ekochat-msg-text a {
    color: #ffe0c0;
}

.ekochat-msg-text a:hover {
    text-decoration: underline;
}

/* Typing indicator */
.ekochat-typing .ekochat-msg-text {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 16px;
}

.ekochat-dot {
    width: 8px;
    height: 8px;
    background: #aaa;
    border-radius: 50%;
    animation: ekochat-typing-dot 1.2s infinite;
}

.ekochat-dot:nth-child(2) { animation-delay: 0.2s; }
.ekochat-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes ekochat-typing-dot {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* Input area */
#ekochat-input-area {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-top: 1px solid #eee;
    background: #fff;
    gap: 8px;
}

#ekochat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 9px 16px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

#ekochat-input:focus {
    border-color: #ff6600;
}

#ekochat-send-btn {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #ff6600, #cc4400);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

#ekochat-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 12px rgba(255, 102, 0, 0.5);
}

/* Footer */
#ekochat-footer {
    padding: 8px 16px;
    background: #f0f4ff;
    font-size: 12px;
    text-align: center;
    border-top: 1px solid #e0e8ff;
    color: #555;
}

#ekochat-footer a {
    color: #1a3a6e;
    text-decoration: none;
    font-weight: 600;
}

#ekochat-footer a:hover {
    color: #ff6600;
}

/* Mobile */
@media (max-width: 480px) {
    #ekochat-widget {
        bottom: 16px;
        right: 16px;
    }

    .ekochat-box-visible {
        width: calc(100vw - 32px);
        right: -8px;
        bottom: 68px;
        max-height: 70vh;
    }
}
