/* --- chatbot-style.css --- */

/* --- Base Styles & Variables --- */
:root {
    --brand-color: #007AFF; /* Apple's classic blue */
    --background-light: #f5f5f7;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --border-color: rgba(0, 0, 0, 0.1);
    --user-message-bg: var(--brand-color);
    --ai-message-bg: #e5e5ea;
    --ai-message-text: #1d1d1f;
    /* The font will be dynamically set by JavaScript */
}

/* --- Chat Bubble --- */
#np-chat-bubble {
    /* We hide the bubble on the dedicated chat page */
    display: none;
}

#np-chat-bubble:hover {
    transform: scale(1.1);
}

#np-chat-bubble svg {
    width: 32px;
    height: 32px;
    color: white;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#np-chat-bubble .icon-close {
    opacity: 0;
    transform: scale(0);
    position: absolute;
}

#np-chat-bubble.active .icon-chat {
    opacity: 0;
    transform: scale(0);
}

#np-chat-bubble.active .icon-close {
    opacity: 1;
    transform: scale(1);
}


/* --- Chat Window --- */
#np-chat-window {
    
    width: 100%;
    max-width: 800px; /* Adjust as needed for your theme */
    height: 85vh; 
    max-height: 800px;
    margin: 40px auto; /* Adds space from header/footer and centers it */
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    
}

#np-chat-window.active {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

/* --- Chat Header (macOS Frosted Glass Effect) --- */
.np-chat-header {
    padding: 12px 16px;
    background-color: rgba(245, 245, 247, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.np-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.np-chat-header p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
}

/* --- Message Area --- */
.np-chat-messages {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.chat-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.4;
}

.user-message {
    background-color: var(--user-message-bg);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ai-message {
    background-color: var(--ai-message-bg);
    color: var(--ai-message-text);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 14px;
}
.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #ccc;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}


/* --- Input Area --- */
.np-chat-input-form {
    display: flex;
    padding: 10px;
    border-top: 1px solid var(--border-color);
    background-color: #fff;
    flex-shrink: 0;
}

.np-chat-input-form input {
    flex-grow: 1;
    border: none;
    background-color: var(--ai-message-bg);
    border-radius: 18px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit; /* Inherit font from chat window */
    outline: none;
}

.np-chat-input-form input:focus {
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.5);
}

.np-chat-input-form button {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    background-color: var(--brand-color);
    color: white;
    border-radius: 50%;
    margin-left: 10px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s ease;
}

.np-chat-input-form button:hover {
    background-color: #0056b3;
}

.np-chat-input-form button:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
}

.np-chat-input-form button svg {
    width: 18px;
    height: 18px;
}

/* --- Product Recommendation Card Styles --- */
.ai-message.product-recommendation-container {
    background-color: transparent;
    padding: 0;
    max-width: 100%;
}

.product-card {
    display: flex;
    align-items: center;
    background-color: var(--ai-message-bg);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
}

.product-card-image {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    margin-right: 12px;
    object-fit: cover;
    flex-shrink: 0;
}

.product-card-info {
    flex-grow: 1;
}

.product-card-info h4 {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.product-card-info p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.product-card-action button {
    background-color: var(--brand-color);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.product-card-action button:hover {
    background-color: #0056b3;
}

.product-card-action button:disabled {
    background-color: #a0a0a0;
    cursor: not-allowed;
}