.chatbot {
    position: fixed;
    right: 20px;
    bottom: 340px;
    z-index: 9999;
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.chatbot-toggle:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.chatbot-toggle svg {
    width: 32px;
    height: 32px;
    display: block;
    color: #555;
}

.chatbot-toggle.hidden {
    opacity: 0;
    pointer-events: none;
}

.chatbot-toggle::after {
    content: "";
    position: absolute;
    top: -100%;
    left: -100%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        120deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.6) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(25deg);
    animation: chatbot-shine 4s infinite;
    opacity: 0;
}

@keyframes chatbot-shine {
    0% { opacity: 0; transform: translate(-150%, -150%) rotate(25deg); }
    10% { opacity: 1; }
    30% { transform: translate(50%, 50%) rotate(25deg); opacity: 0; }
    100% { opacity: 0; }
}

.chatbot-window {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 360px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    transform-origin: bottom right;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    overflow: hidden;
}

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

.chatbot-header {
    background: #c83030;
    color: #fff;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.chatbot-header-title {
    font-size: 15px;
}

.chatbot-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8f9fa;
}

.chatbot-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
}

.chatbot-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chatbot-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #c83030;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.chatbot-message.user .chatbot-avatar {
    background: #555;
}

.chatbot-bubble {
    background: #fff;
    padding: 10px 14px;
    border-radius: 12px 12px 12px 4px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.chatbot-bubble.user {
    background: #c83030;
    color: #fff;
    border-radius: 12px 12px 4px 12px;
}

.chatbot-product {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
}

.chatbot-product-img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.chatbot-product-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
}

.chatbot-product-price {
    color: #c83030;
    font-weight: 600;
}

.chatbot-product-link {
    color: #c83030;
    text-decoration: underline;
    font-size: 12px;
}

.chatbot-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid #eee;
    background: #fff;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

.chatbot-input:focus {
    border-color: #c83030;
}

.chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #c83030;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.chatbot-send:hover {
    background: #a82828;
}

.chatbot-form {
    padding: 14px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chatbot-form-text {
    font-size: 13px;
    color: #666;
    margin: 0 0 4px;
}

.chatbot-form-input {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

.chatbot-form-input:focus {
    border-color: #c83030;
}

.chatbot-form-textarea {
    resize: none;
    height: 60px;
}

.chatbot-form .btn {
    background: #c83030;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    cursor: pointer;
    font-family: 'Rubik', sans-serif;
    font-weight: 500;
    transition: background 0.2s;
}

.chatbot-form .btn:hover {
    background: #a82828;
}

.chatbot-form .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.chatbot-form-status {
    font-size: 12px;
    text-align: center;
    margin: 4px 0 0;
}

.typing span {
    animation: chatbot-blink 1.4s infinite both;
    font-size: 20px;
    line-height: 1;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatbot-blink {
    0% { opacity: 0.2; }
    20% { opacity: 1; }
    100% { opacity: 0.2; }
}

@media (max-width: 768px) {
    .chatbot {
        right: 10px;
        bottom: 270px;
    }
    .chatbot-toggle {
        width: 50px;
        height: 50px;
    }
    .chatbot-toggle svg {
        width: 26px;
        height: 26px;
    }
}

@media (max-width: 480px) {
    .chatbot-window {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        bottom: 0;
        right: 0;
    }
}

.chatbot-bubble a {
    color: #c83030;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s;
}
.chatbot-bubble a:hover {
    color: #a82828;
    text-decoration: none;
}
