/* Chat Widget Base Styles */
#lfp-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* Floating Trigger Button */
.lfp-chat-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-color, #2563eb);
    color: white;
    border: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.lfp-chat-trigger:hover {
    transform: scale(1.05);
    background-color: var(--primary-color-hover, #1d4ed8);
}

/* Chat Window Panel */
.lfp-chat-panel {
    display: none; /* Hidden by default */
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    max-height: calc(100vh - 100px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
    flex-direction: column;
    overflow: hidden;
    animation: lfpSlideUp 0.3s ease;
}

.lfp-chat-panel.active {
    display: flex;
}

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

/* Header */
.lfp-chat-header {
    background: var(--primary-color, #2563eb);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lfp-chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.lfp-chat-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.lfp-chat-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.lfp-chat-header p {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.8;
}

.lfp-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

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

/* Messages Area */
.lfp-chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #f8fafc;
}

.lfp-msg {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.lfp-msg-ai {
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #334155;
    border-bottom-left-radius: 2px;
}

.lfp-msg-user {
    align-self: flex-end;
    background: var(--primary-color, #2563eb);
    color: white;
    border-bottom-right-radius: 2px;
}

.lfp-msg-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.65rem;
}

.lfp-msg-link-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 30px;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: var(--primary-color, #2563eb);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.lfp-msg-link-chip:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

/* Typing Indicator */
.lfp-typing-indicator {
    display: none;
    align-self: flex-start;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border-bottom-left-radius: 2px;
}
.lfp-typing-indicator.active { display: flex; gap: 4px; }

.lfp-typing-dot {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 50%;
    animation: lfpTyping 1.4s infinite ease-in-out;
}
.lfp-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.lfp-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes lfpTyping {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Input Area */
.lfp-chat-input-container {
    padding: 1rem;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 0.5rem;
}

.lfp-chat-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.lfp-chat-input:focus {
    border-color: var(--primary-color, #2563eb);
}

.lfp-chat-send {
    background: var(--primary-color, #2563eb);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.lfp-chat-send:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

/* Ticket Form Area */
.lfp-ticket-form {
    display: none;
    flex-direction: column;
    padding: 1.5rem;
    background: #ffffff;
    position: absolute;
    top: 68px; /* Below header */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    overflow-y: auto;
}

.lfp-ticket-form.active {
    display: flex;
}

.lfp-ticket-form h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    color: #0f172a;
}

.lfp-ticket-form p {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 1.5rem;
}

.lfp-form-group {
    margin-bottom: 1rem;
}

.lfp-form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.4rem;
}

.lfp-form-group input,
.lfp-form-group textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.6rem;
    font-size: 0.9rem;
    font-family: inherit;
}

.lfp-form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.lfp-ticket-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.lfp-btn {
    padding: 0.6rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    flex: 1;
}

.lfp-btn-primary {
    background: var(--primary-color, #2563eb);
    color: white;
}

.lfp-btn-secondary {
    background: #f1f5f9;
    color: #334155;
}

.lfp-ticket-error {
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    display: none;
}
.lfp-ticket-success {
    color: #10b981;
    font-size: 0.9rem;
    margin-top: 1rem;
    display: none;
    text-align: center;
    padding: 1rem;
    background: #ecfdf5;
    border-radius: 6px;
}

/* Responsive */
@media (max-width: 480px) {
    .lfp-chat-panel {
        width: calc(100vw - 32px);
        right: -8px;
        bottom: 70px;
    }
}
