/**
 * Nordhauser Gemini Bot - Chat Widget Styles
 * Brand colors: Primary #023d29, Light #cee0d2
 */

/* =========================================
   CHAT WIDGET BASE
   ========================================= */

#ngb-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

/* Chat Icon Button */
#ngb-chat-icon {
    width: 60px;
    height: 60px;
    background: #023d29;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.2s, background 0.2s;
}

#ngb-chat-icon svg {
    width: 28px;
    height: 28px;
    fill: #fff;
}

#ngb-chat-icon:hover {
    transform: scale(1.1);
    background: #035a3d;
}

/* Chat Window */
#ngb-chat-window {
    display: none;
    width: 380px;
    height: 550px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.2);
    flex-direction: column;
    overflow: hidden;
    position: absolute;
    bottom: 80px;
    right: 0;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

#ngb-chat-window.ngb-open {
    display: flex;
}

/* Chat Header */
#ngb-chat-header {
    background: #023d29;
    color: white;
    padding: 16px 20px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#ngb-chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

#ngb-chat-header-title .ngb-bot-avatar {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

#ngb-close-chat {
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#ngb-close-chat:hover {
    opacity: 1;
}

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

/* Message Bubbles */
.ngb-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: ngb-fade-in 0.3s ease;
}

@keyframes ngb-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.ngb-msg.bot {
    background: #fff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.ngb-msg.user {
    background: #023d29;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.ngb-msg a {
    color: #023d29;
    text-decoration: underline;
}

.ngb-msg.user a {
    color: #cee0d2;
}

/* Loading Indicator */
.ngb-loading {
    font-style: italic;
    color: #888;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ngb-loading::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #023d29;
    border-radius: 50%;
    animation: ngb-pulse 1s infinite;
}

@keyframes ngb-pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1); }
}

/* =========================================
   INPUT AREA
   ========================================= */

#ngb-chat-input-area {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    background: #fff;
}

#ngb-user-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    touch-action: manipulation;
    -webkit-appearance: none;
    appearance: none;
}

#ngb-user-input:focus {
    border-color: #023d29;
}

#ngb-send-btn {
    background: #023d29;
    border: none;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
    padding: 0;
}

#ngb-send-btn svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

#ngb-send-btn:hover {
    background: #035a3d;
    transform: scale(1.05);
}

#ngb-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

#ngb-send-btn:disabled svg {
    stroke: #999;
}

/* =========================================
   QUICK ACTIONS / BUTTONS
   ========================================= */

.ngb-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.ngb-quick-btn {
    background: #cee0d2;
    color: #023d29;
    border: 1px solid #b8d6be;
    padding: 8px 14px;
    border-radius: 18px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.ngb-quick-btn:hover {
    background: #023d29;
    color: white;
    border-color: #023d29;
}

/* =========================================
   FILE UPLOAD (Quote Request)
   ========================================= */

.ngb-file-upload-area {
    border: 2px dashed #cee0d2;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background: #f8faf9;
    cursor: pointer;
    transition: all 0.2s;
    margin: 10px 0;
}

.ngb-file-upload-area:hover,
.ngb-file-upload-area.ngb-drag-over {
    border-color: #023d29;
    background: #eef5f1;
}

.ngb-file-upload-area input[type="file"] {
    display: none;
}

.ngb-file-upload-icon {
    font-size: 32px;
    margin-bottom: 8px;
    color: #023d29;
}

.ngb-file-upload-text {
    font-size: 13px;
    color: #666;
}

.ngb-file-upload-text strong {
    color: #023d29;
}

.ngb-file-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-top: 10px;
}

.ngb-file-preview-icon {
    font-size: 24px;
}

.ngb-file-preview-info {
    flex: 1;
    text-align: left;
}

.ngb-file-preview-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.ngb-file-preview-size {
    font-size: 11px;
    color: #888;
}

.ngb-file-remove {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
}

.ngb-file-remove:hover {
    color: #c00;
}

/* =========================================
   FORM ELEMENTS IN CHAT
   ========================================= */

.ngb-form-group {
    margin: 10px 0;
}

.ngb-form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.ngb-form-input:focus {
    outline: none;
    border-color: #023d29;
}

.ngb-form-label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.ngb-submit-btn {
    background: #023d29;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 10px;
    transition: background 0.2s;
}

.ngb-submit-btn:hover {
    background: #035a3d;
}

.ngb-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* =========================================
   ORDER TRACKING DISPLAY
   ========================================= */

.ngb-order-status {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
}

.ngb-order-status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.ngb-order-number {
    font-weight: 700;
    color: #023d29;
}

.ngb-order-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.ngb-order-status-badge.processing {
    background: #fff3cd;
    color: #856404;
}

.ngb-order-status-badge.completed {
    background: #d4edda;
    color: #155724;
}

