/**
 * DACH ChatBot Assistant - Microsoft Theme
 * Search-focused layout with results below
 */

/* Microsoft Fluent Design Variables */
:root {
    --ms-blue: #0078d4;
    --ms-blue-dark: #106ebe;
    --ms-gray-950: #323130;
    --ms-gray-900: #3b3a39;
    --ms-gray-800: #484644;
    --ms-gray-700: #605e5c;
    --ms-gray-600: #797775;
    --ms-gray-500: #8a8886;
    --ms-gray-400: #c8c6c4;
    --ms-gray-300: #e1dfdd;
    --ms-gray-200: #edebe9;
    --ms-gray-100: #f3f2f1;
    --ms-gray-50: #faf9f8;
    --ms-white: #ffffff;
    --ms-font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* Reset and Base */
.dach-chatbot-container * {
    box-sizing: border-box;
}

/* .dach-results-area {
    border: 0 !important;
} */

.dach-results-area,
[id^=dach-results-area] {
    border: none !important;
}

#chatbot-root .dach-results-area{
    border: none !important;
}


.dach-chatbot-container {
    max-width: 1000px;
    margin: 0 auto;
    /* padding: 20px; */
    font-family: var(--ms-font-family);
    background: var(--ms-gray-50);
    min-height: 80vh;
}

/* Header Section - Beautiful & Modern */
.dach-chatbot-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 30px;
    background: linear-gradient(135deg, #ea6666 0%, #a24b4b 100%);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    border: none;
    position: relative;
    overflow: hidden;
}

.dach-chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/><circle cx="10" cy="60" r="0.5" fill="white" opacity="0.1"/><circle cx="90" cy="40" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
}

.dach-chatbot-header::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

.dach-chatbot-title {
    font-size: 42px;
    font-weight: 700;
    color: var(--ms-white);
    margin: 0 0 16px 0;
    letter-spacing: -0.03em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.dach-chatbot-title::before {
    content: '🤖';
    font-size: 36px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.dach-chatbot-subtitle {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-weight: 400;
    line-height: 1.5;
    position: relative;
    z-index: 2;
    max-width: 600px;
    margin: 0 auto;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.dach-chatbot-subtitle::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    margin: 20px auto 0;
    border-radius: 2px;
}

/* Search Section - Top Priority */
.dach-search-section {
    background: var(--ms-white);
    padding: 30px;
    /* border-radius: 8px; */

    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--ms-gray-300);
    position: sticky;
    top: 20px;
    z-index: 100;
}

.dach-search-wrapper,
.cus_chatbot .dach-search-wrapper {
    display: flex !important;
    gap: 12px;
    align-items: flex-end;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    flex-direction: row !important;
    justify-content: flex-start !important;
}

.dach-input-wrapper,
.cus_chatbot .dach-input-wrapper {
    flex: 1 1 auto !important;
    min-width: 0; /* Allow flex item to shrink below content size */
    max-width: 100%;
    position: relative;
}

.dach-search-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ms-gray-700);
    margin-bottom: 8px;
}

.dach-chat-input,
textarea.dach-chat-input,
textarea#dach-chat-input,
[id^="dach-chat-input"] {
    width: 100% !important;
    min-height: 44px;
    max-height: 120px;
    padding: 12px 16px !important;
    border: none !important;
    border-radius: 4px;
    font-size: 16px !important;
    font-family: var(--ms-font-family);
    color: var(--ms-gray-950);
    background: var(--ms-white);
    outline: none !important;
    resize: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
    position: relative;
    overflow-y: hidden !important;
    overflow-x: hidden !important;
}

/* Hide scrollbar on textarea */
.dach-chat-input::-webkit-scrollbar,
textarea.dach-chat-input::-webkit-scrollbar,
textarea#dach-chat-input::-webkit-scrollbar,
[id^="dach-chat-input"]::-webkit-scrollbar {
    width: 0px !important;
    height: 0px !important;
    display: none !important;
    background: transparent !important;
}

.dach-chat-input,
textarea.dach-chat-input,
textarea#dach-chat-input,
[id^="dach-chat-input"] {
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE and Edge */
}

