body {
    margin: 0;
    font-family: "HelveticaNeueLight", Helvetica, Arial, sans-serif;
}

a {
    font-weight: bold;
}

/* unvisited link */
a:link {
    color: blue;
}

/* visited link */
a:visited {
    color: #5f1767;
}

/* mouse over link */
a:hover {
    color: blue;
}

/* Chatbot Container */
#chatbot-container {
    position: absolute;
    width: calc(100% - 24px); /* 12px padding on each side */
    height: calc(100% - 24px); /* 12px padding on each side */
    display: block;
    z-index: 1000;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    left: 12px;
    top: 12px;
    min-width: 300px; /* Minimum width to prevent too narrow display */
}

.chat-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #FFF;
    min-height: 400px; /* Minimum height to prevent too short display */
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #005aaa;
    color: white;
    padding: 10px;
    font-size: 16px;
    flex-shrink: 0;
    padding-bottom: 10px;
    height: 60px;
}

.chat-body {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    background-color: #fff;
    display: flex;
    flex-direction: column;
}

.chat-footer {
    display: flex;
    padding: 4px;
    padding-left: 8px;
    background-color: #fff;
    flex-shrink: 0;
    box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.4);
    height: 60px;
    position: relative;
    min-height: 60px; /* Ensure minimum height */
}

.chat-input {
    flex: 1;
    border: 0px;
    border-radius: 4px;
    outline: none;
    font-size: 12pt;
    margin-left: 5px;
    margin-right: 5px;
    overflow-y: scroll !important;
    transition: all 0.3s ease;
    min-width: 100px; /* Ensure minimum width */
}

.chat-input::placeholder {
    color: #666;
    transition: all 0.3s ease;
    animation: none;
    font-size: 11pt; /* Reduced from default 12pt */
}

.chat-input:hover::placeholder {
    color: #005aaa;
    opacity: 1;
    animation: fadeInSuggestion 0.4s ease-out forwards;
    font-size: 11pt; /* Reduced from default 12pt */
}

/* Spezielle Animation für Tab-Navigation */
.chat-input.tab-changed::placeholder {
    animation: fadeInSuggestion 0.4s ease-out forwards;
    font-size: 11pt; /* Reduced from default 12pt */
}

.send-button {
    margin-left: 8px;
    padding: 8px 12px;
    background-color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    width: 50px;
    margin-right: 10px;
}

.message {
    margin: 8px 0;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: calc(80% - 20px); /* Adjusted to prevent overflow */
    word-wrap: break-word;
    position: relative;
    clear: both;
}

.message.user {
    background-color: #005aaa;
    color: white;
    align-self: flex-end;
    text-align: right;
    float: right;
    margin-right: 15px; /* Reduced from 30px */
    padding: 12px 16px;
    border-bottom-right-radius: 4px;
    max-width: calc(80% - 15px); /* Adjusted for smaller screens */
}

.message.bot {
    background-color: #f0f2f5;
    align-self: flex-start;
    text-align: left;
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);
    float: left;
    margin-left: 15px; /* Reduced from 30px */
    padding: 12px 16px 12px 60px;
    position: relative;
    width: calc(80% - 60px); /* Adjusted calculation */
    border-bottom-left-radius: 4px;
    min-width: 200px; /* Ensure minimum width for readability */
}

.message.bot::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 10px;
    width: 40px;
    height: 40px;
    background-image: url('https://referenzimplementierung.blob.core.windows.net/spardanuernberg/chatbot/pictures/woman.png');
    background-size: cover;
    border-radius: 50%;
    box-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.1),        /* Subtle drop shadow */
        0 0 0 2px rgba(255, 255, 255, 0.8),   /* White border */
        0 0 8px rgba(0, 90, 170, 0.15);       /* Brand color glow */
    background-color: white;                   /* White background */
}

