/* widget.css - Customer Facing Chat styling (Green Theme) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #10b981; /* Emerald Green */
    --primary-hover: #059669;
    --primary-light: #ecfdf5;
    
    --bg-dark: #0f172a;
    --text-main: #1e293b;
    --text-muted: #64748b;
    
    --wa-green: #25d366; /* WhatsApp Green */
    
    --border: #f1f5f9;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #ffffff;
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

.chat-widget-window {
    display: flex;
    flex-direction: column;
    height: 100vh;
    border: none;
    position: relative;
}

/* --- HEADER --- */
.chat-header {
    background-color: var(--primary);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.bot-info-block {
    display: flex;
    flex-direction: column;
}

.bot-title {
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.2px;
}

.status-block {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0.9;
}

.status-dot-active {
    width: 6px;
    height: 6px;
    background-color: #ffffff;
    border-radius: 50%;
    display: inline-block;
}

.close-btn {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
}

/* --- CHAT STREAM --- */
.chat-body {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #f8fafc;
}

/* Custom Scrollbars */
.chat-body::-webkit-scrollbar {
    width: 4px;
}
.chat-body::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 2px;
}

.message-bubble {
    display: flex;
    max-width: 80%;
    margin-bottom: 2px;
}

.message-bubble.user {
    align-self: flex-end;
}

.message-bubble.assistant {
    align-self: flex-start;
}

.message-content {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.4;
}

.message-bubble.user .message-content {
    background-color: var(--primary);
    color: #ffffff;
    border-bottom-right-radius: 2px;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.message-bubble.assistant .message-content {
    background-color: #ffffff;
    color: var(--text-main);
    border-bottom-left-radius: 2px;
    border: 1px solid #e2e8f0;
}

.message-bubble.thinking .message-content {
    color: var(--text-muted);
    font-style: italic;
    background-color: transparent;
    border: none;
    padding: 4px;
}

/* --- LEAD FORM OVERLAY --- */
.lead-form-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    z-index: 10;
    backdrop-filter: blur(10px);
    animation: widget-fade-in 0.25s ease-out;
}

.lead-form-card {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 24px;
    padding: 28px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: widget-slide-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes widget-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.lead-form-card h4 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--primary);
    letter-spacing: -0.2px;
}

.lead-form-card p {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

.lead-form-group {
    margin-bottom: 14px;
    text-align: left;
}

.lead-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-main);
}

.lead-form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 13.5px;
    border: 1px solid #e2e8f0;
    background-color: #f8fafc;
    border-radius: 10px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lead-form-control:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

.lead-form-control.error {
    border-color: #fca5a5;
    background-color: #fef2f2;
}

.lead-form-control.error:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

.lead-form-error {
    color: #ef4444;
    font-size: 11px;
    margin-top: 5px;
    display: block;
    font-weight: 500;
}

.lead-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.btn-submit-lead {
    flex-grow: 2;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #ffffff;
    border: none;
    padding: 12px 20px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
    transition: all 0.3s ease;
}

.btn-submit-lead:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

.btn-submit-lead:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-skip-lead {
    flex-grow: 1;
    background-color: #f1f5f9;
    color: var(--text-main);
    border: 1px solid #cbd5e1;
    padding: 12px 20px;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-skip-lead:hover {
    background-color: #e2e8f0;
}


/* --- INPUT BAR --- */
.chat-input-area {
    display: flex;
    border-top: 1px solid #cbd5e1;
    background-color: #ffffff;
    padding: 4px;
}

.chat-input-area input {
    flex-grow: 1;
    border: none;
    outline: none;
    padding: 14px 16px;
    font-size: 13.5px;
}

.chat-input-area button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 14px;
}

.chat-input-area button svg {
    width: 22px;
    height: 22px;
    fill: var(--primary);
    transition: fill 0.2s ease;
}

.chat-input-area button:hover svg {
    fill: var(--primary-hover);
}

.end-chat-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 0 12px;
    border-right: 1px solid #e2e8f0;
    transition: color 0.2s ease, background-color 0.2s ease;
    outline: none;
    display: flex;
    align-items: center;
}

.end-chat-btn:hover {
    color: #dc2626;
    background-color: #fef2f2;
}

/* --- CHAT ENDED AREA --- */
.chat-ended-area {
    padding: 8px 12px;
    background-color: #ffffff;
    border-top: 1px solid #cbd5e1;
    display: flex;
    justify-content: center;
}

.restart-chat-btn {
    width: 100%;
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s/transform ease;
}

.restart-chat-btn:hover {
    background-color: var(--primary-hover);
}


/* --- BRAND WATERMARK --- */
.chat-footer-brand {
    text-align: center;
    background-color: #ffffff;
    font-size: 10px;
    color: var(--text-muted);
    padding: 4px 0 8px 0;
    border-top: 1px solid #f8fafc;
}

.chat-footer-brand a {
    color: var(--text-muted);
    font-weight: 600;
    text-decoration: none;
}
