/* AssistantAI Widget Styles */
#upkyk-assistant-ai-container {
    position: fixed;
    bottom: 90px;
    z-index: 9999;
    font-family: var(--assistant-ai-font, 'Roboto, sans-serif');
    transition: all 0.3s ease;
}

#upkyk-assistant-ai-container.bottom-right {
    right: 20px;
}

#upkyk-assistant-ai-container.bottom-left {
    left: 20px;
}

/* Chat Window */
#upkyk-chatbox {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: var(--upkyk-window-width, 380px);
    height: var(--upkyk-window-height, 600px);
    max-width: calc(100% - 40px);
    max-height: 80vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    z-index: 999998;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
}

#upkyk-chatbox.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* WhatsApp and Escalation Styles */

/* WhatsApp button hover scale effect */
.upkyk-whatsapp-btn {
    transition: transform 0.2s ease !important;
}

.upkyk-whatsapp-btn:hover {
    transform: scale(1.1) !important;
}
.upkyk-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 999999; /* Ensure buttons are clickable */
}

/* WhatsApp header button styles */
#upkyk-header-whatsapp-btn {
    background-color: #25D366 !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: background-color 0.3s ease !important;
    margin-right: 10px !important;
    position: relative !important;
    z-index: 999999 !important;
}

#upkyk-header-whatsapp-btn:hover {
    background-color: #128C7E !important;
}

#upkyk-header-whatsapp-btn svg,
#upkyk-header-whatsapp-btn span {
    width: 18px !important;
    height: 18px !important;
    color: white !important;
    font-weight: bold !important;
}

