:root {
    --theme-color: #74a5e0;
    --primary-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --secondary-gradient: linear-gradient(135deg, #f472b6, #db2777);
    --bg-color: #fff;
    --chat-bg: #f8fafc;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --bot-message-bg: #f0f0f0;
    --user-message-bg: #e2f0ff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
    --text-color: rgb(15, 20, 25);
    --text-color-reverse: rgb(15, 20, 25);
    --white-text: #fff;
    --black-text: rgb(15, 20, 25);
    --text-color-special: rgb(55, 67, 77);
    --btn-bg: rgba(247,249,249,1.00);
    --btn-hover: #eee;
    --btn-border: rgb(229, 234, 236);
    --textarea-bg: rgba(247,249,249,1.00);
}
/*
[data-theme="dark"] {
    --theme-color: #74a5e0;
    --bg-color: #0f172a;
    --chat-bg: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --bot-message-bg: #334155;
    --user-message-bg: #6366f1;
    --border-color: #334155;
    --text-color: #fff;
    --text-color-reverse: #fff;
    --white-text: #fff;
    --black-text: rgb(15, 20, 25);
    --text-color-special: #eee;
    --btn-bg: #0f172a;
    --btn-hover: #334155;
    --btn-border: #1e293b;
    --textarea-bg: #0C1423;
}
*/
.ai-widget-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 74px;
    height: 74px;
    background-color: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ai-widget-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.character-select select option { color: var(--text-color); }

.ai-widget-container {
    font-family: "Sansation", sans-serif;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 407px;
    height: 547px;
    background-color: #f7f7f7;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    display: none;
    opacity: 0;
    transform: translateY(70px) scale(0.8);
    transform-origin: bottom right;
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    border: 1px solid #ddd;
}

.ai-widget-container.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ai-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: **transparent**;
    border-bottom: none;
    position: absolute;
    width: 100%;
    box-sizing: border-box;
    z-index: 5;
}

.character-select select {
    padding: 5px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, .5);
    background-color: transparent;
    color: #fff;
}

.header-buttons .control-button {
    margin-left: 5px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    padding: 0;
    border: none;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, .5);
    color: #fff;
    cursor: pointer;
}

.ai-model-area {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
    width: 100%;
    height: 100%;
}

.model-placeholder {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-history-area {
    position: absolute;
    top: 55px;
    bottom: 0;
    left: 0;
    right: 0;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    background-color: rgba(255, 255, 255, 0.6);
    display: none;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    z-index: 3;
}

.chat-message-list {
    width: 100%;
    height: calc(100% - 110px);
    overflow-y: auto;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.message-container {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding-bottom: 10px;
}

.message {
    display: flex;
    margin-bottom: 15px;
    max-width: 90%;
}

.avatar {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    overflow: hidden;
    margin-top: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 40px);
}

.message-text {
    padding: 10px 12px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.bot-message {
    align-self: flex-start;
    margin-right: auto;
}

.bot-message .avatar {
    margin-right: 8px;
}

.bot-message .message-text {
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
    margin-left: auto;
}

.user-message .avatar {
    margin-left: 8px;
}

.user-message .message-content {
    align-items: flex-end;
}

.user-message .message-text {
    background-color: rgba(255, 255, 255, 0.6);
    color: #000;
    border-bottom-right-radius: 4px;
}

.message-actions {
    display: flex;
    gap: 5px;
    margin-top: 5px;
    font-size: 12px;
}

.action-button {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: none;
    transition: background-color 0.2s;
}

.action-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.action-button i {
    margin-right: 5px;
    color: #000;
}

.action-button .spanBtn {
    font-size: 12px;
}

.bot-message .action-button {
    color: #666;
}

.bot-message .action-button svg {
    fill: #666;
}

.user-message .action-button {
    color: #666;
}

.ai-widget-footer {
    display: flex;
    align-items: center;
    padding: 8px;
    background-color: transparent;
    position: absolute;
    bottom: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 4;
}

.chat-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 5px;
    border: none;
    background-color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 18px;
}

.input-area-group {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 5px 10px;
    border-radius: 10px;
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease-in-out;
}

.input-area-group.is-chat-active {
    background-color: rgba(255, 255, 255, 0.6);
    color: #000;
}

.input-area-group.is-chat-active .message-input::placeholder,
.input-area-group.is-chat-active .message-input:-ms-input-placeholder,
.input-area-group.is-chat-active .message-input::-ms-input-placeholder {
    color: #000;
}

.message-input {
    width: 100%;
    padding: 0;
    border: none;
    background-color: transparent;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    outline: none;
    overflow-y: auto;
    box-sizing: border-box;
    margin-bottom: 5px;
    font-size: 14px;
}

.message-input::placeholder,
.message-input:-ms-input-placeholder,
.message-input::-ms-input-placeholder {
    color: #fff;
    opacity: 1;
}

.input-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.input-controls {
    display: flex;
    gap: 5px;
}

.input-controls .control-button {
    border-radius: 10px;
    padding: 5px;
    border: none;
    color: #fff;
    cursor: pointer;
    border: 1px solid #fff;
    font-size: 14px;
    background-color: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.1s;
}

.control-button span { padding-left: 5px; }

.input-area-group.is-chat-active .input-controls .control-button {
    color: #000;
    border-color: #888;
}

#send-voice-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    padding: 0;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #000;
    margin-left: 10px;
}

#send-voice-btn.active-send {
    background-color: var(--theme-color) !important;
}

#send-voice-btn.active-voice {
    background-color: #000 !important;
}

.control-panel {
    position: absolute;
    top: 0px;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, .8);
    padding: 0;
    z-index: 5;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
    background-color: #ffffff;
}

.panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.close-panel-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.panel-content {
    padding: 15px;
    overflow-y: auto;
    flex-grow: 1;
}

.panel-content select,
.panel-content button {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background-color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.widget-position-select button[data-position] {
    margin-right: 10px;
}

.widget-position-select button:hover {
    background-color: #eee;
}

.memory-controls label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    margin-bottom: 10px;
    padding-right: 5px;
}

.memory-controls input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch-container {
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background-color: #eee;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.toggle-switch-container::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: var(--bg-color);
    transition: transform 0.3s, background-color 0.3s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.memory-controls input[type="checkbox"]:checked + .toggle-switch-container {
    background-color: var(--theme-color);
}

.memory-controls input[type="checkbox"]:checked + .toggle-switch-container::before {
    transform: translateX(20px);
}

@media (min-width: 601px) and (max-width: 1024px) {
    #ai-widget-container {
        width: 400px;
        height: 600px;
    }
}

@media (max-width: 600px) {
    #ai-widget-container {
        width: 100vw;
        height: 100vh;
        max-width: none;
        max-height: none;
        bottom: 0 !important;
        right: 0 !important;
        left: auto !important;
        border-radius: 0;
        box-shadow: none;
    }

    .ai-widget-button {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
        left: auto;
    }

    #ai-widget-header {
        width: 100%;
    }

    #ai-widget-footer {
        width: 100%;
        box-sizing: border-box;
        padding: 8px 10px;
    }

    .chat-history-area,
    .control-panel {
        top: 0px;
    }

    .chat-message-list {
        height: calc(100% - 90px);
    }
}

@media (max-width: 375px) {
    .control-button span { display: none; }
}