.message .bot-name,
.message .user-name {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.message.user .user-name {
    color: rgba(255, 255, 255, 0.9);
}

.message.bot .bot-name {
    color: #555;
}

.message.bot .bot-content {
    position: relative;
    color: #333;
    line-height: 1.4;
}

.message.bot.has-feedback {
    padding-bottom: 0;
}

.message.bot p:first-child + ol {
    margin-top: 0;
    padding-top: 0;
}

.message.bot p {
    margin-bottom: 0; /* Removes the space between paragraph and following element */
    line-height: 1.6; /* Improves readability */
}

.message.bot p.bot-name {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9em;
    color: #555;
}

.message.bot .bot-content {
    font-weight: normal;
    font-style: normal;
    text-decoration: none;
    color: inherit;
    margin-top: 5px; /* Add some space between the name and content */
}

/* Ensure Markdown styles are applied only to the bot content */
.message.bot .bot-content h2,
.message.bot .bot-content h3,
.message.bot .bot-content ul,
.message.bot .bot-content ol,
.message.bot .bot-content p,
.message.bot .bot-content blockquote {
    text-align: left;
}

/* FOR Markdown Styles */
.message h2 {
    font-size: 1.5em;
    font-weight: bold;
    margin: 1em 0 0.5em;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.3em;
    display: block;
    text-align: left;
}

.message h3 {
    font-size: 1.3em;
    font-weight: bold;
    margin: 1em 0 0.5em;
    color: #444;
}

.message ul, .message ol {
    margin: 0;
    padding-left: 1.5em; 
}

.message li {
    margin: 0.2em 0; 
}

.message li > ul, .message li > ol {
    margin-top: 0; 
    margin-bottom: 0;
}

.message.bot .bot-content ul,
.message.bot .bot-content ol {
    margin-top: 0; 
    margin-bottom: 0;
    padding-left: 1.5em; 
}

.message table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    background-color: white;
}

.message th,
.message td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.message th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.message blockquote {
    border-left: 4px solid #ddd;
    margin: 1em 0;
    padding: 0.5em 1em;
    color: #666;
    background-color: #f9f9f9;
}

.message code {
    font-family: monospace;
    background-color: #f5f5f5;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
}

.message pre {
    background-color: #f5f5f5;
    padding: 1em;
    border-radius: 4px;
    overflow-x: auto;
    margin: 1em 0;
}

.message pre code {
    background-color: transparent;
    padding: 0;
}

.message.bot p,
.message.bot h2,
.message.bot h3,
.message.bot ul,
.message.bot ol,
.message.bot blockquote {
    text-align: left;
}

.message.bot > div > * + * {
    margin-top: 1em;
}

.refresh-button {
    padding: 8px 15px;
    background-color: transparent;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 0;
    font-size: 14px;
    transition: all 0.3s ease;
}

.refresh-button:hover:not(.disabled) {
    background-color: rgba(255, 255, 255, 0.2);
}

.refresh-button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.chat-header-buttons {
    display: flex;
    align-items: center;
    width: auto;
    float: right;
}

.chat-header-text {
    flex-grow: 1;
    width: auto;
    float: left;
    margin-top: 5px;
    font-weight: bold;
    display: flex;
    align-items: center;
}

#chat-header-title {
    margin-right: 10px;
}

.chat-header-text::after {
    content: "KI-Chatbot";
    background-color: rgb(223, 109, 43);
    color: white;
    font-size: 0.7em;
    padding: 3px 6px;
    border-radius: 5px;
    cursor: help;
    transition: content 0.3s ease;
}

.chat-header-text:hover::after {
    content: "KI-Chatbot | V.1.0";
}

#pic-send {
    width: 100%;
}

/* Table styles */
.table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.table th,
.table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.table th {
    background-color: #f5f5f5;
    font-weight: bold;
}

