/* === Root variables === */
#ires-chat-root {
    --color-blue: #0d6efd;
    --color-blue-dark: #0b5ed7;
    --color-gray-light: #f8f9fa;
    --color-gray: #ddd;
    --color-gray-dark: #888;
    --color-white: #ffffff;
    --color-black: #000000;

    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 0.75rem;
    --space-lg: 1rem;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --ires-green: #67b516;
    --ires-blue: #1667b5;

    font-family: "Roboto", sans-serif;
    position: relative;

    font-size: 16px;
}

/* === Base reset === */
#ires-chat-root * {
    box-sizing: border-box;
    font-family: inherit;
}

/* === Chat Button === */
#ires-chat-root .ires-chat-button {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 1050;
    border-radius: 50%;
    padding: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    background: var(--ires-blue);
    border: 1px solid var(--ires-blue);
    color: var(--ires-blue);
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s;
}

#ires-chat-root .ires-chat-button:hover {
    background: var(--ires-green);
    border-color: var(--ires-green);
}

/* === Chat Panel === */
#ires-chat-root .ires-chat-panel {
    position: fixed;
    right: 1em;
    bottom: 5.5em;
    z-index: 1040;
    width: 380px;
    max-width: 80vw;
    height: 560px;
    max-height: 80vh;
    display: none;
}

#ires-chat-root .ires-chat-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-lg);
    background: var(--color-white);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid var(--color-gray);
    margin-left: 0.5em;
}

/* === Header === */
#ires-chat-root .ires-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: var(--color-white);
    border-bottom: 1px solid var(--color-gray);
}

#ires-chat-root .ires-chat-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
    margin-right: var(--space-sm);
}

#ires-chat-root .ires-chat-header-title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--ires-green);
    text-shadow: 0.5px 0.5px var(--color-gray-dark);
}

/* === Header buttons === */
#ires-chat-root .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    font-size: 1em;
    border: 1px solid transparent;
    background: var(--color-white);
    color: #333;
    transition: all 0.2s;
}

#ires-chat-root .btn:hover {
    background: #f2f2f2;
}

#ires-chat-root .btn-outline-secondary {
    border: 1px solid #ccc;
}

#ires-chat-root .btn-outline-danger {
    border: 1px solid #c00;
    color: #c00;
}

#ires-chat-root .btn-outline-danger:hover {
    background: #fee;
}

#ires-chat-root .btn-close {
    box-sizing: content-box;
    width: 1em;
    height: 1em;
    padding: .25em .25em;
    color: #000;
    background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414'/%3e%3c/svg%3e") center/1em auto no-repeat;
    filter: var(--bs-btn-close-filter);
    border: 0;
    border-radius: .375rem;
    opacity: 0.5;
}

#ires-chat-root .btn-close:hover {
    opacity: 0.75;
}

#ires-chat-root .btn-close:focus {
    opacity: 0.75;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.img-fluid {
    max-width: 100%;
    height: auto;
}

#iresChatToggle .chatIcon {
    width: 40px;
}

/* === Chat Body === */
#ires-chat-root .ires-chat-body {
    padding: var(--space-md);
    flex: 1;
    background: var(--color-white);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* === Message bubbles === */
#ires-chat-root .ires-chat-messages {
    display: flex;
    flex: 1;
    flex-direction: column;
    overflow-y: auto;
    gap: var(--space-sm);
}

#ires-chat-root .chat-msg {
    max-width: 80%;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    line-height: 1.4;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Bot message bubble */
#ires-chat-root .chat-msg.bot {
    align-self: flex-start;
    background: #e9ecef;
    color: #111;
    border-top-left-radius: 0;
}

/* Human message bubble */
#ires-chat-root .chat-msg.human {
    align-self: flex-end;
    background: var(--ires-blue);
    color: var(--color-white);
    border-top-right-radius: 0;
    text-align: right;
}

