/* Wrapper – fixed position at the bottom right corner of the screen. */
.ai-chat-wrapper {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9000;
    font-family: Arial, sans-serif;
}

/* Button */
.ai-chat-btn {
    width: 60px;
    height: 60px;
    background: #F15A29;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transition: transform .25s, background .25s;
}

.ai-chat-btn:hover {
    background: #005fcc;
}

.ai-chat-btn.active {
    transform: scale(0.9);
}

.ai-chat-icon {
    max-width: 30px;
}


/* Chat window */
.ai-chat-window {
    width: 320px;
    height: 460px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    position: absolute;
    bottom: 80px;
    right: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: opacity .25s, transform .25s;
}

.ai-chat-window.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Header */
.ai-chat-header {
    background: #f0f0f0;
    color: black;
    padding: 12px;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.ai-chat-header span {
    font-weight: bold;
    padding-left: 10px;
}

.ai-chat-clear, .ai-chat-share {
    background: transparent;
    border: none;
    color: black;
    font-size: 16px;
    cursor: pointer;
}

/* Chat body */
.ai-chat-body {
    flex: 1;
    overflow: hidden;
    padding: 6px 0 6px 0;
}

.ai-chat-messages {
    height: 100%;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* chat message "bubbles" */
.ai-chat-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    overflow-wrap: break-word; /* New property for long words breaking */
    word-wrap: break-word; /* Fallback for older browsers */
}

.msg-user {
    align-self: flex-end;
    background: #0078ff;
    color: white;
    box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.7);
}

.msg-ai {
    align-self: flex-start;
    background: #eaeaea;
    color: #333;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6);
}

.msg-ai img.thinking-gif {
    display: block;
    height: 24px;
}

/* Input bar */
.ai-chat-input {
    display: flex;
    align-items: flex-end; /* Tlačítko bude zarovnané dolů k textarea */
    border-top: 1px solid #ddd;
    padding: 8px;
    gap: 6px;
}

.ai-chat-input-wrapper {
    position: relative;
    flex: 1;
    display: flex; /* Make it a flex container to align textarea and icon */
    align-items: flex-end;
}

.ai-chat-input textarea {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid #ccc;
    resize: none; /* Disable manual resizing */
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    max-height: 150px; /* Must match _maxInputHeight in the code */
    overflow-y: hidden; /* Hides the scrollbar. Will be displayed by the code. */
    padding-right: 30px; /* Add padding for the clear icon */
}

.ai-chat-input button {
    width: 40px;
    height: 36px; /* Fixed button height */
    background: #F15A29;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.ai-chat-input button.loading {
    background: #ccc;
    cursor: default;
}

.ai-chat-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 32px;
    height: 32px;
    cursor: nw-resize;
    z-index: 10000;
    border-radius: 12px 0 0 0;
}

.ai-chat-resize-handle::before,
.ai-chat-resize-handle::after {
    content: "";
    position: absolute;
    border-top: 2px solid #999;
    border-left: 2px solid #999;
    border-radius: 2px 0 0 0;
    transition: all .2s ease;
}

.ai-chat-resize-handle::before {
    top: 6px;
    left: 6px;
    width: 14px;
    height: 14px;
}

.ai-chat-resize-handle::after {
    top: 10px;
    left: 10px;
    width: 7px;
    height: 7px;
    border-width: 1.5px;
    opacity: 0.7;
}

.ai-chat-resize-handle:hover::before {
    border-color: #0078ff;
    top: 4px;
    left: 4px;
    width: 18px;
    height: 18px;
    border-width: 3px;
}

.ai-chat-resize-handle:hover::after {
    border-color: #0078ff;
    top: 11px;
    left: 11px;
    opacity: 1;
}

.ai-alert-dialog {
    z-index: 10000;
}

.ai-chat-input-wrapper .del-icon { /* Updated selector */
    position: absolute;
    right: 8px; /* Adjust as needed */
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
    font-size: 16px;
    padding: 0; /* Remove padding from del-icon itself */
    background: transparent; /* Remove background */
    border: none; /* Remove border */
}

.ai-chat-input-wrapper .del-icon:hover {
    color: #333;
}

/* Ensure the textarea has enough padding on the right to not be covered by the icon */
.ai-chat-input-wrapper textarea.wf-input-w-del {
    padding-right: 30px; /* Adjust this value if the icon size changes */
}
