/* ========================================================================
   OVERLAY
========================================================================= */

#unifies-insight-ai-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

#unifies-insight-ai-overlay.unifies-ai-hidden {
    display: none;
}

/* ========================================================================
   MODAL – 800 x 600 px
========================================================================= */

#unifies-insight-ai-modal {
    width: 800px !important;
    height: 600px !important;
    max-width: 95vw;
    max-height: 95vh;

    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 26px 80px rgba(0,0,0,0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ========================================================================
   HEADER – titel + mic + X
========================================================================= */

.unifies-ai-header {
    padding: 14px 22px;
    background: #000000;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.unifies-ai-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.unifies-ai-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #fff200;
}

.unifies-ai-header-actions button {
    border: none;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    margin-left: 8px;
    padding: 4px;
}

/* ========================================================================
   BODY – bakgrund + flexlayout
========================================================================= */

.unifies-ai-body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: row;
    gap: 20px;
    padding: 18px 22px 20px;

    background-image: url('https://unifies.com/wp-content/uploads/2025/11/light-gray-background-1mg7fdxwqnn94pmv.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.unifies-ai-chat-panel,
.unifies-ai-voice-panel,
.unifies-ai-contact-panel {
    flex: 1 1 auto;
    min-width: 0;
}

/* ========================================================================
   CHAT-PANEL SOM KOLUMN
========================================================================= */

.unifies-ai-chat-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ========================================================================
   MESSAGES – scrollområde
========================================================================= */

.unifies-ai-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
    margin-bottom: 14px;
}

.unifies-ai-msg-assistant,
.unifies-ai-msg-visitor {
    margin-bottom: 10px;
    display: flex;
}

.unifies-ai-msg-assistant { justify-content: flex-start; }
.unifies-ai-msg-visitor  { justify-content: flex-end; }

/* ========================================================================
   BUBBLOR
========================================================================= */

.unifies-ai-bubble {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    background: #f5f5f7;
    color: #111;

    /* Mjuk skugga under alla bubblor */
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.15);
}

/* AI-bubbla */
.unifies-ai-msg-assistant .unifies-ai-bubble {
    background: #ffffff;
    color: #111111;
    border: 1px solid #d1d5db;
}

/* Besökarens bubbla */
.unifies-ai-msg-visitor .unifies-ai-bubble {
    background: #fff200 !important;
    color: #333333 !important;
    border: 1px solid #c7b800;
}

/* Markdown i bubblor */
.unifies-ai-bubble p { margin: 0 0 6px; }
.unifies-ai-bubble p:last-child { margin-bottom: 0; }
.unifies-ai-bubble ul { margin: 0 0 6px 20px; padding: 0; }
.unifies-ai-bubble li { margin-bottom: 3px; }

/* ========================================================================
   INPUTRAD
========================================================================= */

.unifies-ai-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.unifies-ai-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 10px 11px;
    border-radius: 999px;
    border: 1px solid #d1d5db;
    font-size: 14px;
}

.unifies-ai-input:focus {
    outline: none;
    border-color: #111827;
    box-shadow: 0 0 0 1px #1118270d;
}

/* Skicka-knapp (pil) */

