/* Editor styles */
.qumo-chat-icon-editor {
    padding: 30px;
    border: 1px solid #e0e0e0;
    background-color: #f9f9f9;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.qumo-chat-icon-header {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.1em;
    display: flex;
    align-items: center;
}

.qumo-chat-icon-header strong {
    margin-left: 10px;
}

.qumo-editor-header {
    margin-bottom: 24px;
    color: #333;
    font-size: 1.1em;
    display: flex;
    align-items: center;
    padding: 0 0 15px;
    border-bottom: 1px solid #eee;
}

.qumo-editor-header strong {
    margin-left: 10px;
    font-size: 16px;
}

.qumo-logo {
    height: 24px;
    width: auto;
}

/* Remove preview-related styles */
.qumo-icon-preview-demo,
.qumo-chat-icon-preview,
.qumo-chat-icon-preview-label,
.qumo-icon-preview-container {
    display: none;
}

.qumo-chat-icon-text-preview {
    margin-top: 10px;
    font-weight: 500;
    background: #f0f7ff;
    padding: 8px 16px;
    border-radius: 30px;
    display: inline-block;
    font-size: 14px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
}

.qumo-chat-icon-instructions {
    margin-top: 20px;
    color: #555;
    font-size: 13px;
    line-height: 1.5;
}

.qumo-chat-icon-notice {
    color: #777;
    font-style: italic;
    margin-top: 15px;
}

.qumo-invalid-url-input {
    border-color: #dc3232 !important;
    background-color: #ffeeee !important;
    border-radius: 4px;
}

.qumo-chat-icon-error {
    color: #dc3232;
    margin: 8px 0;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 12px;
    background-color: #fff1f1;
    border-radius: 8px;
    display: inline-block;
}

/* Frontend styles */
.qumo-chat-icon {
    position: fixed;
    z-index: 999999; /* Increased z-index to ensure visibility */
    bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto; /* Ensure click events work */
}

.qumo-chat-icon.position-right {
    right: 20px;
    align-items: flex-end;
}

.qumo-chat-icon.position-left {
    left: 20px;
    align-items: flex-start;
}

/* Updated frontend chat icon styles */
.qumo-chat-icon-button {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    padding: 0; /* Remove any padding */
    min-width: 50px; /* Ensure minimum size */
    min-height: 50px;
}

/* Update SVG icon sizing and centering */
.qumo-chat-icon-button svg {
    width: 55%;
    height: 55%;
    display: block;
    margin: 0;
    padding: 0;
}

/* Remove the old separate SVG classes since we're targeting all SVGs in the button */
.qumo-chat-icon-svg {
    width: 50%;
    height: 50%;
}

/* Scale icons based on button size - simplified scaling */
.qumo-chat-icon-button[style*="width:"] svg {
    margin: 0;
    padding: 0;
}

.qumo-chat-icon-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

/* Cross icon styling when popup is open */
.qumo-chat-icon-button.is-active .qumo-chat-icon-svg {
    display: none;
}

.qumo-chat-icon-close-svg {
    display: none;
    width: 40%;
    height: 40%;
}

.qumo-chat-icon-button.is-active .qumo-chat-icon-close-svg {
    display: block;
}

/* Scale text bubble with larger icon */
.qumo-chat-icon-text {
    position: relative;
    background: white;
    color: #333;
    padding: 12px 40px 12px 24px; /* Increased right padding for close button */
    border-radius: 30px;
    font-size: 15px;
    margin-bottom: 15px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    font-weight: 500;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Close button for text bubble */
.qumo-chat-icon-text-close {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background-color 0.2s ease;
    font-size: 14px;
    color: #666;
}

.qumo-chat-icon-text:hover .qumo-chat-icon-text-close {
    opacity: 1;
}

.qumo-chat-icon-text-close:hover {
    background: #e0e0e0;
    color: #333;
}

/* Hide icon text when popup is shown */
.qumo-chat-icon-text.hidden {
    opacity: 0;
    transform: translateY(10px);
    visibility: hidden;
}

.qumo-chat-popup {
    position: fixed;
    bottom: 90px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    display: none;
    overflow: hidden;
}

.qumo-chat-popup.position-right {
    right: 20px;
}

.qumo-chat-popup.position-left {
    left: 20px;
}

.qumo-chat-popup.show {
    display: block;
    animation: qumoFadeIn 0.3s ease;
}

/* Remove header and make content take full height */
.qumo-chat-popup-content {
    height: 100%; 
    position: relative;
    overflow: hidden;
    padding: 0; /* Remove any padding */
    border-radius: inherit;
}

/* Style for the close button that overlays the iframe */
.qumo-chat-popup-overlay-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    z-index: 10;
    color: #555;
    font-size: 22px;
    line-height: 1;
    transition: all 0.2s ease;
}

