/* Ploko Chatbot Widget Styles */

/* Chat Widget Container */
#chat-widget-container {
    position: fixed !important;
    bottom: 100px !important;
    right: 20px !important;
    width: 480px !important;
    height: 600px !important;
    max-width: 480px !important;
    max-height: 600px !important;
    background: linear-gradient(to bottom, whitesmoke 0%, whitesmoke calc(100% - 3px), #ffffff calc(100% - 3px), #ffffff 100%) !important;
    display: none;
    z-index: 999999 !important;
    overflow: hidden !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    box-sizing: border-box !important;
    border-bottom: 3px solid #ffffff !important;
    border-bottom-color: #ffffff !important;
    border-bottom-style: solid !important;
    border-bottom-width: 3px !important;
    /* Prevent position changes when iframe is added */
    transform: none !important;
    will-change: auto !important;
    /* Force fixed positioning to prevent jumping */
    top: auto !important;
    margin: 0 !important;
}

/* Ensure body remains scrollable when chat widget has iframe */
/* DO NOT change body position - it affects fixed elements! */
body:has(#chat-widget-container:has(.has-iframe)),
body:has(.ploko-embedded-chat-widget .has-iframe) {
    overflow: auto !important;
    overflow-x: hidden !important;
    /* position: relative removed - it causes fixed elements to jump */
    overflow-y: auto !important;
}

html:has(#chat-widget-container:has(.has-iframe)),
html:has(.ploko-embedded-chat-widget .has-iframe) {
    overflow: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

/* Left position variant */
#chat-widget-container.position-left {
    right: auto !important;
    left: 20px !important;
    bottom: 100px !important;
    width: 480px !important;
    height: 600px !important;
    background: linear-gradient(to bottom, whitesmoke 0%, whitesmoke calc(100% - 3px), #ffffff calc(100% - 3px), #ffffff 100%) !important;
    border-bottom: 3px solid #ffffff !important;
}

/* Chat Widget Top Bar */
#chat-widget-topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--ploko-primary-color, #854fff);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    height: 48px;
    box-sizing: border-box;
    border-radius: 12px 12px 0 0;
    z-index: 10;
}

#chat-widget-topbar button,
#chat-widget-topbar #chat-widget-menu button {
    color: white;
}

#chat-widget-close {
    background: rgba(255, 255, 255, 0.2) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

#chat-widget-close:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
}

#chat-widget-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

#chat-widget-back {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    color: white;
    border-radius: 4px;
    transition: background-color 0.2s;
}

#chat-widget-back:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

#chat-widget-menu-dots {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    color: white;
    border-radius: 4px;
    transition: background-color 0.2s;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

#chat-widget-menu-dots:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

#chat-widget-menu-dots:active {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Menu dropdown */
#chat-widget-menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1002;
    min-width: 200px;
    display: none;
    overflow: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    margin-top: 5px;
}

#chat-widget-menu-dropdown.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#chat-widget-menu-dropdown .menu-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
    font-size: 14px;
    color: #333;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

#chat-widget-menu-dropdown .menu-item:last-child {
    border-bottom: none;
}

#chat-widget-menu-dropdown .menu-item:hover {
    background-color: #f5f5f5;
}

#chat-widget-menu-dropdown .menu-item:active {
    background-color: #e0e0e0;
}

#chat-widget-menu {
    position: relative;
    z-index: 1000000;
}

#chat-widget-close {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    color: #333;
    border-radius: 6px;
    transition: all 0.2s;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#chat-widget-close:hover {
    background-color: #fff;
    color: #000;
    border-color: #999;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}


/* Welkom message bubble - shown at top of chat body */
.welkom-message {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.4;
}

.welkom-container {
    margin-bottom: 20px;
}

/* Chat Widget Body */
#chat-widget-body {
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 80px;
    padding: 20px;
    overflow-y: auto;
    background: transparent;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    /* Ensure body remains scrollable when iframe is present */
    overflow-x: hidden !important;
    max-height: calc(600px - 128px) !important;
}

/* Custom scrollbar styling */
#chat-widget-body::-webkit-scrollbar {
    width: 6px;
}