.upkyk-success-message {
    background-color: #e7f7ed;
    border-left: 3px solid #28a745;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.upkyk-thank-you-message {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    color: #333;
    padding: 12px 15px;
    background-color: #f0f7ff;
    border-radius: 8px;
    border-left: 3px solid var(--upkyk-primary-color, #0084ff);
}

.upkyk-success-message p {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    color: #155724;
}

.upkyk-whatsapp-container {
    background-color: #f0f7ff;
    border-radius: 10px;
    padding: 15px;
    border-left: 3px solid var(--upkyk-primary-color, #0084ff);
    margin-top: 10px;
}

.upkyk-whatsapp-container p {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 12px;
    color: #333;
    font-weight: 500;
}

.upkyk-whatsapp-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.upkyk-whatsapp-button {
    color: #ffffff;
    background-color: #25D366;
    border: none;
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.upkyk-whatsapp-button:hover {
    background-color: #128C7E;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.upkyk-whatsapp-button svg {
    vertical-align: middle;
    margin-right: 8px;
}

.upkyk-email-button {
    color: #333;
    background-color: #f1f1f1;
    border: none;
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.upkyk-email-button:hover {
    background-color: #e0e0e0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.upkyk-email-response {
    background-color: #f8f9fa;
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 10px;
}

.upkyk-email-response p {
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    color: #333;
}

/* Media query for mobile devices */
@media screen and (max-width: 768px) {
    #upkyk-chatbox {
        width: var(--upkyk-mobile-width, 95%);
        height: var(--upkyk-mobile-height, 80vh);
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0.95);
        max-width: 100%;
        max-height: 100vh;
        border-radius: 16px;
    }
    
    #upkyk-chatbox.active {
        transform: translate(-50%, -50%) scale(1) !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
}

/* Chat Header */
#upkyk-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--upkyk-primary-color);
    color: white;
    min-height: 70px;
}

.upkyk-header-title {
    display: flex;
    align-items: center;
}

.upkyk-chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

.upkyk-chat-title {
    font-size: 18px;
    font-weight: 600;
}

.upkyk-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chat Messages Container */
#upkyk-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Message Bubbles */
.upkyk-message {
    border-radius: 22px;
    padding: 10px 15px;
    max-width: 80%;
    word-wrap: break-word;
    position: relative;
    line-height: 1.5;
}

.upkyk-message.bot {
    align-self: flex-start;
    background-color: var(--upkyk-primary-color);
    color: white;
}

/* Style links in bot messages as buttons */
.upkyk-message.bot a {
    display: inline-block;
    margin: 5px 0;
    padding: 6px 12px;
    background-color: var(--upkyk-link-bg-color, white);
    color: var(--upkyk-link-text-color, var(--upkyk-primary-color));
    border-radius: 15px;
    text-decoration: none;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.2s ease;
    word-break: break-all;
}

.upkyk-message.bot a:hover {
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.upkyk-message.user {
    align-self: flex-end;
    background-color: var(--upkyk-user-color);
    color: #212529;
}

/* Style links in user messages as buttons */
.upkyk-message.user a {
    display: inline-block;
    margin: 5px 0;
    padding: 6px 12px;
    background-color: var(--upkyk-link-bg-color, var(--upkyk-primary-color));
    color: var(--upkyk-link-text-color, white);
    border-radius: 15px;
    text-decoration: none;
    font-weight: 500;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    word-break: break-all;
}

.upkyk-message.user a:hover {
    background-color: var(--upkyk-link-bg-color, var(--upkyk-primary-color));
    opacity: 0.9;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Typing Animation */
.upkyk-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 15px;
    background: #e0e0e0;
    border-radius: 18px;
    max-width: 70px;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.upkyk-typing-dot {
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    animation: typing-animation 1.4s infinite;
}

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

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

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

/* Input Area */
#upkyk-chat-input-container {
    display: flex;
    padding: 10px;
    background: white;
    border-top: 1px solid #e9ecef;
}

/* Chat input field styles */
#upkyk-assistant-ai-container #upkyk-chat-input {
    all: unset;
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid #ced4da !important;
    border-radius: 25px !important;
    margin-right: 8px !important;
    font: 400 14px/1.5 var(--assistant-ai-font, 'Roboto', sans-serif) !important;
    color: #212529 !important;
    background: #fff !important;
}

#upkyk-chat-submit {
    background-color: var(--upkyk-primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

/* Ensure SVG is perfectly centered */
#upkyk-chat-submit svg {
    display: block;
    margin: auto;
    position: relative;
}

/* Quick Replies */
.upkyk-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.upkyk-quick-reply {
    background: white;
    border: 1px solid var(--upkyk-primary-color);
    color: var(--upkyk-primary-color);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upkyk-quick-reply:hover {
    background: var(--upkyk-primary-color);
    color: white;
}

/* Chat Toggle Button */
#upkyk-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #0084ff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    z-index: 99998;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
    overflow: visible; /* Allow icons to overflow */
}

/* Base styles for all icons regardless of type */
#upkyk-chat-toggle .chat-icon,
#upkyk-chat-toggle .close-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    transition: none; /* Remove all transitions */
    filter: brightness(0) invert(1); /* Ensure icons are white */
    z-index: 2;
    display: block;
}

/* Special styling for custom chat icon */
#upkyk-chat-toggle .custom-chat-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Basic styling for icon paths - no transitions */
#upkyk-chat-toggle svg path {
    transition: none;
    transform-origin: center;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

/* Simplified icon display - all types */
/* Chat icon shows when not active, close icon shows when active */

/* Default state - chat icon visible, close icon hidden */
#upkyk-chat-toggle .chat-icon {
    opacity: 1;
    visibility: visible;
}

#upkyk-chat-toggle .close-icon {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Active state - chat icon hidden, close icon visible */
#upkyk-chat-toggle.active .chat-icon {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#upkyk-chat-toggle.active .close-icon {
    opacity: 1;
    visibility: visible;
}

/* Hover effects for chat toggle button - not applied during animation */
#upkyk-chat-toggle:hover:not(.animating) {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
    transition: all 0.2s ease;
}

