/* Norman AI Chat Widget - Matches normanlamps.com theme */

#norman-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* --- Chat Bubble Button --- */
#norman-bubble {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #2D5C88;
    color: #fff;
    border: none;
    border-radius: 28px;
    padding: 12px 20px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
}

#norman-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

#norman-bubble svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

/* --- Minimized Tab --- */
#norman-minimized {
    display: none;
    position: fixed;
    bottom: 0;
    right: 20px;
    background: #2D5C88;
    color: #fff;
    border: none;
    border-radius: 8px 8px 0 0;
    padding: 6px 16px;
    cursor: pointer;
    font-family: 'Open Sans', sans-serif;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
    z-index: 99999;
    transition: background 0.2s;
}

#norman-minimized:hover {
    background: #3a6f9e;
}

/* --- Chat Window --- */
#norman-chat {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    height: 520px;
    max-height: calc(100vh - 40px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    animation: normanSlideUp 0.3s ease-out;
}

@keyframes normanSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Header --- */
#norman-header {
    background: #2D5C88;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

#norman-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#norman-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

#norman-avatar svg {
    width: 20px;
    height: 20px;
}

#norman-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

#norman-subtitle {
    font-size: 11px;
    opacity: 0.8;
    margin: 0;
    line-height: 1.2;
}

#norman-header-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

#norman-header-actions button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#norman-header-actions button:hover {
    opacity: 1;
    background: rgba(255,255,255,0.15);
}

#norman-header-actions button svg {
    width: 18px;
    height: 18px;
}

/* --- Settings Menu --- */
#norman-settings-wrap {
    position: relative;
}

#norman-settings-btn svg {
    width: 16px;
    height: 16px;
}

#norman-settings-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    min-width: 160px;
    z-index: 10;
    overflow: hidden;
}

#norman-settings-menu.open {
    display: block;
}

#norman-settings-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: #333;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    cursor: pointer;
    opacity: 1;
    transition: background 0.15s;
    white-space: nowrap;
}

#norman-settings-menu button:hover {
    background: #f0f4f8;
}

#norman-settings-menu button svg {
    width: 15px;
    height: 15px;
    stroke: #666;
    flex-shrink: 0;
}

/* --- Messages Area --- */
#norman-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

#norman-messages::-webkit-scrollbar {
    width: 5px;
}

#norman-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.norman-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    word-wrap: break-word;
    font-size: 13px;
    line-height: 1.5;
}

.norman-msg a {
    color: #2D5C88;
    text-decoration: underline;
}

.norman-msg-user {
    align-self: flex-end;
    background: #2D5C88;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.norman-msg-user a {
    color: #b8d4f0;
}

.norman-msg-assistant {
    align-self: flex-start;
    background: #fff;
    color: #333;
    border: 1px solid #e2e2e2;
    border-bottom-left-radius: 4px;
}

.norman-msg-system {
    align-self: center;
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
    font-size: 12px;
    text-align: center;
    max-width: 90%;
}

/* --- Typing Indicator --- */
.norman-typing {
    align-self: flex-start;
    display: none;
    padding: 10px 14px;
    background: #fff;
    border: 1px solid #e2e2e2;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.norman-typing-dots {
    display: flex;
    gap: 4px;
}

.norman-typing-dots span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: normanBounce 1.4s infinite ease-in-out both;
}

.norman-typing-dots span:nth-child(1) { animation-delay: 0s; }
.norman-typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.norman-typing-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes normanBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* --- Input Area --- */
#norman-input-area {
    padding: 12px;
    background: #fff;
    border-top: 1px solid #e2e2e2;
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}

#norman-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 16px;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    resize: none;
    max-height: 80px;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.4;
}

#norman-input:focus {
    border-color: #2D5C88;
}

#norman-input::placeholder {
    color: #aaa;
}

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

#norman-send:hover {
    background: #3a6f9e;
}

#norman-send:disabled {
    background: #aaa;
    cursor: not-allowed;
}

#norman-send svg {
    width: 16px;
    height: 16px;
}

/* --- Character counter --- */
#norman-char-count {
    font-size: 10px;
    color: #aaa;
    text-align: right;
    padding: 0 16px 4px;
    background: #fff;
    display: none;
}

#norman-char-count.warning {
    color: #dc3545;
}

/* --- Product Cards --- */
a.norman-product-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f4f8;
    border: 1px solid #dce4ed;
    border-radius: 8px;
    padding: 8px 10px;
    margin: 4px 0;
    transition: border-color 0.15s;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.norman-product-card:hover {
    border-color: #2D5C88;
}

.norman-product-thumb {
    width: 50px;
    height: 50px;
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e2e2e2;
    flex-shrink: 0;
}

.norman-product-link {
    color: #2D5C88;
    font-weight: 600;
    font-size: 13px;
}

a.norman-product-card:hover .norman-product-link {
    text-decoration: underline;
}

/* --- Contact Fallback --- */
.norman-contact-card {
    background: #f0f4f8;
    border: 1px solid #d0dbe8;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    font-size: 13px;
}

.norman-contact-card a {
    color: #2D5C88;
    font-weight: 600;
}

/* --- Powered-by footer --- */
#norman-footer {
    text-align: center;
    padding: 4px;
    background: #fff;
    font-size: 10px;
    color: #ccc;
    flex-shrink: 0;
}

/* --- Mobile Responsive --- */
@media (max-width: 480px) {
    #norman-chat {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    #norman-bubble {
        bottom: 12px;
        right: 12px;
        padding: 10px 16px;
        font-size: 13px;
    }

    #norman-minimized {
        right: 12px;
    }
}