.ngb-order-status-badge.on-hold {
    background: #cce5ff;
    color: #004085;
}

.ngb-order-status-badge.pending {
    background: #f8d7da;
    color: #721c24;
}

.ngb-order-delivery {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.ngb-delivery-item {
    flex: 1;
    min-width: 120px;
}

.ngb-delivery-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.ngb-delivery-value {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

/* =========================================
   PROACTIVE POPUP
   ========================================= */

.ngb-proactive-popup {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 300px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
    padding: 20px;
    padding-top: 35px;
    animation: ngb-slide-up 0.3s ease;
    display: none;
}

.ngb-proactive-popup.ngb-show {
    display: block;
}

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

.ngb-proactive-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent !important;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 0;
    margin: 0;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    outline: none;
    box-shadow: none;
}

.ngb-proactive-close:hover,
.ngb-proactive-close:focus,
.ngb-proactive-close:active {
    color: #333;
    background: transparent !important;
    outline: none;
    box-shadow: none;
}

.ngb-proactive-content {
    font-size: 14px;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.5;
    padding-right: 25px;
}

.ngb-proactive-actions {
    display: flex;
    gap: 10px;
}

.ngb-proactive-btn {
    flex: 1;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.ngb-proactive-btn.primary {
    background: #023d29;
    color: white;
}

.ngb-proactive-btn.primary:hover {
    background: #035a3d;
}

.ngb-proactive-btn.secondary {
    background: #f5f5f5;
    color: #666;
}

.ngb-proactive-btn.secondary:hover {
    background: #eee;
}

/* =========================================
   ESCALATION NOTICE
   ========================================= */

.ngb-escalation-notice {
    background: #cee0d2;
    border: 1px solid #b8d6be;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
    text-align: center;
}

.ngb-escalation-notice p {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #023d29;
}

/* =========================================
   PRODUCT INFO CARD
   ========================================= */

.ngb-product-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
}

.ngb-product-card-header {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.ngb-product-card-img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    background: #f5f5f5;
}

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

.ngb-product-card-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.ngb-product-card-price {
    font-size: 16px;
    font-weight: 700;
    color: #023d29;
}

.ngb-product-card-stock {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
    margin-top: 4px;
}

.ngb-product-card-stock.in-stock {
    background: #d4edda;
    color: #155724;
}

.ngb-product-card-stock.out-of-stock {
    background: #f8d7da;
    color: #721c24;
}

.ngb-product-card-stock.backorder {
    background: #fff3cd;
    color: #856404;
}

.ngb-product-card-meta {
    font-size: 12px;
    color: #666;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #eee;
}

.ngb-product-card-meta span {
    display: block;
    margin-bottom: 2px;
}

/* =========================================
   MOBILE RESPONSIVE
   ========================================= */

@media (max-width: 480px) {
    #ngb-chat-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    #ngb-chat-window {
        position: fixed;
        width: calc(100vw - 20px);
        height: 55vh;
        max-height: 450px;
        right: 10px;
        left: 10px;
        bottom: 70px;
        top: auto;
    }

    #ngb-chat-icon {
        width: 54px;
        height: 54px;
    }

    #ngb-chat-icon svg {
        width: 24px;
        height: 24px;
    }

    .ngb-msg {
        max-width: 90%;
    }

    /* Prevent iOS zoom on input focus - must be 16px or larger */
    #ngb-user-input {
        font-size: 16px;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    .ngb-form-input {
        font-size: 16px;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    #ngb-chat-input-area {
        padding: 10px;
    }

    .ngb-proactive-popup {
        width: calc(100vw - 40px);
        right: 0;
    }

    /* Prevent auto-zoom on mobile */
    #ngb-chat-widget * {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}

/* =========================================
   TYPING INDICATOR
   ========================================= */

.ngb-typing {
    display: flex;
    gap: 4px;
    padding: 15px;
    align-self: flex-start;
}

.ngb-typing span {
    width: 8px;
    height: 8px;
    background: #023d29;
    border-radius: 50%;
    animation: ngb-typing-bounce 1.4s infinite ease-in-out;
}

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

@keyframes ngb-typing-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* =========================================
   CALCULATOR IN CHAT
   ========================================= */

.ngb-calculator {
    background: #f8faf9;
    border: 1px solid #cee0d2;
    border-radius: 8px;
    padding: 15px;
    margin: 10px 0;
}

.ngb-calculator-title {
    font-weight: 600;
    font-size: 14px;
    color: #023d29;
    margin-bottom: 12px;
}

.ngb-calculator-result {
    background: #023d29;
    color: white;
    padding: 12px;
    border-radius: 6px;
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ngb-calculator-result-label {
    font-size: 13px;
    opacity: 0.9;
}

.ngb-calculator-result-value {
    font-size: 18px;
    font-weight: 700;
}