/* Subtle hover effect for standard icons only - not applied during animation */
#upkyk-chat-toggle:not(.custom-icon):hover:not(.animating) .chat-icon {
    filter: brightness(1.1) invert(1);
    transition: filter 0.2s ease;
}

/* Ensure custom icons keep their original colors on hover */
#upkyk-chat-toggle.custom-icon:hover .custom-chat-icon {
    filter: none;
}

/* Specific hover effect for custom icons - not applied during animation */
#upkyk-chat-toggle.custom-icon:hover:not(.animating) .custom-chat-icon {
    transform: translate(-50%, -50%) scale(1.1);
    transition: transform 0.2s ease;
}

/* Ensure custom icons don't have background images */
#upkyk-chat-toggle.custom-icon {
    background-image: none !important;
}

/* We're now handling icon visibility directly in JavaScript */

/* Container for custom icon and close icon */
#upkyk-chat-toggle .icon-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Icon animation styles - ONLY for standard icons (not custom icons) */
@keyframes rotateToClose {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(180deg); }
}

@keyframes rotateFromClose {
    0% { transform: rotate(180deg); }
    100% { transform: rotate(0deg); }
}

/* Animation classes for icon rotation - with different speeds for standard and custom icons */
#upkyk-chat-toggle .rotate-to-close {
    animation: rotateToClose ease forwards;
    transform-origin: center center;
    animation-duration: 0.25s; /* Default for custom icons */
}

#upkyk-chat-toggle .rotate-from-close {
    animation: rotateFromClose ease forwards;
    transform-origin: center center;
    animation-duration: 0.25s; /* Default for custom icons */
}

/* Faster animation for standard icons */
#upkyk-chat-toggle:not(.custom-icon) .rotate-to-close,
#upkyk-chat-toggle:not(.custom-icon) .rotate-from-close {
    animation-duration: 0.2s;
}

/* Ensure all icon containers have proper positioning for rotation */
#upkyk-chat-toggle .icon-container {
    transform-origin: center center;
}

/* All icons (img and svg) in the button need consistent positioning */
#upkyk-chat-toggle img,
#upkyk-chat-toggle svg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px; /* Default/medium size */
    height: 24px;
    transition: all 0.3s ease;
    filter: brightness(0) invert(1); /* Ensure icons are white */
}

/* Inner container for precise positioning */
#upkyk-chat-toggle .icon-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Custom icons need specific sizing based on button size */
#upkyk-chat-toggle img.chat-icon {
    /* Default size (medium) */
    width: 24px;
    height: 24px;
    transition: all 0.3s ease;
    z-index: 2;
}

/* Size-specific rules */
/* Small size */
#upkyk-chat-toggle.small img.chat-icon {
    width: 18px;
    height: 18px;
}

/* Medium size */
#upkyk-chat-toggle.medium img.chat-icon {
    width: 24px;
    height: 24px;
}

/* Large size */
#upkyk-chat-toggle.large img.chat-icon {
    width: 32px;
    height: 32px;
}

/* Custom icon - initial state (chat open) with improved rotation */
#upkyk-chat-toggle.custom-icon:not(.active) .chat-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    visibility: visible; /* Ensure it's visible */
    z-index: 2; /* Keep higher than close icon */
    transition: opacity 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), 
                transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                visibility 0s linear 0s !important; /* No delay for showing */
}

/* Custom icon - active state (close shown) with improved rotation */
#upkyk-chat-toggle.custom-icon.active .chat-icon {
    opacity: 0 !important;
    transform: translate(-50%, -50%) scale(0.5) rotate(90deg) !important;
    visibility: hidden !important; /* Ensure it's fully hidden */
    z-index: 1 !important; /* Keep lower than close icon */
    transition: opacity 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55), 
                transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                visibility 0s linear 0.4s !important; /* Delay hiding until fade completes */
}