.qumo-chat-popup-overlay-close:hover {
    background: #fff;
    transform: scale(1.1);
    color: #333;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
}

.qumo-chat-popup iframe {
    width: 100%;
    height: 100%;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.qumo-chat-popup:not(.loading) iframe {
    opacity: 1;
}

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

/* Loading state and spinner */
.qumo-chat-popup.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 1;
    border-radius: inherit;
}

.qumo-chat-popup.loading::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    top: 50%;
    left: 50%;
    margin: -20px 0 0 -20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    z-index: 2;
    animation: qumoSpin 1s linear infinite;
}

@keyframes qumoSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@media screen and (max-width: 768px) {
    .qumo-chat-popup {
        width: calc(100% - 40px) !important;
        height: 80vh !important; /* Slightly increased for better mobile view */
        bottom: 90px; /* Adjusted for larger icon */
        left: 20px;
        right: 20px;
    }
    
    .qumo-chat-icon-mobile-hidden {
        display: none !important;
    }

    /* Adjust padding on mobile to match form-embed */
    .qumo-chat-icon-editor {
        padding: 20px;
    }
}

/* Helper text */
.qumo-helper-text {
    display: block;
    margin: 16px 0 0;
    padding: 12px 16px;
    background-color: #f0f7ff;
    border-left: 4px solid #2271b1;
    border-radius: 4px;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

/* Update icon option styles in sidebar */
.qumo-icon-option {
    padding: 18px;
    border-radius: 10px;
    border: 1px solid #ddd;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.qumo-icon-option svg {
    width: 24px;
    height: 24px;
    margin-bottom: 8px;
}

.qumo-icon-option.selected svg {
    color: #2271b1;
}

/* Helper text container */
.qumo-helper-container {
    margin-top: 24px;
}

/* Form preview updates */
.qumo-form-preview {
    margin-top: 24px;
    padding: 20px;
    background-color: #fff;
    border: 1px solid #eaeaea;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    flex: 3;
    margin-top: 0; /* Override the margin-top since we're using the container's margin */
}

.qumo-form-preview-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    text-align: center;
    font-size: 14px;
}

/* Placeholder improvements - match with form embed */
.qumo-placeholder-container {
    padding: 40px 20px;
    text-align: center;
    background-color: #f8fafc;
    border-radius: 12px;
    margin-top: 20px;
    border: 1px dashed #e0e0e0;
}

.qumo-placeholder-logo {
    height: 32px;
    margin-bottom: 20px;
}

.qumo-placeholder-text {
    font-size: 16px;
    color: #333;
    margin-bottom: 10px;
    font-weight: 500;
}

.qumo-placeholder-subtext {
    font-size: 13px;
    color: #666;
    max-width: 90%;
    margin: 0 auto;
    line-height: 1.5;
}

/* Chat-specific styling to maintain distinction */
.qumo-form-icon-info {
    display: flex;
    align-items: center;
    margin-top: 20px;
    padding: 16px;
    background-color: #f8fafc;
    border-radius: 12px;
    border: 1px solid #eaeaea;
}

.qumo-icon-description {
    font-size: 13px;
    color: #444;
    line-height: 1.5;
}

/* Side-by-side preview layout */
.qumo-preview-container {
    display: flex;
    margin-top: 24px;
    gap: 20px;
}

.qumo-icon-preview-info {
    font-size: 13px;
    color: #444;
    line-height: 1.4;
    padding: 12px;
    background-color: #f0f9ff;
    border-radius: 8px;
    margin-top: auto;
}

.qumo-icon-preview-position {
    text-align: center;
    margin-top: 15px;
    font-size: 13px;
    color: #666;
}

.qumo-chat-icon-text-preview {
    background: white;
    color: #333;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 14px;
    margin-bottom: 15px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1);
    font-weight: 500;
}

@media screen and (max-width: 768px) {
    /* Stack the previews on mobile */
    .qumo-preview-container {
        flex-direction: column;
    }
    
    .qumo-icon-preview-container {
        width: 100%;
    }
}