#chat-widget-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#chat-widget-body::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

#chat-widget-body::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Message container */
.message-container {
    display: flex;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 8px;
}

.message-container.user {
    flex-direction: row-reverse;
}

/* Message icon */
.message-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    font-weight: bold;
}

.message-icon.bot {
    background: #333;
    color: white;
    font-size: 18px;
}

.message-icon.user {
    background: #f0f0f0;
    color: #666;
    font-size: 18px;
}

/* Message bubble */
.message-bubble {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.message-bubble.bot {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 18px 18px 18px 4px;
}

.message-bubble.user {
    background: var(--ploko-primary-color, #854fff);
    color: white;
    border-radius: 18px 18px 4px 18px;
}

/* Welcome message */
.welcome-message {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 18px 18px 18px 4px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.4;
}

/* Chat Widget Footer */
#chat-widget-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px 20px 20px;
    border-top: 1px solid #e0e0e0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-sizing: border-box;
    z-index: 20;
    border-radius: 0 0 12px 12px;
    height: 80px;
}

/* Input container */
#chat-widget-input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f8f9fa;
    border-radius: 24px;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    margin-bottom: 10px;
}

/* Branding */
#chat-widget-branding {
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-size: 8px;
    color: #999;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 3px;
    line-height: 1.1;
    z-index: 1;
    pointer-events: none;
}

#chat-widget-branding a {
    color: var(--ploko-primary-color, #854fff);
    text-decoration: none;
}

#chat-widget-branding a:hover {
    text-decoration: underline;
}

/* Template Form Styles */
.template-form-container {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.template-form-header {
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
}

.template-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.template-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.template-field label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.template-field input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s;
}

.template-field input:focus {
    outline: none;
    border-color: var(--ploko-primary-color, #854fff);
    box-shadow: 0 0 0 2px rgba(133, 79, 255, 0.1);
}

.template-field input.error {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.1);
}