/* Close icon positioning and animation with consistent rotation */
#upkyk-chat-toggle.custom-icon .close-icon {
    position: absolute;
    width: 24px;
    height: 24px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5) rotate(-90deg);
    visibility: hidden; /* Initially hidden */
    transition: opacity 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                visibility 0s linear 0.4s; /* Delay visibility change */
    z-index: 3; /* Higher z-index to make it appear on top */
}

/* Active state for custom close icon */
#upkyk-chat-toggle.custom-icon.active .close-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
    visibility: visible; /* Make fully visible */
    transition: opacity 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                visibility 0s linear 0s; /* No delay for showing */
}

/* Make sizing consistent with the button size */
#upkyk-chat-toggle.small .close-icon {
    width: 18px !important;
    height: 18px !important;
}

#upkyk-chat-toggle.medium .close-icon {
    width: 24px !important;
    height: 24px !important;
}

#upkyk-chat-toggle.large .close-icon {
    width: 32px !important;
    height: 32px !important;
}

#upkyk-chat-toggle.custom-icon.active .close-icon {
    opacity: 1 !important;
    transform: scale(1) rotate(0deg) !important;
    visibility: visible !important;
    z-index: 5 !important; /* Even higher z-index when active to ensure it's on top */
}

/* SVG icon styles for the toggle button */
#upkyk-chat-toggle svg, 
#upkyk-chat-toggle img:not([data-icon-type="custom"]) {
    width: 45px;
    height: 45px;
    position: relative;
    z-index: 2;
    filter: brightness(0) invert(1);
}

/* Ensure chat-icon class also gets the larger size - but not for custom icons */
#upkyk-chat-toggle .chat-icon:not([data-icon-type="custom"]) {
    width: 45px;
    height: 45px;
}

#upkyk-chat-toggle.bottom-right {
    right: 20px;
}

#upkyk-chat-toggle.bottom-left {
    left: 20px;
}

/* Modify hover effect to use filter or box-shadow instead of transform */
#upkyk-chat-toggle:hover {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);
}

#upkyk-chat-toggle:focus {
    outline: none;
}

/* Notification dot */
.upkyk-notification-dot {
    width: 13px;
    height: 13px;
    background-color: #ff3b30;
    border-radius: 50%;
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10001;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
    border: 2px solid white;
}

.upkyk-notification-dot.active {
    visibility: visible;
    opacity: 1;
}

/* Branding */
.upkyk-branding {
    text-align: center;
    padding: 5px;
    font-size: 11px;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
}

.upkyk-branding a {
    color: #6c757d;
    text-decoration: none;
}

.upkyk-branding a:hover {
    text-decoration: underline;
}

/* Button Shape Options */
#upkyk-chat-toggle.circle {
    border-radius: 50%;
}

#upkyk-chat-toggle.square {
    border-radius: 0;
}

#upkyk-chat-toggle.rounded {
    border-radius: 10px;
}

/* Button Size Options */
#upkyk-chat-toggle.small {
    width: 45px;
    height: 45px;
}

#upkyk-chat-toggle.small svg,
#upkyk-chat-toggle.small img,
#upkyk-chat-toggle.small .chat-icon {
    width: 25px;
    height: 25px;
    max-width: 25px;
    max-height: 25px;
    min-width: 25px;
    min-height: 25px;
}

/* Custom sizing for icons with data-icon-type="custom" */
#upkyk-chat-toggle.small img[data-icon-type="custom"] {
    width: 22px !important;
    height: 22px !important;
    max-width: 22px !important;
    max-height: 22px !important;
}

#upkyk-chat-toggle.medium {
    width: 50px;
    height: 50px;
}

#upkyk-chat-toggle.medium svg,
#upkyk-chat-toggle.medium img,
#upkyk-chat-toggle.medium .chat-icon {
    width: 31px;
    height: 31px;
    max-width: 31px;
    max-height: 31px;
    min-width: 31px;
    min-height: 31px;
}

