/* Trinity Chatbot Widget Styles - FRONTEND */
#tw-bubble {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 60px;
    height: 60px;
    background: #1d4ed8;
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#tw-bubble:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

#tw-bubble svg {
    width: 30px;
    height: 30px;
    fill: white;
}

#tw-panel {
    position: fixed;
    right: 20px;
    bottom: 90px;
    width: 380px;
    height: 500px;
    max-width: 90vw;
    max-height: 80vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
    overflow: hidden;
    flex-direction: column;
    z-index: 9998;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

#tw-head {
    background: #1d4ed8;
    color: #fff;
    padding: 16px 20px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#tw-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
}

#tw-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#tw-input {
    display: flex;
    border-top: 1px solid #e5e7eb;
    padding: 12px;
    background: white;
    gap: 8px;
}

#tw-text {
    flex: 1;
    border: 1px solid #e5e7eb;
    color: #404040;
    border-radius: 24px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

#tw-text:focus {
    border-color: #1d4ed8;
}

#tw-send {
    background: #1d4ed8;
    color: white;
    border: none;
    border-radius: 24px;
    padding: 0 16px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

#tw-send:hover {
    background: #1e40af;
}

.tw-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.tw-msg.you {
    align-self: flex-end;
}

.tw-msg.bot {
    align-self: flex-start;
}

.msg-content {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
}

.you .msg-content {
    background: #1d4ed8;
    color: white;
    border-bottom-right-radius: 4px;
}

.bot .msg-content {
    background: white;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.msg-time {
    font-size: 11px;
    color: #6b7280;
    margin-top: 4px;
    padding: 0 8px;
}

.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.chip {
    background: white;
    color: #404040;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.chip:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.cta-button {
    background: #f59e0b;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 500;
    margin-top: 12px;
    text-align: center;
    transition: background 0.2s;
}

.cta-button:hover {
    background: #d97706;
}

/* Lead Form Styles */
#tw-lead-wrap {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

#tw-lead {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    width: 400px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

#tw-lead h3 {
    margin: 0 0 16px 0;
    color: #1f2937;
    font-size: 20px;
    font-weight: 600;
}

#tw-lead label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

#tw-lead input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
	color: #404040;
}

#tw-lead input:focus {
    outline: none;
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

#tw-consent {
    font-size: 12px;
    color: #6b7280;
    margin: 16px 0;
    line-height: 1.4;
}

.lead-form-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.lead-form-buttons button {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

#lf-cancel {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}

#lf-cancel:hover {
    background: #e5e7eb;
}

#lf-submit {
    background: #1d4ed8;
    color: white;
    border: none;
}

#lf-submit:hover {
    background: #1e40af;
}

/* Typing indicator */
.typing-indicator {
    display: none;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background: #9ca3af;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
    animation: typing 1.4s infinite both;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-5px);
    }
}

/* Responsive design */
@media (max-width: 480px) {
    #tw-panel {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    #tw-bubble {
        right: 16px;
        bottom: 16px;
    }
}