.template-form button[type="submit"] {
    background: var(--ploko-primary-color, #854fff);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 10px;
}

.template-form button[type="submit"]:hover {
    background: var(--ploko-primary-color-dark, #6b3fd4);
}

.template-form button[type="submit"]:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Action Template Styles */
.action-template-container {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.action-template-title {
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
    text-align: center;
}

.action-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

/* Complete CSS Reset for Action Buttons - Override ALL theme styles */
.action-button,
.action-button:before,
.action-button:after,
.action-button *,
.action-button *:before,
.action-button *:after {
    all: unset !important;
    box-sizing: border-box !important;
    display: inline-block !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: normal !important;
    cursor: pointer !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    border: none !important;
    outline: none !important;
    margin: 0 !important;
    padding: 10px 16px !important;
    background: white !important;
    color: var(--ploko-primary-color, #854fff) !important;
    border: 2px solid var(--ploko-primary-color, #854fff) !important;
    border-radius: 8px !important;
    min-width: 140px !important;
    max-width: 180px !important;
    flex: 1 !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
    position: relative !important;
    z-index: 1 !important;
}

.action-button:hover,
.action-button:hover:before,
.action-button:hover:after,
.action-button:hover *,
.action-button:hover *:before,
.action-button:hover *:after {
    all: unset !important;
    box-sizing: border-box !important;
    display: inline-block !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: normal !important;
    cursor: pointer !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    border: none !important;
    outline: none !important;
    margin: 0 !important;
    padding: 10px 16px !important;
    background: var(--ploko-primary-color, #854fff) !important;
    color: white !important;
    border: 2px solid var(--ploko-primary-color, #854fff) !important;
    border-radius: 8px !important;
    min-width: 140px !important;
    max-width: 180px !important;
    flex: 1 !important;
    transition: all 0.2s ease !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(133, 79, 255, 0.3) !important;
    position: relative !important;
    z-index: 1 !important;
}

.action-button:focus,
.action-button:focus:before,
.action-button:focus:after,
.action-button:focus *,
.action-button:focus *:before,
.action-button:focus *:after {
    all: unset !important;
    box-sizing: border-box !important;
    display: inline-block !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: normal !important;
    cursor: pointer !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    border: none !important;
    outline: none !important;
    margin: 0 !important;
    padding: 10px 16px !important;
    background: white !important;
    color: var(--ploko-primary-color, #854fff) !important;
    border: 2px solid var(--ploko-primary-color, #854fff) !important;
    border-radius: 8px !important;
    min-width: 140px !important;
    max-width: 180px !important;
    flex: 1 !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 0 0 3px rgba(133, 79, 255, 0.1) !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Info Page Styles */
.info-page-container {
    padding: 20px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.info-page-title h2 {
    margin: 0 0 20px 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.info-page-image {
    margin: 20px 0;
}

.info-page-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.info-page-text {
    margin: 20px 0;
    text-align: left;
}

.info-page-text p {
    margin: 0 0 10px 0;
    font-size: 16px;
    line-height: 1.6;
    color: #555;
}

.info-page-text p:last-child {
    margin-bottom: 0;
}

.info-page-text strong,
.info-page-text b {
    font-weight: 600;
    color: #333;
}

.info-page-text em,
.info-page-text i {
    font-style: italic;
}

.info-page-text ul,
.info-page-text ol {
    margin: 10px 0;
    padding-left: 25px;
}

.info-page-text ul li,
.info-page-text ol li {
    margin: 5px 0;
    font-size: 16px;
    line-height: 1.6;
    color: #555;
}

.info-page-text a {
    color: var(--ploko-primary-color, #854fff);
    text-decoration: none;
}

.info-page-text a:hover {
    text-decoration: underline;
}

.info-page-text h1,
.info-page-text h2,
.info-page-text h3,
.info-page-text h4,
.info-page-text h5,
.info-page-text h6 {
    margin: 15px 0 10px 0;
    color: #333;
    font-weight: 600;
}

.info-page-text h1 { font-size: 24px; }
.info-page-text h2 { font-size: 22px; }
.info-page-text h3 { font-size: 20px; }
.info-page-text h4 { font-size: 18px; }
.info-page-text h5 { font-size: 16px; }
.info-page-text h6 { font-size: 14px; }

.action-button:active,
.action-button:active:before,
.action-button:active:after,
.action-button:active *,
.action-button:active *:before,
.action-button:active *:after {
    all: unset !important;
    box-sizing: border-box !important;
    display: inline-block !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: normal !important;
    cursor: pointer !important;
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    border: none !important;
    outline: none !important;
    margin: 0 !important;
    padding: 10px 16px !important;
    background: white !important;
    color: var(--ploko-primary-color, #854fff) !important;
    border: 2px solid var(--ploko-primary-color, #854fff) !important;
    border-radius: 8px !important;
    min-width: 140px !important;
    max-width: 180px !important;
    flex: 1 !important;
    transition: all 0.2s ease !important;
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px rgba(133, 79, 255, 0.3) !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Mobile responsive for action buttons */
@media (max-width: 768px) {
    .action-buttons-container {
        flex-direction: column;
        gap: 8px;
    }
    
    .action-button,
    .action-button:before,
    .action-button:after,
    .action-button *,
    .action-button *:before,
    .action-button *:after {
        all: unset !important;
        box-sizing: border-box !important;
        display: inline-block !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        line-height: 1.4 !important;
        text-decoration: none !important;
        text-transform: none !important;
        letter-spacing: normal !important;
        word-spacing: normal !important;
        text-align: center !important;
        vertical-align: middle !important;
        white-space: nowrap !important;
        cursor: pointer !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        border: none !important;
        outline: none !important;
        margin: 0 !important;
        padding: 10px 16px !important;
        background: white !important;
        color: var(--ploko-primary-color, #854fff) !important;
        border: 2px solid var(--ploko-primary-color, #854fff) !important;
        border-radius: 8px !important;
        min-width: 140px !important;
        max-width: none !important;
        width: 100% !important;
        flex: 1 !important;
        transition: all 0.2s ease !important;
        box-shadow: none !important;
        position: relative !important;
        z-index: 1 !important;
    }
    
    .action-button:hover,
    .action-button:hover:before,
    .action-button:hover:after,
    .action-button:hover *,
    .action-button:hover *:before,
    .action-button:hover *:after {
        all: unset !important;
        box-sizing: border-box !important;
        display: inline-block !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        line-height: 1.4 !important;
        text-decoration: none !important;
        text-transform: none !important;
        letter-spacing: normal !important;
        word-spacing: normal !important;
        text-align: center !important;
        vertical-align: middle !important;
        white-space: nowrap !important;
        cursor: pointer !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        border: none !important;
        outline: none !important;
        margin: 0 !important;
        padding: 10px 16px !important;
        background: var(--ploko-primary-color, #854fff) !important;
        color: white !important;
        border: 2px solid var(--ploko-primary-color, #854fff) !important;
        border-radius: 8px !important;
        min-width: 140px !important;
        max-width: none !important;
        width: 100% !important;
        flex: 1 !important;
        transition: all 0.2s ease !important;
        transform: translateY(-2px) !important;
        box-shadow: 0 4px 8px rgba(133, 79, 255, 0.3) !important;
        position: relative !important;
        z-index: 1 !important;
    }
    
    .action-button:active,
    .action-button:active:before,
    .action-button:active:after,
    .action-button:active *,
    .action-button:active *:before,
    .action-button:active *:after {
        all: unset !important;
        box-sizing: border-box !important;
        display: inline-block !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        line-height: 1.4 !important;
        text-decoration: none !important;
        text-transform: none !important;
        letter-spacing: normal !important;
        word-spacing: normal !important;
        text-align: center !important;
        vertical-align: middle !important;
        white-space: nowrap !important;
        cursor: pointer !important;
        user-select: none !important;
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        border: none !important;
        outline: none !important;
        margin: 0 !important;
        padding: 10px 16px !important;
        background: white !important;
        color: var(--ploko-primary-color, #854fff) !important;
        border: 2px solid var(--ploko-primary-color, #854fff) !important;
        border-radius: 8px !important;
        min-width: 140px !important;
        max-width: none !important;
        width: 100% !important;
        flex: 1 !important;
        transition: all 0.2s ease !important;
        transform: translateY(0) !important;
        box-shadow: 0 2px 4px rgba(133, 79, 255, 0.3) !important;
        position: relative !important;
        z-index: 1 !important;
    }
}

#chat-widget-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 8px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 20px;
    max-height: 100px;
    line-height: 1.4;
    box-sizing: border-box;
}

/* Prevent zoom on mobile by using 16px font-size */
@media screen and (max-width: 768px) {
    #chat-widget-input {
        font-size: 16px !important;
    }
}

#chat-widget-input:focus {
    outline: none;
}

#chat-widget-send {
    background: var(--ploko-primary-color, #854fff);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
    box-sizing: border-box;
}

#chat-widget-send:hover {
    background: var(--ploko-primary-color-dark, #6b3fd4);
    transform: translateY(-1px);
}

#chat-widget-send:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Chat Widget Button */
#chat-widget-button {
    position: fixed;
    bottom: 50px;
    right: min(50px, calc(100vw - 110px));
    background: white;
    color: var(--ploko-primary-color, #854fff);
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    overflow: hidden;
    padding: 0;
    animation: pulse 2s infinite;
}

/* Toggle button fallback icon */
#chat-widget-button .fallback-icon {
    font-size: 24px;
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    color: var(--ploko-primary-color, #854fff);
}

#chat-widget-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.3);
    background: var(--ploko-primary-color, #854fff);
    color: white;
    border: none;
    animation: none;
}

#chat-widget-button:hover .fallback-icon {
    color: white;
}

/* Left position variant for button */
#chat-widget-button.position-left {
    right: auto;
    left: min(50px, calc(100vw - 110px));
}

/* Loading animation */
.chat-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px;
    background: #e9ecef;
    border-radius: 8px;
    margin: 10px 0;
    color: #666;
    font-size: 14px;
}

.typing-dots {
    display: flex;
    gap: 3px;
    margin-left: 8px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Pulse animation for toggle button */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 12px rgba(133, 79, 255, 0.3);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    #chat-widget-container {
        width: calc(100vw - 10px) !important;
        max-width: none !important;
        top: 5px !important;
        right: 5px !important;
        bottom: 5px !important;
        left: auto !important;
        position: fixed !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        height: calc(100vh - 10px) !important;
        max-height: calc(100vh - 10px) !important;
        border-bottom: 2px solid white !important;
        background: linear-gradient(to bottom, whitesmoke 0%, whitesmoke calc(100% - 3px), #ffffff calc(100% - 3px), #ffffff 100%) !important;
    }
    
    #chat-widget-container.position-left {
        right: auto !important;
        left: 5px !important;
        top: 5px !important;
        bottom: 5px !important;
        height: calc(100vh - 10px) !important;
        max-height: calc(100vh - 10px) !important;
        border-bottom: 2px solid white !important;
    }
    
    #chat-widget-body {
        position: absolute;
        top: 48px;
        left: 0;
        right: 0;
        bottom: 80px;
        padding: 20px;
        overflow-y: auto;
    }
    
    #chat-widget-button {
        bottom: 3px;
        right: 3px;
    }
    
    #chat-widget-button.position-left {
        right: auto;
        left: 3px;
    }
}

@media (max-width: 480px) and (max-height: 1024px) {
    #chat-widget-container {
        width: calc(100vw - 10px) !important;
        height: calc(100vh - 10px) !important;
        top: 5px !important;
        bottom: 5px !important;
        right: 5px !important;
        left: 5px !important;
        border-radius: 12px !important;
        position: fixed !important;
        box-sizing: border-box !important;
        max-width: none !important;
        max-height: calc(100vh - 10px) !important;
        transform: none !important;
        overflow: hidden !important;
        background: linear-gradient(to bottom, #f5f5f5 0%, #f5f5f5 calc(100% - 3px), #ffffff calc(100% - 3px), #ffffff 100%) !important;
        border-bottom: 3px solid #ffffff !important;
    }
    
    #chat-widget-footer {
        bottom: 50px !important;
    }
    
    #chat-widget-header {
        padding: 15px;
        font-size: 16px;
    }
    
    #chat-widget-body {
        padding: 15px;
    }
    
    #chat-widget-footer {
        padding: 15px 15px 15px 15px;
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 20;
        flex-shrink: 0;
        gap: 10px;
    }
    
    /* Send button - clean minimal styling */
    #chat-widget-send {
        font-size: 16px;
    }
}

/* MOBILE FIXES - ONLY FOR MOBILE DEVICES */
@media (max-width: 768px) and (max-height: 1024px) {
    #chat-widget-container {
        width: calc(100vw - 10px) !important;
        max-width: none !important;
        top: 5px !important;
        right: 5px !important;
        bottom: 5px !important;
        left: auto !important;
        position: fixed !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        height: calc(100vh - 10px) !important;
        max-height: calc(100vh - 10px) !important;
        border-bottom: 3px solid #ffffff !important;
        background: linear-gradient(to bottom, #f5f5f5 0%, #f5f5f5 calc(100% - 3px), #ffffff calc(100% - 3px), #ffffff 100%) !important;
        transform: none !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    #chat-widget-container.position-left {
        right: auto !important;
        left: 5px !important;
        top: 5px !important;
        bottom: 5px !important;
        height: calc(100vh - 10px) !important;
        max-height: calc(100vh - 10px) !important;
        border-bottom: 3px solid #ffffff !important;
        background: linear-gradient(to bottom, #f5f5f5 0%, #f5f5f5 calc(100% - 3px), #ffffff calc(100% - 3px), #ffffff 100%) !important;
    }
    
    /* Footer positioning removed - using unified mobile rules below */
}


/* FINAL FIXES - ONLY CRITICAL OVERRIDES */
/* Removed conflicting container rules - using base styles instead */

#chat-widget-branding {
    font-size: 8px !important;
    font-weight: normal !important;
    max-width: 200px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    z-index: 100 !important;
}

#chat-widget-branding a {
    font-size: 8px !important;
    font-weight: normal !important;
    color: inherit !important;
}

#chat-widget-menu-button {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#chat-widget-menu-dropdown .menu-item {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#chat-widget-back {
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    outline: none !important;
}

#chat-widget-menu-dots {
    border: none !important;
    background: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Footer positioning - consistent rules */
/* Desktop: footer at bottom */
/* Mobile: footer 100px from bottom (for branding space) */
@media (min-width: 769px) {
    #chat-widget-footer {
        bottom: 0 !important;
    }
}

@media (max-width: 768px) {
    #chat-widget-footer {
        bottom: 100px !important;
        z-index: 10 !important;
    }
    
    #chat-widget-body {
        bottom: 150px !important;
        padding-bottom: 20px !important;
        max-height: calc(100vh - 200px) !important;
        overflow-y: auto !important;
        scroll-behavior: smooth !important;
    }
    
    #chat-widget-branding {
        position: absolute !important;
        bottom: 2px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        text-align: center !important;
        font-size: 8px !important;
        font-weight: normal !important;
        color: #000000 !important;
        padding: 2px 6px !important;
        background: rgba(255, 255, 255, 0.95) !important;
        border-radius: 3px !important;
        line-height: 1.1 !important;
        z-index: 100 !important;
        pointer-events: none !important;
        max-width: 200px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    /* Wit blok aan onderzijde */
    #chat-widget-container::before {
        content: '' !important;
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: 150px !important;
        background: #ffffff !important;
        z-index: 1 !important;
    }
}

#chat-widget-input-container {
    display: flex !important;
    align-items: flex-end !important;
    gap: 8px !important;
    background: #f8f9fa !important;
    border-radius: 24px !important;
    padding: 2px 12px !important;
    border: 1px solid #e0e0e0 !important;
    margin-bottom: 20px !important;
}