/* Custom sizing for icons with data-icon-type="custom" */
#upkyk-chat-toggle.medium img[data-icon-type="custom"] {
    width: 26px !important;
    height: 26px !important;
    max-width: 26px !important;
    max-height: 26px !important;
}

#upkyk-chat-toggle.large {
    width: 59px;
    height: 59px;
}

#upkyk-chat-toggle.large svg,
#upkyk-chat-toggle.large img,
#upkyk-chat-toggle.large .chat-icon {
    width: 45px;
    height: 45px;
    max-width: 45px;
    max-height: 45px;
    min-width: 45px;
    min-height: 45px;
}

/* Custom sizing for icons with data-icon-type="custom" */
#upkyk-chat-toggle.large img[data-icon-type="custom"] {
    width: 34px !important;
    height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
}

/* Font Size Options */
.upkyk-message.small {
    font-size: 12px;
    line-height: 1.3;
}

.upkyk-message.medium {
    font-size: 14px;
    line-height: 1.5;
}

.upkyk-message.large {
    font-size: 16px;
    line-height: 1.7;
}

/* Message Padding Options */
.upkyk-message.compact {
    padding: 6px 10px;
}

.upkyk-message.normal {
    padding: 10px 15px;
}

.upkyk-message.spacious {
    padding: 14px 20px;
}

/* Font family setting */
#upkyk-assistant-ai-container {
    font-family: var(--assistant-ai-font, 'Roboto, sans-serif');
}

/* Add or update these CSS rules to support all the font families from your settings */

/* Base font family support using CSS variables */
#upkyk-assistant-ai-container {
    font-family: var(--assistant-ai-font, 'Roboto, sans-serif');
}

/* Specific font family rules for each option in your dropdown */
#upkyk-assistant-ai-container[data-font="Roboto, sans-serif"],
#upkyk-assistant-ai-container.font-arial {
    font-family: Roboto, sans-serif !important;
}

#upkyk-assistant-ai-container[data-font="Verdana, sans-serif"],
#upkyk-assistant-ai-container.font-verdana {
    font-family: Verdana, sans-serif !important;
}

#upkyk-assistant-ai-container[data-font="Helvetica, sans-serif"],
#upkyk-assistant-ai-container.font-helvetica {
    font-family: Helvetica, sans-serif !important;
}

#upkyk-assistant-ai-container[data-font="Tahoma, sans-serif"],
#upkyk-assistant-ai-container.font-tahoma {
    font-family: Tahoma, sans-serif !important;
}

#upkyk-assistant-ai-container[data-font="Trebuchet MS, sans-serif"],
#upkyk-assistant-ai-container.font-trebuchet {
    font-family: "Trebuchet MS", sans-serif !important;
}

#upkyk-assistant-ai-container[data-font="Times New Roman, serif"],
#upkyk-assistant-ai-container.font-times {
    font-family: "Times New Roman", serif !important;
}

#upkyk-assistant-ai-container[data-font="Georgia, serif"],
#upkyk-assistant-ai-container.font-georgia {
    font-family: Georgia, serif !important;
}

#upkyk-assistant-ai-container[data-font="Courier New, monospace"],
#upkyk-assistant-ai-container.font-courier {
    font-family: "Courier New", monospace !important;
}

#upkyk-assistant-ai-container[data-font="Segoe UI, sans-serif"],
#upkyk-assistant-ai-container.font-segoe {
    font-family: "Segoe UI", sans-serif !important;
}

#upkyk-assistant-ai-container[data-font="Roboto, sans-serif"],
#upkyk-assistant-ai-container.font-roboto {
    font-family: Roboto, sans-serif !important;
}

/* Make sure these CSS variables are used for the chat window */
:root {
    --upkyk-primary-color: #39CCCC;
    --upkyk-user-color: #e9ecef;
    --upkyk-font-size: 14px;
    --upkyk-message-padding: 10px 15px;
}