.dach-chat-input:focus {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

.dach-chat-input::placeholder {
    color: var(--ms-gray-600);
}

.dach-send-btn,
button.dach-send-btn,
button#dach-send-btn,
[id^="dach-send-btn"] {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;
    max-width: 46px !important;
    padding: 0 !important;
    background: #5237A0 !important; /* Purple background */
    color: var(--ms-white);
    border: none !important;
    border-radius: 50% !important; /* Circular */
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0 !important;
    flex-grow: 0 !important;
    box-sizing: border-box;
    position: relative !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    margin-bottom: 0 !important;
    font-size: 0 !important;
    white-space: nowrap !important;
}

.dach-send-btn::before,
button#dach-send-btn::before {
    display: none !important;
    content: none !important;
}

.dach-send-icon {
    width: 20px;
    height: 20px;
    display: block;
}

.dach-send-btn:hover:not(:disabled) {
    background: #3d2a7a !important; /* Darker purple on hover */
}

.dach-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #9CA3AF !important; /* Gray when disabled */
}

/* Welcome Suggestions */
.dach-welcome-suggestions {
    margin-top: 20px;
    text-align: center;
}

.dach-suggestions-label {
    font-size: 14px;
    color: var(--ms-gray-700);
    margin-bottom: 16px;
    font-weight: 600;
}

.dach-suggestion-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.dach-suggestion-btn {
    background: var(--ms-gray-100);
    color: var(--ms-gray-800);
    border: 1px solid var(--ms-gray-300);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.dach-suggestion-btn:hover {
    background: var(--ms-gray-200);
    border-color: var(--ms-gray-500);
}

/* Results Area - Use attribute selector for dynamic IDs */
.dach-results-area,
[id^="dach-results-area"] {
    /* background: var(--ms-white); */
    /* border-radius: 8px; */
    /* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); */
    /* border: 1px solid var(--ms-gray-300); */
    /* min-height: 200px;
    max-height: 395px; */
    border: 0 !important;
    overflow: hidden;
    flex: auto;
    display: flex;
    flex-direction: column;
    /* padding: 10px; */
    /* display: none; */
}

.has-content .chatBot-intro {
    display: none;
}

.chatBot-intro {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #fff;

    #header-title {
        font-weight: 500;
        margin-bottom: 5px;
    }

    #header-subtitle {
        font-size: 12px;
        opacity: 0.6;
        font-weight: 400;
    }

    .chatBot-logo img {
        width: 75px;
    }
}

/* Hide scrollbars in results area */
.dach-results-area::-webkit-scrollbar,
[id^="dach-results-area"]::-webkit-scrollbar {
    width: 0px !important;
    height: 0px !important;
    display: none !important;
    background: transparent !important;
}

.dach-results-area,
[id^="dach-results-area"] {
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE and Edge */
}

.dach-results-area.has-content {
    /* display: block; */
    display: flex;
}

.dach-results-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--ms-gray-300);
    background: var(--ms-gray-50);
}

.dach-results-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--ms-gray-950);
    margin: 0 0 4px 0;
}

.dach-results-subtitle {
    font-size: 14px;
    color: var(--ms-gray-700);
    margin: 0;
}

/* Conversation Area - Use attribute selector for dynamic IDs */
.dach-conversation-area,
[id^="dach-conversation-area"] {
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
}

/* Hide scrollbar completely */
.dach-conversation-area::-webkit-scrollbar,
[id^="dach-conversation-area"]::-webkit-scrollbar {
    width: 0px !important;
    height: 0px !important;
    display: none !important;
    background: transparent !important;
}

.dach-conversation-area,
[id^="dach-conversation-area"] {
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE and Edge */
}

/* Message Styles - Simplified */
.dach-message {
    margin-bottom: 24px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dach-user-message {
    text-align: right;
    align-self: flex-end;
    width: auto;
    max-width: 80%;
}

.dach-bot-message {
    text-align: left;
    align-self: flex-start;
    width: auto;
    max-width: 80%;
}

.dach-message-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--ms-gray-600);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: none;
}

.dach-message.dach-bot-message {
    position: relative;
    padding-left: 30px;

    &::before {
        content: '';
        position: absolute;
        bottom: 0;
        left: -4px;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background-image: url(/wp-content/uploads/2025/11/chatBot-assistant-icon.svg);
        background-size: contain;
    }
}

.dach-user-message .dach-message-header {
    color: var(--ms-blue);
}

.dach-bot-message .dach-message-header {
    color: var(--ms-gray-700);
}

.dach-message-content {
    display: inline-block;
    padding: 16px 20px;
    border-radius: 8px;
    line-height: 1.5;
    font-size: 15px;
    word-wrap: break-word;
}