.unifies-ai-send {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    border: none;
    background: #111827;
    color: #ffffff;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

.unifies-ai-send:hover {
    background: #fff200 !important;
    color: #000000 !important;
}

/* ========================================================================
   FOOTER-LÄNK (kontaktformulär-länk)
========================================================================= */

.unifies-ai-footer-links { margin-top: 10px; }

.unifies-ai-contact-btn {
    border: none;
    background: transparent;
    padding: 0;
    font-size: 13px;
    color: #111827;
    text-decoration: underline;
    cursor: pointer;
}

/* ========================================================================
   CONTACT-PANEL
========================================================================= */

.unifies-ai-contact-panel {
    display: none;
}

.unifies-ai-field-row {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 13px;
}

.unifies-ai-field-row input,
.unifies-ai-field-row textarea {
    border-radius: 6px;
    border: 1px solid #d1d5db;
    padding: 7px 9px;
    font-size: 13px;
}

.unifies-ai-contact-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Kontaktformulär – knappar */

.unifies-ai-contact-actions .button {
    border-radius: 999px;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #111827;
    background: #111827;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

/* Primär (Send message) */
.unifies-ai-contact-actions .button.button-primary {
    background: #111827;
    border-color: #111827;
}

/* Sekundär (Back to chat) */
.unifies-ai-contact-actions .button.unifies-ai-back-to-chat {
    background: #ffffff;
    color: #111827;
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.15);
}

/* Hover – gul på alla */
.unifies-ai-contact-actions .button:hover {
    background: #fff200 !important;
    color: #000000 !important;
    border-color: #fff200 !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* ========================================================================
   VOICE-PANEL
========================================================================= */

.unifies-ai-voice-panel {
    display: none;
    text-align: center;
}

.unifies-ai-voice-status {
    margin-bottom: 18px;
    font-size: 14px;
}

.unifies-ai-voice-controls {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.unifies-ai-voice-mic-btn {
    width: 70px;
    height: 70px;
    border-radius: 999px;
    border: none;
    background: #111827;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.35);
    transition: background 0.2s ease, color 0.2s ease,
                box-shadow 0.2s ease, transform 0.1s ease;
}

.unifies-ai-voice-mic-btn.listening {
    background: #16a34a;
}

.unifies-ai-voice-mic-btn:hover {
    background: #fff200;
    color: #000000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    transform: translateY(-1px);
}

.unifies-ai-voice-stop-btn,
.unifies-ai-voice-back-btn {
    border-radius: 999px;
    border: 1px solid #d1d5db;
    padding: 7px 18px;
    background: #ffffff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.2);
    transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.unifies-ai-voice-stop-btn:hover,
.unifies-ai-voice-back-btn:hover {
    background: #fff200;
    color: #000000;
    border-color: #fff200;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.unifies-ai-voice-hint {
    font-size: 12px;
    color: #6b7280;
}

/* ========================================================================
   FLOATING LAUNCHER-KNAPP
========================================================================= */

.unifies-ai-fab {
    position: fixed;
    top: 80px;
    right: 50px;
    z-index: 9999;

    display: inline-flex;
    align-items: center;
    gap: 10px;

    padding: 5px 10px;
    border-radius: 5px;

    background: rgba(0, 0, 0, 0.75);
    color: #ffffff;
    border: none;
    cursor: pointer;

    font-family: inherit;
    font-size: 30px;
    font-weight: 600;

    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    transition: background 0.2s ease, color 0.2s ease, transform 0.1s ease;
}

.unifies-ai-fab:hover {
    background: #fff200;
    color: #000000;
    transform: translateY(-1px);
}

/* ========================================================================
   PANEL-STATES – vilken panel som visas
========================================================================= */

#unifies-insight-ai-modal .unifies-ai-chat-panel    { display: flex; }
#unifies-insight-ai-modal .unifies-ai-contact-panel { display: none; }
#unifies-insight-ai-modal .unifies-ai-voice-panel   { display: none; }

#unifies-insight-ai-modal.unifies-ai-contact-mode .unifies-ai-chat-panel    { display: none; }
#unifies-insight-ai-modal.unifies-ai-contact-mode .unifies-ai-contact-panel { display: block; }

#unifies-insight-ai-modal.unifies-ai-voice-mode .unifies-ai-chat-panel      { display: none; }
#unifies-insight-ai-modal.unifies-ai-voice-mode .unifies-ai-contact-panel   { display: none; }
#unifies-insight-ai-modal.unifies-ai-voice-mode .unifies-ai-voice-panel     { display: block; }

/* ========================================================================
   MOBIL
========================================================================= */

@media (max-width: 640px) {
    #unifies-insight-ai-modal {
        width: 100vw !important;
        height: 100vh !important;
        border-radius: 0;
    }

    .unifies-ai-body {
        flex-direction: column;
    }
}