/* Chat toggle button */
.upkyk-assistant-ai-toggle {
    background-color: var(--upkyk-primary-color);
}

/* Chat window header */
.upkyk-assistant-ai-header {
    background-color: var(--upkyk-primary-color);
}

/* Bot messages */
.upkyk-assistant-ai-message.upkyk-bot {
    background-color: var(--upkyk-primary-color);
    color: white;
}

/* User messages */
.upkyk-assistant-ai-message.upkyk-user {
    background-color: var(--upkyk-user-color);
    color: #212529;
}

/* Send button */
.upkyk-assistant-ai-send {
    background-color: var(--upkyk-primary-color);
}

/* Update the typing indicator styles */
.upkyk-typing-indicator {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    background-color: #f1f1f1;
    border-radius: 18px;
    width: fit-content;
    max-width: 70%;
}

.upkyk-typing-indicator span {
    height: 8px;
    width: 8px;
    margin: 0 2px;
    background-color: #bbb;
    border-radius: 50%;
    display: inline-block;
    animation: upkyk-typing-animation 1.4s infinite ease-in-out both;
}

.upkyk-typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes upkyk-typing-animation {
    0%, 80%, 100% { transform: scale(0.7); }
    40% { transform: scale(1.2); }
}

/* Contact Form Styles - Fixed for proper display in chat */
.upkyk-inline-form-message {
    background-color: #fff;
    border-radius: 12px;
    padding: 18px;
    margin: 10px 0;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    border: 1px solid #e0e0e0;
    display: block !important;
}

/* Fix any potential nesting issues by targeting the form inside any container */
#upkyk-chat-messages .upkyk-inline-form-message,
.upkyk-message .upkyk-inline-form-message,
.upkyk-bot-message .upkyk-inline-form-message {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 15px 0 !important;
}

/* Ensure form fields are visible */
#upkyk-chat-messages .upkyk-form-field,
.upkyk-message .upkyk-form-field,
.upkyk-bot-message .upkyk-form-field {
    margin-bottom: 14px;
    display: block !important;
}

/* Additional styling for the updated form */
.upkyk-styled-form {
    transition: all 0.3s ease;
}

.upkyk-form-header {
    font-weight: 600;
    margin-bottom: 18px;
    color: #222;
    font-size: 18px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 10px;
}

.upkyk-contact-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.upkyk-form-field {
    margin-bottom: 14px;
}

.upkyk-form-field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #222;
    font-size: 14px;
}

.upkyk-form-field input,
.upkyk-form-field textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
    font-family: inherit;
    background-color: #fafafa;
    transition: all 0.2s ease;
}

/* Force visibility of form elements */
#upkyk-form-name, 
#upkyk-form-email, 
#upkyk-form-phone, 
#upkyk-form-submit {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Font size variations */
.upkyk-font-small .upkyk-form-header {
    font-size: 16px;
}

.upkyk-font-small .upkyk-form-field label {
    font-size: 12px;
}

.upkyk-font-small input,
.upkyk-font-small #upkyk-form-submit {
    font-size: 12px;
}

.upkyk-font-large .upkyk-form-header {
    font-size: 20px;
}

.upkyk-font-large .upkyk-form-field label {
    font-size: 16px;
}

.upkyk-font-large input,
.upkyk-font-large #upkyk-form-submit {
    font-size: 16px;
    padding: 12px;
}

/* Padding variations */
.upkyk-padding-compact .upkyk-form-field {
    margin-bottom: 8px;
}

.upkyk-padding-compact input {
    padding: 8px;
}

.upkyk-padding-spacious .upkyk-form-field {
    margin-bottom: 16px;
}

.upkyk-padding-spacious input {
    padding: 12px;
}

/* Responsive styles for mobile */
@media screen and (max-width: 480px) {
    .upkyk-inline-form-message {
        width: 100%;
        padding: 12px;
        margin: 8px 0;
    }
    
    .upkyk-form-field input,
    .upkyk-form-field textarea {
        padding: 8px;
        font-size: 14px;
    }
    
    #upkyk-form-submit {
        padding: 10px 12px;
        font-size: 14px;
    }
}