/* ============================================
   EMBEDDED CHAT WIDGET STYLES
   ============================================ */

/* Hide floating widget elements when embedded widget is present */
body:has(.ploko-embedded-chat-widget) #chat-widget-button,
body:has(.ploko-embedded-chat-widget) #chat-widget-container {
    display: none !important;
}

.ploko-embedded-chat-widget {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.embedded-chat-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 600px;
    max-height: 80vh;
}

.embedded-chat-header {
    background: var(--ploko-primary-color, #854fff);
    color: white !important;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.embedded-chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white !important;
}

.embedded-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.embedded-chat-footer {
    background: white;
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
}

.embedded-chat-input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f8f9fa;
    border-radius: 24px;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
}

.embedded-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.4;
    max-height: 120px;
    padding: 6px 8px;
}

/* Prevent zoom on mobile by using 16px font-size */
@media screen and (max-width: 768px) {
    .embedded-chat-input {
        font-size: 16px !important;
    }
}

.embedded-chat-send {
    background: var(--ploko-primary-color, #854fff);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.embedded-chat-send:hover {
    background: var(--ploko-primary-color-dark, #6b3fd4);
    transform: translateY(-1px);
}

.embedded-chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Embedded chat uses same message styles as floating widget */
.ploko-embedded-chat-widget .message-container {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    animation: fadeIn 0.3s ease-in;
}

.ploko-embedded-chat-widget .message-container.user {
    flex-direction: row-reverse;
}

.ploko-embedded-chat-widget .message-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: white;
    border: 1px solid #e0e0e0;
}

.ploko-embedded-chat-widget .message-icon.bot {
    background: var(--ploko-primary-color, #854fff);
    color: white;
    border: none;
}

.ploko-embedded-chat-widget .message-bubble {
    background: white;
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 70%;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ploko-embedded-chat-widget .message-bubble.user {
    background: var(--ploko-primary-color, #854fff);
    color: white;
}

.ploko-embedded-chat-widget .message-bubble.bot {
    background: white;
    color: #333;
}

/* Message bubbles with iframes */
.message-bubble.has-iframe {
    max-width: 100% !important;
    width: 100%;
    padding: 0 !important;
    overflow: hidden !important;
    -ms-overflow-style: none;
    scrollbar-width: none;
    /* Prevent layout shifts */
    contain: layout style paint;
}

/* Prevent chat widget container position changes when iframe is added */
/* CRITICAL: Always use 'fixed' to keep it relative to viewport (browser), not body */
#chat-widget-container:has(.has-iframe),
#chat-widget-container.has-iframe {
    position: fixed !important;
    transform: none !important;
    will-change: auto !important;
    /* Preserve original bottom and right values - these are viewport-relative */
    /* Don't override with hardcoded values, let JavaScript maintain the original values */
    top: auto !important;
    margin: 0 !important;
    /* left will be set by JavaScript to preserve original value */
}

#chat-widget-container.position-left:has(.has-iframe),
#chat-widget-container.position-left.has-iframe {
    right: auto !important;
    left: 20px !important;
    bottom: 100px !important;
    top: auto !important;
    margin: 0 !important;
}

.message-bubble.has-iframe::-webkit-scrollbar {
    display: none;
}

.message-bubble.has-iframe iframe {
    width: 100% !important;
    max-width: 100%;
    height: 1200px; /* Fallback, will be overridden by JavaScript */
    min-height: 800px; /* Fallback, will be overridden by JavaScript */
    border: none;
    display: block;
    border-radius: 12px;
    overflow: hidden;
    zoom: 1 !important;
    transform: scale(1) !important;
}

/* Prevent page zoom when iframe loads */
body:has(.message-bubble.has-iframe iframe) {
    zoom: 1 !important;
    transform: scale(1) !important;
}

/* Embedded chat - message bubbles with iframes */
.ploko-embedded-chat-widget .message-bubble.has-iframe {
    max-width: 100% !important;
    width: 100%;
    padding: 0 !important;
    overflow: hidden;
}

.ploko-embedded-chat-widget .message-bubble.has-iframe iframe {
    width: 100% !important;
    max-width: 100%;
    height: 1200px; /* Fallback, will be overridden by JavaScript */
    min-height: 800px; /* Fallback, will be overridden by JavaScript */
    border: none;
    display: block;
    border-radius: 12px;
    overflow: hidden;
    zoom: 1 !important;
    transform: scale(1) !important;
}

/* Prevent page zoom when embedded iframe loads */
body:has(.ploko-embedded-chat-widget .message-bubble.has-iframe iframe) {
    zoom: 1 !important;
    transform: scale(1) !important;
}

/* Hide scrollbar for embedded iframe wrapper */
.ploko-embedded-chat-widget .message-bubble.has-iframe {
    overflow: hidden !important;
}

.ploko-embedded-chat-widget .message-bubble.has-iframe::-webkit-scrollbar {
    display: none;
}

.ploko-embedded-chat-widget .message-bubble.has-iframe {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Typing indicator for embedded chat */
.ploko-embedded-chat-widget .typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: white;
    border-radius: 12px;
    max-width: 150px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ploko-embedded-chat-widget .typing-dots {
    display: flex;
    gap: 4px;
}

.ploko-embedded-chat-widget .typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typingDot 1.4s infinite;
}

.ploko-embedded-chat-widget .typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ploko-embedded-chat-widget .typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

/* Template forms in embedded chat */
.ploko-embedded-chat-widget .template-form-container {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    width: 100%;
}

.ploko-embedded-chat-widget .template-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ploko-embedded-chat-widget .template-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ploko-embedded-chat-widget .template-field label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.ploko-embedded-chat-widget .template-field input {
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
    font-family: inherit;
}

.ploko-embedded-chat-widget .template-field input:focus {
    outline: none;
    border-color: var(--ploko-primary-color, #854fff);
}

.ploko-embedded-chat-widget .template-field input.error {
    border-color: #dc3545;
}

.ploko-embedded-chat-widget .template-form button[type="submit"] {
    background: var(--ploko-primary-color, #854fff);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.ploko-embedded-chat-widget .template-form button[type="submit"]:hover {
    background: var(--ploko-primary-color-dark, #6b3fd4);
    transform: translateY(-1px);
}

/* Mobile responsive for embedded widget */
@media (max-width: 768px) {
    .ploko-embedded-chat-widget {
        max-width: 100%;
        margin: 10px 0;
    }
    
    .embedded-chat-container {
        border-radius: 8px;
        height: 500px;
    }
    
    .ploko-embedded-chat-widget .message-bubble {
        max-width: 85%;
    }
}
