.ai-toolkits-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    z-index: 99999;
    display: none;
    max-height: 90vh;
    /* Maximium window height 90% */
    border-radius: 10px;
    background: transparent;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: #ffffff;
}

.ai-toolkits-popup-content {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background-color: #ffffff;
    border-radius: 8px;
    padding-top: 30px;
    padding-bottom: 30px;
    z-index: 1;
    -webkit-overflow-scrolling: touch;
    /* Better iOS scroll */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow-x: hidden;
    box-sizing: border-box;
}

.ai-toolkits-popup-active {
    display: block;
}

.ai-toolkits-popup.ai-toolkits-popup-size-small,
.ai-toolkits-popup.ai-toolkits-popup-size-small .ai-toolkits-popup-content {
    max-width: 300px;
}

.ai-toolkits-popup.ai-toolkits-popup-size-medium,
.ai-toolkits-popup.ai-toolkits-popup-size-medium .ai-toolkits-popup-content {
    max-width: 750px;
}

.ai-toolkits-popup.ai-toolkits-popup-size-large,
.ai-toolkits-popup.ai-toolkits-popup-size-large .ai-toolkits-popup-content {
    max-width: 1000px;
}

.ai-toolkits-popup.ai-toolkits-popup-size-full-size,
.ai-toolkits-popup.ai-toolkits-popup-size-full-size .ai-toolkits-popup-content {
    max-width: 100%;
    /* Max width for large screens */
}

.ai-toolkits-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
}

.ai-toolkits-popup-close-wrapper {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    line-height: 1;
    z-index: 1000;
    transition: color 0.3s ease;
}

.ai-toolkits-popup-close-wrapper:hover {
    color: #000;
}

/* Gallery styles */
.ai-toolkits-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 20px;
}

.ai-toolkits-gallery-item {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
}

.ai-toolkits-gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.ai-toolkits-gallery-item:hover img {
    transform: scale(1.05);
}

/* Video player styles */
.ai-toolkits-video-player {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
}

.ai-toolkits-video-player iframe,
.ai-toolkits-video-player video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

#ai-toolkits-profile-popup {
    max-width: 600px;
}

/* Loading bubble: shown when user closes a generation popup while loading */
.ai-toolkits-loading-bubbles {
    position: fixed;
    top: 50px;
    right: 20px;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ai-toolkits-loading-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
    max-width: 220px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.ai-toolkits-loading-bubble:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

.ai-toolkits-loading-bubble-spinner {
    display: inline-block;
    position: relative;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.ai-toolkits-loading-bubble-spinner div {
    box-sizing: border-box;
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    border-top-color: var(--ai-toolkits-color-main, #2271b1);
    animation: ai-toolkits-bubble-spinner 0.8s linear infinite;
}

@keyframes ai-toolkits-bubble-spinner {
    to {
        transform: rotate(360deg);
    }
}

.ai-toolkits-loading-bubble-label {
    font-size: 13px;
    color: #1d2327;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading with tips (progress bar + typewriter) */
.ai-toolkits-loading-with-tips .ai-toolkits-loader-circle-wrapper {
    margin-top: 20px;
    height: auto;
}

.ai-toolkits-loading-progress-wrapper {
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.ai-toolkits-loading-progress-bar {
    height: 6px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.ai-toolkits-loading-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--ai-toolkits-color-main, #2271b1);
    border-radius: 3px;
    transition: width 0.2s ease-out;
}

.ai-toolkits-loading-tip-wrapper {
    min-height: 60px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
    text-align: left;
}

.ai-toolkits-loading-tip-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ai-toolkits-color-main, #2271b1);
    margin: 0 0 8px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-toolkits-loading-tip-text {
    font-size: 14px;
    line-height: 1.5;
    color: #50575e;
    margin: 0;
    min-height: 1.5em;
}

.ai-toolkits-typewriter-cursor {
    animation: ai-toolkits-typewriter-blink 0.8s step-end infinite;
    color: var(--ai-toolkits-color-main, #2271b1);
}

@keyframes ai-toolkits-typewriter-blink {
    50% { opacity: 0; }
}

.ai-toolkits-text-gray {
    color: #646970;
}

.ai-toolkits-text-small {
    font-size: 13px;
}

@media (max-width: 768px) {
    .ai-toolkits-popup-content {
        max-height: 100%;
    }

    .ai-toolkits-loading-bubbles {
        top: 12px;
        left: 12px;
        max-width: calc(100vw - 24px);
    }

    .ai-toolkits-loading-bubble {
        max-width: none;
    }

    .ai-toolkits-loading-bubble-label {
        white-space: normal;
    }
}