/* CSS Custom Properties */
:root {
    --aiChat-primary-background: #95f252;
    --aiChat-primary-color: #bc147c;
    --aiChat-break-point-small: 480px;
    --aiChat-break-point-medium: 768px;
    --aiChat-break-point-large: 1024px;
}

/* Chat Window */
.aiChat-chat-window {
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 100px;
    right: 15px;
    width: 380px;
    height: 600px;
    z-index: 998;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
    .aiChat-chat-window {
        right: 10px;
        width: calc(95vw - 10px);
        height: calc(95vh - 20px);
        max-width: 100%;
    }
}

@media (max-width: 480px), (max-height: 500px) {
    .aiChat-chat-window {
        right: 5px;
        left: 5px;
        bottom: 40px;
        width: calc(100vw - 10px);
        height: calc(95vh - 20px);
        border-radius: 12px;
    }
}

/* Toggle Button */
.aiChat-toggle-button {
    position: fixed;
    bottom: 15px;
    right: 15px;
    z-index: 999;
    width: 64px;
    height: 64px;
    border: none;
    border-radius: 50%;
    background: var(--aiChat-primary-background);
    color: var(--aiChat-primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.aiChat-toggle-button:hover {
    background: white;
    color: var(--aiChat-primary-color);
    transform: scale(1.05);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
}

.aiChat-toggle-button:active {
    transform: scale(0.95);
}

.aiChat-toggle-button img {
    width: 38px;
    heigth: auto;
}

.aiChat-toggle-button .chat-icon {
    transition: filter 0.2s ease;
}

.aiChat-toggle-button .chat-icon {
    content: url("../images/icons/chat_magenta.svg");
}

.aiChat-toggle-button[data-state="open"] img {
    content: url("../images/icons/x_magenta.svg");
}


@media (max-width: 480px), (max-height: 500px) {
    .aiChat-toggle-button {
        width: 56px;
        height: 56px;
    }

    .aiChat-toggle-button .chat-icon {
        width: 24px;
        heigth: auto;
    }
}

/* Header */
.aiChat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    padding: 0 20px;
    background-color: var(--aiChat-primary-background);
    color: var(--aiChat-primary-color);
    border-bottom: 1px solid #e5e7eb;
}

.aiChat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.aiChat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.aiChat-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.aiChat-header-icon img {
    width: 30px;
    height: auto;
}

.aiChat-header-text {
    margin-top: 5px;
}

.aiChat-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
}

.aiChat-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.aiChat-status.online::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #4ade80;
    border-radius: 50%;
}

.aiChat-status.typing::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #fbbf24;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

.aiChat-close-button,
.aiChat-menu-button {
    background: none;
    border: none;
    color: var(--aiChat-primary-color);
    cursor: pointer;
    transition: all 0.2s ease;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.aiChat-close-button:hover,
.aiChat-menu-button:hover,
.aiChat-menu-button.active {
    background: rgba(255, 255, 255, 0.2);
}

.aiChat-menu-button.active {
    background: rgba(255, 255, 255, 0.3);
}

.aiChat-close-button i,
.aiChat-menu-button i {
    font-size: 20px;
}

.aiChat-close-button:focus,
.aiChat-menu-button:focus {
    outline: none;
}

/* Menu Container und Dropdown Styles */
.aiChat-menu-container {
    position: relative;
    display: inline-block;
}

.aiChat-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 160px;
    overflow: hidden;
    animation: dropdownFadeIn 0.15s ease-out;
}

.aiChat-dropdown-item {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    text-align: left;
}

.aiChat-dropdown-item:hover {
    background: #f9fafb;
}

.aiChat-dropdown-item:active {
    background: #f3f4f6;
}

.aiChat-dropdown-item i {
    width: 16px;
    height: 16px;
    font-size: 16px;
    color: #6b7280;
}

.aiChat-dropdown-item span {
    flex: 1;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat History Panel */
.aiChat-history-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.aiChat-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.aiChat-history-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.aiChat-history-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.aiChat-new-chat-button,
.aiChat-clear-history-button {
    background: none;
    border: 1px solid #e5e7eb;
    color: #666;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aiChat-new-chat-button:hover,
.aiChat-clear-history-button:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #333;
}

.aiChat-clear-history-button:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #dc2626;
}

.aiChat-new-chat-button i,
.aiChat-clear-history-button i {
    font-size: 16px;
}

.aiChat-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.aiChat-history-list::-webkit-scrollbar {
    width: 6px;
}

.aiChat-history-list::-webkit-scrollbar-track {
    background: transparent;
}

.aiChat-history-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.aiChat-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #9ca3af;
    gap: 16px;
}

.aiChat-history-empty i {
    font-size: 48px;
}

.aiChat-history-empty p {
    margin: 0;
    font-size: 14px;
    text-align: center;
}

.aiChat-start-chat-button {
    background: var(--aiChat-primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.aiChat-start-chat-button:hover {
    background: color-mix(in srgb, var(--aiChat-primary-color) 90%, black);
    filter: brightness(0.9);
}

.aiChat-history-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    gap: 8px;
}

.aiChat-history-item:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}