.feedback-button {
    padding: 8px 15px;
    background-color: transparent;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 10px;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.feedback-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.feedback-button.active {
    background-color: rgb(223, 109, 43);
}

/* Remove feedback button styles */
.feedback-controls {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease-in-out;
    margin: 0;
    padding: 0;
    width: 100%;
}

.message.bot .feedback-controls.visible {
    max-height: 200px;
    opacity: 1;
    transform: translateY(0);
    padding-top: 8px;
}

.feedback-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.feedback-emoji {
    font-size: 1.2em;
    cursor: pointer;
    padding: 6px;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(0, 90, 170, 0.1);
    border-radius: 50%;
    background: white;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-emoji:hover {
    background-color: #f0f7ff;
    border-color: #005aaa;
}

.feedback-emoji.selected {
    background-color: #005aaa;
    color: white;
    border-color: #005aaa;
}

.feedback-comment {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    font-size: 14px;
    resize: none;
    transition: all 0.2s ease;
    background-color: white;
    color: #333;
    margin-bottom: 12px;
}

.feedback-comment:focus {
    outline: none;
    border-color: #005aaa;
    box-shadow: 0 0 0 2px rgba(0, 90, 170, 0.1);
    border-width: 1px;
    border-style: solid;
    box-sizing: border-box;
}

.feedback-comment::placeholder {
    color: #666;
}

.feedback-submit {
    background-color: #005aaa;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    float: right;
    margin-bottom: 8px;
}

.feedback-submit:hover:not(:disabled) {
    background-color: #004a8a;
}

.feedback-submit:disabled {
    background-color: #87b9e5;
    cursor: not-allowed;
}

/* Hover hint */
.chat-footer::before {
    content: "Vorschläge: Tab drücken für weitere Fragen";
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 90, 170, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-input:hover + .send-button + .chat-footer::before {
    opacity: 1;
}

@keyframes fadeInSuggestion {
    0% {
        transform: translateY(3px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive adjustments for very small screens */
@media screen and (max-width: 480px) {
    .message.bot,
    .message.user {
        max-width: calc(90% - 15px);
        margin-left: 10px;
        margin-right: 10px;
    }

    .message.bot {
        width: calc(90% - 60px);
    }

    /* Keep KI-Chatbot label visible but make it smaller on very small screens */
    .chat-header-text::after {
        font-size: 0.7em;
        padding: 2px 6px;
        margin-left: 6px;
    }
}

/* Adjust the hover hint for small screens */
@media screen and (max-width: 600px) {
    .chat-footer::before {
        display: none; /* Hide the hover hint on small screens */
    }
}

/* Typing Indicator Styles */
.message.typing {
    padding: 12px 16px 12px 60px; /* Same padding as bot message */
    background-color: #f0f2f5; /* Same background */
    display: flex; /* Use flex for alignment */
    align-items: center; /* Vertically center items */
    min-height: 40px; /* Ensure minimum height */
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1);
    border-bottom-left-radius: 4px;
}

/* Avatar for typing indicator */
.message.typing::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%; /* Center vertically */
    transform: translateY(-50%); /* Adjust vertical centering */
    width: 40px;
    height: 40px;
    background-image: url('https://referenzimplementierung.blob.core.windows.net/spardanuernberg/chatbot/pictures/woman.png');
    background-size: cover;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1), 0 0 0 2px rgba(255,255,255,0.8), 0 0 8px rgba(0,90,170,0.15);
    background-color: white;
}

.message.typing .bot-name {
    margin-right: 8px; /* Space between name and dots */
    color: #555;
    font-size: 0.9em;
    font-weight: normal; /* Lighter weight for "tippt" */
}

.typing-dots {
    display: flex;
    align-items: center;
}

.typing-dots .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #a0a0a0; /* Dot color */
    margin: 0 3px;
    animation: typing-bounce 1.4s infinite ease-in-out both;
}

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

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

/* Typing animation */
@keyframes typing-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1.0);
    }
}

.message.error {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 12px;
    margin: 8px 0;
    border-radius: 4px;
    font-size: 14px;
}

.message.error::before {
    content: "⚠️";
    margin-right: 8px;
}