.upkyk-form-field input:focus,
.upkyk-form-field textarea:focus {
    border-color: var(--upkyk-primary-color, #0084ff);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 132, 255, 0.2);
    background-color: #fff;
}

.upkyk-form-field textarea {
    min-height: 80px;
    resize: vertical;
}

.upkyk-form-submit {
    margin-top: 10px;
}

#upkyk-form-submit {
    background-color: var(--upkyk-primary-color, #0084ff);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 15px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#upkyk-form-submit:hover {
    background-color: var(--upkyk-hover-color, #0074e0);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#upkyk-form-submit:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.upkyk-form-success {
    color: #28a745;
    padding: 15px;
    text-align: center;
    font-weight: 500;
    background-color: rgba(40, 167, 69, 0.1);
    border-radius: 6px;
}

/* Active Hours Styling */
.upkyk-outside-hours #upkyk-chat-input-container {
    background-color: #f5f5f5 !important;
    border-top: 1px solid #ddd !important;
}

#upkyk-chat-input.upkyk-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #f0f0f0;
    border-color: #ccc;
}

#upkyk-chat-submit.upkyk-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #888;
}

/* Enhanced Outside Active Hours Styling */
.upkyk-outside-hours {
    position: relative;
}

.upkyk-outside-hours:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background-color: #ffc107;
    z-index: 1;
}

.upkyk-outside-hours #upkyk-chat-messages {
    background-color: #fcfcfc;
}

/* Merged styles for outside hours message - fixed duplicate */
.upkyk-outside-hours-message {
    background-color: #fff8dc !important;
    border-left: 4px solid #ffc107;
    color: #856404 !important;
    font-weight: 500;
    padding: 10px 15px !important;
    margin: 10px 0;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-size: 14px;
    line-height: 1.5;
    max-width: 90%;
    align-self: center;
    text-align: center;
}

/* Animated clock icon for outside hours message */
.upkyk-outside-hours-message:before {
    content: "⏱️";
    margin-right: 8px;
    animation: pulse 2s infinite;
    display: inline-block;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Outside hours styling for the chat footer */
.upkyk-outside-hours .upkyk-chat-footer {
    background-color: #f5f5f5;
    border-top: 1px solid #e0e0e0;
}

.upkyk-outside-hours-message {
    background-color: #fffde7 !important;
    border-left: 4px solid #ffc107 !important;
    color: #795548 !important;
    font-weight: 500;
    padding: 15px 20px !important;
    margin: 10px 0 !important;
}

/* Privacy consent banner */
#upkyk-privacy-consent {
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 15px;
    z-index: 10;
    text-align: center;
    font-size: 14px;
    border-radius: 0 0 20px 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

#upkyk-privacy-consent .upkyk-privacy-message a {
    color: #ffffff;
    text-decoration: underline;
    font-weight: bold;
}

#upkyk-privacy-consent .upkyk-privacy-message a:hover {
    color: #f0f0f0;
    text-decoration: none;
}

#upkyk-privacy-consent.visible {
    transform: translateY(0); /* Show when visible class is added */
}

#upkyk-privacy-accept {
    background-color: var(--upkyk-primary-color, #0082C8);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 8px;
    font-weight: bold;
}

#upkyk-privacy-accept:hover {
    opacity: 0.9;
}

@media screen and (max-width: 480px) {
    #upkyk-privacy-consent {
        padding: 10px;
        font-size: 12px;
    }
    
    #upkyk-privacy-accept {
        padding: 6px 12px;
    }
}

