/* =============================================
   HaneCan AI Chat Widget Styles
============================================= */

/* Floating Button */
.hanecan-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0e7490 0%, #06b6d4 100%);
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(14, 116, 144, 0.4);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.5rem;
}
.hanecan-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(14, 116, 144, 0.55);
}
.hanecan-btn .hanecan-btn-icon {
    transition: transform 0.3s ease;
}
.hanecan-btn.open .hanecan-btn-icon {
    transform: rotate(90deg);
}
.hanecan-btn .hanecan-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ef4444;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    border: 2px solid #fff;
}

/* Chat Panel */
.hanecan-panel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 370px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.hanecan-panel.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.hanecan-header {
    background: linear-gradient(135deg, #0e7490 0%, #06b6d4 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.hanecan-header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.hanecan-header-info {
    flex: 1;
    min-width: 0;
}
.hanecan-header-name {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.2;
}
.hanecan-header-status {
    font-size: 0.75rem;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 4px;
}
.hanecan-header-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}
.hanecan-header-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}
.hanecan-header-close:hover {
    opacity: 1;
}

/* Messages Area */
.hanecan-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}
.hanecan-messages::-webkit-scrollbar {
    width: 5px;
}
.hanecan-messages::-webkit-scrollbar-track {
    background: transparent;
}
.hanecan-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

/* Message Bubbles */
.hanecan-msg {
    max-width: 85%;
    display: flex;
    flex-direction: column;
    animation: hanecanFadeIn 0.3s ease;
}
.hanecan-msg.user {
    align-self: flex-end;
}
.hanecan-msg.ai {
    align-self: flex-start;
}
.hanecan-msg-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.875rem;
    line-height: 1.5;
    word-break: break-word;
}
.hanecan-msg.user .hanecan-msg-bubble {
    background: linear-gradient(135deg, #0e7490, #0891b2);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.hanecan-msg.ai .hanecan-msg-bubble {
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}
.hanecan-msg-time {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: 3px;
    padding: 0 4px;
}
.hanecan-msg.user .hanecan-msg-time {
    text-align: right;
}

/* Product Cards */
.hanecan-products {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.hanecan-product-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    transition: border-color 0.2s;
}
.hanecan-product-card:hover {
    border-color: #0e7490;
}
.hanecan-product-img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f1f5f9;
}
.hanecan-product-info {
    flex: 1;
    min-width: 0;
}
.hanecan-product-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
}
.hanecan-product-title:hover {
    color: #0e7490;
}
.hanecan-product-price {
    font-size: 0.8rem;
    font-weight: 700;
    color: #0e7490;
    margin-top: 2px;
}
.hanecan-product-actions {
    display: flex;
    gap: 6px;
    margin-top: 5px;
}
.hanecan-product-btn {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.hanecan-product-btn.view {
    background: #f0f9ff;
    color: #0e7490;
    border: 1px solid #bae6fd;
}
.hanecan-product-btn.view:hover {
    background: #e0f2fe;
}
.hanecan-product-btn.cart {
    background: linear-gradient(135deg, #0e7490, #0891b2);
    color: #fff;
}
.hanecan-product-btn.cart:hover {
    opacity: 0.9;
}

/* Typing Indicator */
.hanecan-typing {
    display: none;
    align-self: flex-start;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}
.hanecan-typing.visible {
    display: flex;
    align-items: center;
    gap: 4px;
}
.hanecan-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #94a3b8;
    animation: hanecanTyping 1.4s infinite;
}
.hanecan-typing span:nth-child(2) {
    animation-delay: 0.2s;
}
.hanecan-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Input Area */
.hanecan-input-area {
    padding: 12px 14px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: #fff;
    flex-shrink: 0;
}
.hanecan-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 0.875rem;
    font-family: inherit;
    resize: none;
    max-height: 80px;
    min-height: 40px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s;
}
.hanecan-input:focus {
    border-color: #0e7490;
}
.hanecan-input::placeholder {
    color: #94a3b8;
}
.hanecan-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #0e7490, #06b6d4);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.2s;
    flex-shrink: 0;
}
.hanecan-send-btn:hover {
    transform: scale(1.05);
}
.hanecan-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Quick Actions / Suggestions */
.hanecan-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px 10px;
    background: #fff;
    flex-shrink: 0;
}
.hanecan-suggestion-btn {
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 0.75rem;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}
.hanecan-suggestion-btn:hover {
    background: #f0f9ff;
    border-color: #0e7490;
    color: #0e7490;
}

/* Animations */
@keyframes hanecanFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes hanecanTyping {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .hanecan-btn {
        bottom: 76px;
        right: 16px;
        width: 52px;
        height: 52px;
        font-size: 1.3rem;
    }
    .hanecan-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    .hanecan-panel.visible {
        transform: translateY(0) scale(1);
    }
}
@media (min-width: 481px) and (max-width: 768px) {
    .hanecan-btn {
        bottom: 76px;
        right: 16px;
    }
    .hanecan-panel {
        bottom: 88px;
        right: 16px;
        width: 340px;
        height: 480px;
    }
}