.aiChat-history-item.active {
    background: color-mix(in srgb, var(--aiChat-primary-color) 10%, white);
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--aiChat-primary-color);
}

.aiChat-history-content {
    flex: 1;
    min-width: 0;
}

.aiChat-history-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.aiChat-history-date {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.aiChat-history-preview {
    font-size: 11px;
    color: #9ca3af;
}

.aiChat-history-delete {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0;
    flex-shrink: 0;
}

.aiChat-history-item:hover .aiChat-history-delete {
    opacity: 1;
}

.aiChat-history-delete:hover {
    background: #fef2f2;
    color: #dc2626;
}

.aiChat-history-delete i {
    font-size: 14px;
}

.aiChat-history-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
}

.aiChat-loading-spinner-small {
    width: 12px;
    height: 12px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid var(--aiChat-primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Messages */
.aiChat-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: white;
}

.aiChat-body::-webkit-scrollbar {
    width: 6px;
}

.aiChat-body::-webkit-scrollbar-track {
    background: transparent;
}

.aiChat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.aiChat-messages {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.aiChat-message-wrapper {
    display: flex;
    width: 100%;
    animation: fadeIn 0.3s ease-out;
}

.aiChat-message-wrapper.aiChat-message-user {
    justify-content: flex-end;
}

.aiChat-message-wrapper.aiChat-message-bot {
    justify-content: flex-start;
}

.aiChat-message-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 85%;
}

.aiChat-message-container.aiChat-message-container-user {
    flex-direction: row-reverse;
}

.aiChat-message-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.aiChat-message-content.aiChat-message-content-user {
    align-items: flex-end;
}

.aiChat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--aiChat-primary-background);
    color: var(--aiChat-primary-color);
}

.aiChat-avatar img {
    width: 18px;
    height: 18px;
}

.aiChat-message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
    max-width: 100%;
}

.aiChat-message-bubble.aiChat-message-bot {
    background: #F1F1F3;
    color: #333;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border-bottom-left-radius: 6px;
}

.aiChat-message-bubble.aiChat-message-bot.typing {
    padding: 16px;
}

.aiChat-message-bubble.aiChat-message-user {
    background: var(--aiChat-primary-color);
    color: white;
    border-bottom-right-radius: 6px;
}

.aiChat-message-time {
    font-size: 11px;
    color: #666;
    padding: 0 4px;
}

/* Question Suggestions */
.aiChat-suggestions {
    padding: 16px;
    background: white;
    animation: fadeInUp 0.5s ease-out;
}

.aiChat-suggestions-label {
    font-size: 13px;
    font-weight: 500;
    color: #666;
    margin-bottom: 12px;
    padding: 0 4px;
}

.aiChat-suggestions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

@media (max-width: 480px) {
    .aiChat-suggestions-grid {
        grid-template-columns: 1fr;
    }
}

.aiChat-suggestion-button {
    background: white;
    border: 1.5px solid #e5e7eb;
    color: #374151;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
    display: flex;
    align-items: center;
    min-height: 48px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.aiChat-suggestion-button:hover {
    border-color: var(--aiChat-primary-color);
    background: color-mix(in srgb, var(--aiChat-primary-color) 5%, white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.aiChat-suggestion-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.aiChat-suggestion-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(37, 99, 235, 0.02));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.aiChat-suggestion-button:hover::before {
    opacity: 1;
}

.aiChat-message-bot:not(.typing):not(.new-message) {
    animation: fadeInFromTop 0.6s ease-out;
}

.aiChat-message-bot.new-message {
    animation: fadeInNewMessage 0.4s ease-out;
}

.aiChat-html-message ol {
    margin-left: -20px !important;
}

.aiChat-html-message ul {
    margin-left: -20px !important;
}

/* Typing Indicator */
.aiChat-typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.aiChat-typing-indicator span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s ease-in-out infinite;
}

.aiChat-typing-indicator span:nth-child(1) {
    animation-delay: 0ms;
}

.aiChat-typing-indicator span:nth-child(2) {
    animation-delay: 200ms;
}

.aiChat-typing-indicator span:nth-child(3) {
    animation-delay: 400ms;
}

/* Footer */
.aiChat-footer {
    padding: 16px;
    background: #f7f7f7;
    border-top: 1px solid #e5e7eb;
}

.aiChat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 12px;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 24px;
    transition: border-color 0.2s ease;
}

.aiChat-input-wrapper:focus-within {
    border-color: var(--aiChat-primary-color);
    background: white;
}

.aiChat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 20px;
    max-height: 120px;
    overflow-y: auto;
    margin-bottom: auto;
    margin-top: auto;
    font-family: inherit;
}

.aiChat-input::placeholder {
    color: #9ca3af;
}

.aiChat-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.aiChat-send-button {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--aiChat-primary-color);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.aiChat-send-button:hover:not(:disabled) {
    background: color-mix(in srgb, var(--aiChat-primary-color) 90%, black);
    filter: brightness(0.9);
    transform: scale(1.05);
}

.aiChat-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.aiChat-send-button i {
    font-size: 16px;
    transform: rotate(-45deg);
    margin-left: -3px;
    margin-top: -1px;
    rotate: 45deg;
}

.aiChat-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animations */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInFromTop {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInNewMessage {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
