/* Chatbot Widget Premium CSS - WP AI Support Chatbot */

:root {
    --wp-aisc-primary: #0f172a;
    --wp-aisc-secondary: #38bdf8;
    --wp-aisc-bg: #ffffff;
    --wp-aisc-text: #334155;
    --wp-aisc-text-light: #64748b;
    --wp-aisc-border: #e2e8f0;
}

/* Floating Launcher Button */
.wp-aisc-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--wp-aisc-primary);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999999;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s ease;
}

.wp-aisc-launcher:hover {
    transform: scale(1.1);
}

.wp-aisc-launcher svg {
    width: 28px;
    height: 28px;
    fill: currentColor;
    transition: transform 0.3s ease;
    pointer-events: none; /* Prevent blocking tap events on mobile */
}

.wp-aisc-launcher.open svg {
    transform: rotate(90deg);
}

/* Pulse animation badge for notifications/engagement */
.wp-aisc-launcher::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #ef4444;
    border: 2px solid var(--wp-aisc-primary);
    border-radius: 50%;
    animation: wpAiscPulse 2s infinite;
}

@keyframes wpAiscPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Main Chat Container Box */
.wp-aisc-container {
    display: none;
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    height: min(580px, calc(100vh - 140px));
    max-height: calc(100vh - 140px);
    background-color: var(--wp-aisc-bg);
    border: 1px solid var(--wp-aisc-border);
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
    z-index: 999999999;
    overflow: hidden;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wp-aisc-container.show {
    display: flex;
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translateY(0);
}

/* Glassmorphism Header */
.wp-aisc-header {
    background: var(--wp-aisc-primary);
    background: linear-gradient(135deg, var(--wp-aisc-primary) 0%, #1e293b 100%);
    padding: 16px 20px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.wp-aisc-bot-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wp-aisc-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    object-fit: cover;
}

.wp-aisc-bot-info {
    line-height: 1.2;
}

.wp-aisc-bot-name {
    font-weight: 600;
    font-size: 14px;
}

.wp-aisc-bot-status {
    font-size: 10px;
    color: var(--wp-aisc-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.wp-aisc-bot-status::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
}

.wp-aisc-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wp-aisc-control-btn {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.wp-aisc-control-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Chat Body (Message area) */
.wp-aisc-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

/* Scrollbar styling */
.wp-aisc-body::-webkit-scrollbar {
    width: 6px;
}
.wp-aisc-body::-webkit-scrollbar-track {
    background: transparent;
}
.wp-aisc-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
.wp-aisc-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Chat bubble structures */
.wp-aisc-msg-row {
    display: flex;
    width: 100%;
}

.wp-aisc-msg-row.user {
    justify-content: flex-end;
}

.wp-aisc-msg-row.bot {
    justify-content: flex-start;
}

.wp-aisc-bubble {
    padding: 10px 16px;
    border-radius: 14px;
    max-width: 80%;
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.wp-aisc-msg-row.user .wp-aisc-bubble {
    background-color: var(--wp-aisc-primary);
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.wp-aisc-msg-row.bot .wp-aisc-bubble {
    background-color: #ffffff;
    color: var(--wp-aisc-text);
    border: 1px solid var(--wp-aisc-border);
    border-bottom-left-radius: 2px;
}

.wp-aisc-bubble .time {
    display: block;
    font-size: 9px;
    margin-top: 4px;
    text-align: right;
    opacity: 0.6;
}

/* Visualizer Waves for Audio Calls */
.wp-aisc-audio-visualizer-container {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    background-color: #f1f5f9;
    border-bottom: 1px solid var(--wp-aisc-border);
    gap: 15px;
}

.wp-aisc-visualizer-bars {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 60px;
}

.wp-aisc-vis-bar {
    width: 4px;
    height: 10px;
    background-color: var(--wp-aisc-primary);
    border-radius: 2px;
    transition: height 0.1s ease;
}

.wp-aisc-vis-label {
    font-size: 12px;
    color: var(--wp-aisc-text-light);
    font-weight: 500;
}

/* Call Button (Mic toggle inside input block) */
.wp-aisc-btn-call {
    background-color: transparent;
    border: none;
    color: var(--wp-aisc-text-light);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.wp-aisc-btn-call:hover {
    background-color: #f1f5f9;
    color: var(--wp-aisc-primary);
}

.wp-aisc-btn-call.recording {
    background-color: #fee2e2;
    color: #ef4444;
    animation: wpAiscRecordPulse 1.5s infinite;
}

@keyframes wpAiscRecordPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Input Area styling */
.wp-aisc-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--wp-aisc-border);
    background-color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wp-aisc-input {
    flex: 1;
    border: 1px solid var(--wp-aisc-border);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--wp-aisc-text);
    outline: none;
    background-color: #f8fafc;
    transition: border-color 0.2s ease;
}

.wp-aisc-input:focus {
    border-color: var(--wp-aisc-secondary);
}

.wp-aisc-btn-send {
    background-color: var(--wp-aisc-primary);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.wp-aisc-btn-send:hover {
    background-color: #1e293b;
    transform: scale(1.05);
}

/* Typing indicator dots */
.wp-aisc-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
}

.wp-aisc-typing-dot {
    width: 6px;
    height: 6px;
    background-color: var(--wp-aisc-text-light);
    border-radius: 50%;
    opacity: 0.4;
    animation: wpAiscTyping 1.4s infinite both;
}

.wp-aisc-typing-dot:nth-child(2) { animation-delay: .2s; }
.wp-aisc-typing-dot:nth-child(3) { animation-delay: .4s; }

@keyframes wpAiscTyping {
    0%, 100% { transform: translateY(0); opacity: 0.4; }
    50% { transform: translateY(-4px); opacity: 1; }
}

/* Lead Lock overlay form screen */
.wp-aisc-lead-overlay {
    position: absolute;
    top: 56px; /* below header */
    left: 0;
    width: 100%;
    height: calc(100% - 56px);
    background-color: rgba(255, 255, 255, 0.95);
    z-index: 10;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    backdrop-filter: blur(4px);
    animation: wpAiscFadeIn 0.3s ease-out;
}

@keyframes wpAiscFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.wp-aisc-lead-card {
    width: 100%;
    text-align: center;
}

.wp-aisc-lead-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--wp-aisc-primary);
    margin-bottom: 8px;
}

.wp-aisc-lead-desc {
    font-size: 12px;
    color: var(--wp-aisc-text-light);
    margin-bottom: 20px;
    line-height: 1.4;
}

.wp-aisc-lead-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.wp-aisc-form-group {
    text-align: left;
}

.wp-aisc-form-group label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--wp-aisc-text-light);
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 4px;
}

.wp-aisc-form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--wp-aisc-border);
    border-radius: 8px;
    font-size: 13px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease;
}

.wp-aisc-form-input:focus {
    border-color: var(--wp-aisc-secondary);
}

.wp-aisc-btn-submit {
    background-color: var(--wp-aisc-primary);
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 8px;
}

.wp-aisc-btn-submit:hover {
    background-color: #1e293b;
}

.wp-aisc-lead-error {
    color: #ef4444;
    font-size: 11px;
    margin-top: 8px;
    display: none;
}

/* CPT Inquiry Call-to-Action widget block */
.wp-aisc-cpt-cta-block {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.wp-aisc-cpt-cta-text {
    font-size: 12px;
    color: #166534;
    margin-bottom: 8px;
    font-weight: 500;
}

.wp-aisc-cpt-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background-color: #22c55e;
    color: #ffffff !important;
    text-decoration: none !important;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.wp-aisc-cpt-cta-btn:hover {
    background-color: #16a34a;
    transform: translateY(-1px);
}

/* Mobile Responsive Adjustments */
@media (max-width: 480px) {
    .wp-aisc-container {
        right: 0;
        bottom: 0;
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0;
        border: none;
    }
    .wp-aisc-launcher {
        bottom: 16px;
        right: 16px;
    }
}

.wp-aisc-link {
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.wp-aisc-link:hover {
    opacity: 0.8;
}