/* Popup Chat Bubble Styles */
.upkyk-popup-bubble {
    position: fixed;
    z-index: 9999999; /* Increased z-index to ensure it's above the chat window */
    background-color: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    max-width: 280px;
    opacity: 0;
    transform: scale(0.9) translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-family: var(--assistant-ai-font, 'Roboto, sans-serif');
    cursor: pointer; /* Add pointer cursor on hover */
}

.upkyk-popup-bubble.visible {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Triangle removed as requested for cleaner look */
.upkyk-popup-bubble:after {
    display: none;
}

/* Position the arrow based on chat button position */
.upkyk-popup-bubble[style*="bottom"][style*="right"]:after {
    bottom: -7px;
    right: 20px; /* Align with the button */
}

.upkyk-popup-bubble[style*="bottom"][style*="left"]:after {
    bottom: -7px;
    left: 20px; /* Align with the button */
}

.upkyk-popup-bubble[style*="top"][style*="right"]:after {
    top: -7px;
    right: 20px; /* Align with the button */
}

.upkyk-popup-bubble[style*="top"][style*="left"]:after {
    top: -7px;
    left: 20px; /* Align with the button */
}

.upkyk-popup-close {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #999;
    padding: 2px 6px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.upkyk-popup-close:hover {
    background-color: #f0f0f0;
    color: #333;
}

.upkyk-popup-text {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    padding-right: 20px;
}

/* Add a class to specifically hide on mobile devices */
html.upkyk-disable-on-mobile #upkyk-assistant-ai-container,
html.upkyk-disable-on-mobile #upkyk-chat-toggle,
html.upkyk-disable-on-mobile #upkyk-chatbox,
html.upkyk-disable-on-mobile .upkyk-popup-bubble {
    display: none !important;
}

@media screen and (max-width: 768px) {
    body.upkyk-disable-on-mobile #upkyk-assistant-ai-container,
    body.upkyk-disable-on-mobile #upkyk-chat-toggle,
    body.upkyk-disable-on-mobile #upkyk-chatbox,
    body.upkyk-disable-on-mobile .upkyk-popup-bubble {
        display: none !important;
    }
}

/* SVG Icon specific styles */
#upkyk-assistant-ai-container svg path,
#upkyk-chat-toggle svg path {
    fill: currentColor; /* Ensures SVG paths take the current text color */
}

/* For custom uploaded icons */
#upkyk-chat-toggle.custom-icon {
    background-repeat: no-repeat !important;
    background-position: center center !important;
    background-size: 45px !important;
}

#upkyk-chat-toggle.custom-icon.small {
    background-size: 35px !important;
}

#upkyk-chat-toggle.custom-icon.large {
    background-size: 55px !important;
}

/* Icon color style for invert/non-invert */
#upkyk-chat-toggle img.invert {
    filter: brightness(0) invert(1);
}

#upkyk-chat-toggle img.no-invert {
    filter: none;
}

/* Mobile adjustments with bigger icons for touch */
@media screen and (max-width: 768px) {
    #upkyk-chat-toggle {
        width: 55px;
        height: 55px;
    }
    
    #upkyk-chat-toggle svg,
    #upkyk-chat-toggle img {
        width: 40px;
        height: 40px;
    }
    
    #upkyk-chat-toggle.custom-icon {
        background-size: 40px !important;
    }
    
    .upkyk-notification-dot {
        width: 15px;
        height: 15px;
        top: 0;
        right: 0;
        border: 1px solid white;
    }
}

/* Disable hover animations during transition */
/* Properly handle animations when clicking the button */
#upkyk-chat-toggle.animating:hover {
    /* Only disable hover effects, not the rotation transforms */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important; /* Keep box-shadow the same during transition */
}

/* IMPORTANT: These styles ensure the icon rotation still works properly */
#upkyk-chat-toggle.animating .chat-icon,
#upkyk-chat-toggle.animating .close-icon {
    /* Keep consistent with our other transition styles */
    transition: opacity 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                visibility 0s linear 0.4s !important;
    will-change: transform, opacity; /* Performance optimization */
}