.dach-user-message .dach-message-content {
    background: var(--ms-blue);
    color: var(--ms-white);
    text-align: left;
    margin-left: auto;
    margin-right: 0;
}

.dach-bot-message .dach-message-content {
    background: var(--ms-gray-100);
    color: #000000; /* Black text color */
    border: 0;
    border-radius: 16px 16px 16px 4px;
    margin-left: 0;
    margin-right: auto;
}

/* Typing Indicator */
.dach-typing-indicator {
    margin-bottom: 24px;
    text-align: left;
}

.dach-typing-content {
    display: inline-block;
    background: var(--ms-gray-100);
    border: 1px solid var(--ms-gray-300);
    border-radius: 8px;
    padding: 16px 20px;
    color: var(--ms-gray-700);
}

.dach-typing-dots {
    display: inline-flex;
    gap: 4px;
    margin-right: 8px;
}

.dach-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ms-blue);
    animation: typing 1.4s ease-in-out infinite;
}

.dach-typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.dach-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.dach-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        opacity: 0.3;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

/* Error Messages */
.dach-error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 16px 20px;
    border-radius: 8px;
    margin: 16px 0;
    font-size: 14px;
    font-weight: 500;
}

/* Follow-up Questions */
.dach-followup-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--ms-gray-300);
}

.dach-followup-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--ms-gray-700);
    margin-bottom: 12px;
}

.dach-followup-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dach-followup-btn {
    background: var(--ms-white);
    color: var(--ms-blue);
    border: 1px solid var(--ms-blue);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dach-followup-btn:hover {
    background: var(--ms-blue);
    color: var(--ms-white);
}

/* Quick Search Buttons - Use attribute selector to work with dynamic IDs */
[id^="dach-quick-search-container"],
.dach-quick-search-buttons,
.cus_chatbot [id^="dach-quick-search-container"],
.cus_chatbot #dach-quick-search-container {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 12px;
    margin-bottom: 30px !important;
    margin-top: 0 !important;
    padding: 20px;
    width: 100%;
    max-width: 600px;
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
    grid-template-columns: none !important;
}

@media (min-width: 768px) {
    [id^="dach-quick-search-container"],
    .dach-quick-search-buttons,
    .cus_chatbot [id^="dach-quick-search-container"],
    .cus_chatbot #dach-quick-search-container {
        max-width: 500px;
    }
}

.dach-quick-search-btn {
    padding: 8px 16px;
    border: 2px solid #5237A0;
    background: var(--ms-white);
    color: #5237A0;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--ms-font-family);
}

.dach-quick-search-btn:hover {
    background: #5237A0;
    color: var(--ms-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(82, 55, 160, 0.2);
}

.dach-quick-search-btn:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 768px) {
    .dach-chatbot-container {
        /* padding: 15px; */
        padding: 8px;
        display: flex;
        flex-direction: column;
    }

    .dach-chatbot-header {
        padding: 20px 15px;
        margin-bottom: 25px;
    }

    .dach-chatbot-title {
        font-size: 24px;
    }

    .dach-search-section {
        padding: 20px;
        position: static;
    }

    .dach-search-wrapper {
        flex-direction: column;
        gap: 16px;
    }

    .dach-send-btn {
        width: 46px !important;
        height: 46px !important;
        min-width: 46px !important;
        max-width: 46px !important;
    }

    .dach-message-content {
        max-width: 90%;
    }

    .dach-suggestion-buttons {
        flex-direction: column;
        align-items: center;
    }

    .dach-suggestion-btn {
        width: 100%;
        max-width: 300px;
        text-align: center;
    }

    [id^="dach-quick-search-container"],
    .dach-quick-search-buttons,
    .cus_chatbot [id^="dach-quick-search-container"],
    .cus_chatbot #dach-quick-search-container {
        gap: 8px;
        padding: 10px;
        margin-bottom: 20px !important;
        justify-content: center !important;
        display: flex !important;
    }

    .dach-quick-search-btn {
        font-size: 13px;
        padding: 8px 14px;
        flex: 0 0 auto;
        min-width: auto;
    }
    
    .dach-conversation-area {
        padding: 15px;
    }
}

/* High contrast support */
@media (prefers-contrast: high) {

    .dach-chat-input,
    .dach-send-btn,
    .dach-message-content {
        border-width: 2px;
    }
}

/* Print styles */
@media print {
    .dach-search-section {
        display: none;
    }

    .dach-chatbot-container {
        background: white;
    }
}