/* === Typing Indicator === */
#ires-chat-root .bot-typing-indicator {
    display: none;
    align-items: center;
    gap: 0.3rem;
    background: #e9ecef;
    color: #111;
    border-radius: var(--radius-md);
    border-top-left-radius: 0;
    padding: var(--space-md) var(--space-lg);
    width: fit-content;
    align-self: flex-start;
    position: static;
    margin-top: 0.25rem;
}

#ires-chat-root .bot-typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: #555;
    border-radius: 50%;
    opacity: 0.3;
    animation: typingPulse 1.5s infinite ease-in-out;
}

#ires-chat-root .bot-typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

#ires-chat-root .bot-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

#ires-chat-root .bot-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingPulse {

    0%,
    80%,
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-3px);
    }
}

/* === Footer === */
#ires-chat-root .card-footer {
    padding: var(--space-md) var(--space-lg);
    background: var(--color-gray-light);
    border-top: 1px solid var(--color-gray-light);
}

#ires-chat-root #iresChatForm {
    display: flex;
    gap: var(--space-sm);
}

#ires-chat-root .form-control {
    flex: 1;
    border-radius: var(--radius-sm);
    border: 1px solid #ccc;
    padding: var(--space-sm) var(--space-md);
    font-size: 0.9rem;
}

#ires-chat-root .btn-primary {
    background: var(--ires-green);
    color: var(--color-white);
    border: 1px solid var(--ires-green);
}

#ires-chat-root .btn-primary:hover {
    background: var(--ires-blue);
    border-color: var(--ires-blue);
}

#ires-chat-root .text-muted {
    color: var(--color-gray-dark);
    font-size: 0.8rem;
    display: block;
    margin-top: var(--space-xs);
}

/* ======================================
   EMBED MODE – inline chat weergave
   ====================================== */

#ires-chat-root .ires-chat-panel.ires-embed {
    position: relative !important; /* niet fixed zoals widget */
    bottom: auto !important;
    right: auto !important;

    width: 100% !important;
    /* vult container */
    max-width: 80em !important;

    height: auto !important;
    /* groeit met content */
    max-height: none !important;

    display: block !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0;
}

/* De kaart zelf mag ook 'gewoon' inline */
#ires-chat-root .ires-chat-panel.ires-embed .ires-chat-card {
    border: 1px solid var(--color-gray);
    box-shadow: none;
    border-radius: var(--radius-md);
}

/* Footer moet niet aan de randen plakken in embed */
#ires-chat-root .ires-chat-panel.ires-embed .card-footer {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Chat body mag wat meer lucht krijgen */
#ires-chat-root .ires-chat-panel.ires-embed .ires-chat-body {
    padding: var(--space-lg);
}

/* Close button uitschakelen (JS verbergt hem al, CSS vangt layout op) */
#ires-chat-root .ires-chat-panel.ires-embed .btn-close {
    display: none !important;
}

/* Typing indicator netjes uitlijnen in inline context */
#ires-chat-root .ires-chat-panel.ires-embed .bot-typing-indicator {
    margin-left: 0;
}

/* ============================
   FULLSCREEN WIDGET MODE
   ============================ */

#ires-chat-root .ires-fullscreen-btn {
    margin-right: 0.5rem;
    font-size: 1.2rem;
    cursor: pointer;
    background: transparent;
    border: none;
    opacity: 0.7;
    transition: 0.2s;
}

#ires-chat-root .ires-fullscreen-btn:hover {
    opacity: 1;
}

/* Fullscreen staat boven alles */
#ires-chat-root .ires-chat-panel.ires-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;

    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;

    border-radius: 0 !important;
    margin: 0 !important;
    z-index: 99999 !important;
}

#ires-chat-root .ires-chat-panel.ires-fullscreen .ires-chat-card {
    border-radius: 0 !important;
    margin-left: 0
}

@media (max-width: 600px) {
    #ires-chat-root .ires-chat-panel.ires-embed {
            width: 100%;
            max-width: 100%;
    }
    #ires-chat-root .form-control {
        font-size: 16px !important;
    }
}