/* ===================================================================
   ASH AI Chat Widget
   =================================================================== */

/* ---------------------------------------------------------------------------
   Floating Toggle Button
   --------------------------------------------------------------------------- */
.ash-chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--primary-accent, #00c4b4);
    color: #fff;
    border: none;
    border-radius: 28px;
    padding: 12px 20px 12px 16px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.ash-chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.ash-chat-toggle-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ash-chat-icon-img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.5));
    animation: ash-icon-pulse 2.5s ease-in-out infinite;
}

@keyframes ash-icon-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.3));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 20px rgba(0, 196, 180, 0.4));
        transform: scale(1.08);
    }
}

.ash-chat-toggle-text {
    position: relative;
    overflow: hidden;
    height: 20px;
    min-width: 60px;
    max-width: 120px;
}

.ash-chat-toggle-text span {
    position: absolute;
    left: 0;
    top: 0;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.ash-chat-toggle-text span.active {
    opacity: 1;
}

/* Hide text on very small screens — icon-only circle */
@media (max-width: 400px) {
    .ash-chat-toggle-text {
        display: none;
    }
    .ash-chat-toggle {
        padding: 8px;
        border-radius: 50%;
        width: 72px;
        height: 72px;
        justify-content: center;
    }
}

/* ---------------------------------------------------------------------------
   Chat Panel
   --------------------------------------------------------------------------- */
.ash-chat-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: ash-chat-slide-up 0.3s ease;
}

.ash-chat-panel.open {
    display: flex;
}

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

/* Header */
.ash-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--primary-accent, #00c4b4);
    color: #fff;
    flex-shrink: 0;
}

.ash-chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ash-chat-header-icon {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ash-chat-header-icon-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.ash-chat-header-title {
    font-weight: 700;
    font-size: 15px;
}

.ash-chat-header-subtitle {
    font-size: 11px;
    opacity: 0.85;
}

.ash-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ash-chat-close:hover {
    opacity: 1;
}

/* ---------------------------------------------------------------------------
   Messages Area
   --------------------------------------------------------------------------- */
.ash-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafa;
}

/* Welcome animation container */
.ash-chat-welcome {
    text-align: center;
    padding: 20px 10px;
    color: #555;
    font-size: 14px;
    line-height: 1.5;
}

.ash-chat-welcome-text {
    position: relative;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ash-chat-welcome-text span {
    position: absolute;
    opacity: 0;
    transition: opacity 0.5s ease;
    width: 100%;
    padding: 0 10px;
}

.ash-chat-welcome-text span.active {
    opacity: 1;
}

/* Message bubbles */
.ash-chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ash-chat-msg-ai {
    align-self: flex-start;
    background: var(--primary-accent, #00c4b4);
    color: #fff;
    border-bottom-left-radius: 4px;
}

.ash-chat-msg-user {
    align-self: flex-end;
    background: #e8e8e8;
    color: #222;
    border-bottom-right-radius: 4px;
}

/* Typing indicator */
.ash-chat-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--primary-accent, #00c4b4);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.ash-chat-typing-dot {
    width: 7px;
    height: 7px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: ash-dot-bounce 1.4s infinite ease-in-out both;
}

.ash-chat-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.ash-chat-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.ash-chat-typing-dot:nth-child(3) { animation-delay: 0s; }

@keyframes ash-dot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ---------------------------------------------------------------------------
   Rating Buttons
   --------------------------------------------------------------------------- */
.ash-chat-rating {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 8px 0;
}

.ash-chat-rating-btn {
    background: none;
    border: 2px solid #ddd;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
    color: #999;
}

.ash-chat-rating-btn:hover {
    border-color: var(--primary-accent, #00c4b4);
    color: var(--primary-accent, #00c4b4);
}

.ash-chat-rating-btn.selected {
    background: var(--primary-accent, #00c4b4);
    border-color: var(--primary-accent, #00c4b4);
    color: #fff;
}

/* ---------------------------------------------------------------------------
   Input Bar
   --------------------------------------------------------------------------- */
.ash-chat-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #eee;
    background: #fff;
    flex-shrink: 0;
}

.ash-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13.5px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
    resize: none;
    max-height: 80px;
    line-height: 1.4;
}

.ash-chat-input:focus {
    border-color: var(--primary-accent, #00c4b4);
}

.ash-chat-input:disabled {
    background: #f5f5f5;
    color: #999;
}

.ash-chat-send {
    background: var(--primary-accent, #00c4b4);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    flex-shrink: 0;
    transition: opacity 0.2s;
}

.ash-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ash-chat-send:not(:disabled):hover {
    opacity: 0.85;
}

/* Limit reached CTA */
.ash-chat-limit-cta {
    text-align: center;
    padding: 12px 16px;
    font-size: 13px;
    color: #666;
    background: #f0f0f0;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.ash-chat-limit-cta a {
    color: var(--primary-accent, #00c4b4);
    font-weight: 600;
    text-decoration: none;
}

.ash-chat-limit-cta a:hover {
    text-decoration: underline;
}

/* ---------------------------------------------------------------------------
   Mobile Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .ash-chat-panel {
        width: calc(100vw - 16px);
        height: calc(100vh - 80px);
        bottom: 8px;
        right: 8px;
        border-radius: 12px;
    }

    .ash-chat-toggle {
        bottom: 16px;
        right: 16px;
    }
}

@media (max-width: 768px) {
    .ash-chat-panel {
        width: calc(100vw - 24px);
        height: 60vh;
        max-height: 520px;
        bottom: 12px;
        right: 12px;
    }
}
