/* Latinconnect Theme by Antons Filipovs */

#ai-chat-container {
    /*  border: 1px solid #ddd; */
    font: 16px / 24px Light;
    letter-spacing: 0.25px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    /*  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; */
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Messages Only Container */
.ai-chat-messages-only {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow-y: auto;
    padding: 5px;
    background: #f8f9fa;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    /*     box-shadow: 0 2px 10px rgba(0,0,0,0.1); */
}

.ai-chat-messages-only .ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 5px;
}

/* Input Only Container */
.ai-chat-input-only {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    /*background: #fff;*/
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.ai-chat-header-simple {
    display: flex;
    justify-content: flex-end;
    padding: 10px 15px;
    /*background: #f8f9fa;*/
    border-bottom: 1px solid #ddd;
}

.ai-chat-new-simple {
    background: rgba(0, 124, 186, 0.1);
    color: #007cba;
    border: 1px solid #007cba;
    padding: 5px 10px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.ai-chat-new-simple:hover {
    background: rgba(0, 124, 186, 0.2);
    transform: scale(1.05);
}

#ai-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 10px;
    /*  background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    border-bottom: 1px solid #004466; */
    color: #fff;
    background-color: #ed7d00;
}

#ai-chat-title {
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    column-gap: 8px;
}

#ai-chat-new {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

#ai-chat-new:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 5px;
    background: #fff;
    min-height: 200px;
    scroll-behavior: smooth;
    /* Smooth scrolling */
}

.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.chat-message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 13px;
    max-width: 100%;
    word-wrap: break-word;
    line-height: 1.4;
    position: relative;
    animation: fadeIn 0.3s ease-in;
}

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

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

.user-message {
    /*     background: linear-gradient(135deg, #007cba 0%, #005a87 100%); */
    background-color: #eaeeef;
    color: #322c2e;
    margin-left: auto;
    text-align: right;
    border-top-right-radius: 0;
}

.ai-message {
    background: #e9ecef;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border: 1px solid #dee2e6;
}

.ai-message::before {
    content: '🤖';
    position: absolute;
    left: -10px;
    top: -5px;
    font-size: 12px;
    background: #fff;
    padding: 2px 4px;
    border-radius: 50%;
    border: 1px solid #dee2e6;
}

/* Typing indicator for content being typed */
.typing-content::after {
    content: '▌';
    animation: blink 0.7s infinite;
    margin-left: 2px;
}

@keyframes blink {

    0%,
    49% {
        opacity: 1;
    }

    50%,
    100% {
        opacity: 0;
    }
}

/* Markdown styling within AI messages */
.ai-message h1,
.ai-message h2,
.ai-message h3 {
    margin: 0.5em 0 0.3em 0;
    line-height: 1.3;
}

.ai-message h1 {
    font-size: 1.4em;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 0.2em;
}

.ai-message h2 {
    font-size: 1.2em;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.2em;
}

.ai-message h3 {
    font-size: 1.1em;
}

.ai-message p {
    margin: 0.5em 0;
    line-height: 1.6;
}

.ai-message p:first-child {
    margin-top: 0;
}

.ai-message p:last-child {
    margin-bottom: 0;
}

.ai-message strong {
    font-weight: 600;
    color: #000;
}

.ai-message em {
    font-style: italic;
}

.ai-message code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #c7254e;
    border: 1px solid #e1e4e8;
}

.ai-message pre {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.8em 0;
    border: 1px solid #444;
}

.ai-message pre code {
    background: none;
    color: inherit;
    padding: 0;
    border: none;
    font-size: 0.85em;
    line-height: 1.5;
}

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

.ai-message li {
    margin: 0.3em 0;
    line-height: 1.5;
}

.ai-message a {
    color: #007cba;
    text-decoration: underline;
}

.ai-message a:hover {
    color: #005a87;
}

.ai-message blockquote {
    border-left: 4px solid #007cba;
    padding-left: 1em;
    margin: 0.8em 0;
    color: #666;
    font-style: italic;
}

.ai-message table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.8em 0;
}

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

.ai-message th {
    background: #f8f9fa;
    font-weight: 600;
}

.ai-chat-input-container {
    display: flex;
    padding: 0px;
    /*background: #fff;*/
    /*gap: 10px;*/
    /*     border: 1px solid #ddd; */
    border-radius: 8px;
    margin-top: 20px;
}

.ai-chat-input {
    flex: 1;
    padding: 15px 15px;
    border: 1px solid #ddd;
    border-radius: 8px 0 0 8px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.2s ease;
    resize: none;
}

.ai-chat-input:focus {
    border-color: #ed7d00;
    /*     box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2); */
}

.ai-chat-send {
    background: #ed7d00;
    color: white;
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 50px;
}

.ai-chat-send:hover:not(:disabled) {
    /*     background: linear-gradient(135deg, #005a87 0%, #004466 100%); */
    /*     transform: translateY(-1px); */
    /*     box-shadow: 0 4px 8px rgba(0, 124, 186, 0.3); */
    background: #aebb58;
}

.ai-chat-send:active:not(:disabled) {
    transform: translateY(0);
}

.ai-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ai-chat-loading {
    padding: 10px 20px;
    text-align: center;
    font-style: italic;
    color: #666;
    background: #f8f9fa;
    border-top: 1px solid #ddd;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Empty state */
.ai-chat-messages:empty::before {
    /* content: "👋 Hello! How can I help you today?"; */
    content: 'Ich bin Ihr persönlicher Reiseassistent. Wie kann ich weiterhelfen?';
    display: block;
    text-align: center;
    color: #998778;
    padding: 40px 20px;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    margin-bottom: 15px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {

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

    30% {
        transform: translateY(-10px);
    }
}

/* Responsive design */
@media (max-width: 600px) {
    .chat-message {
        max-width: 95%;
        font-size: 14px;
    }

    .ai-chat-input-container {
        padding: 10px;
    }

    .ai-chat-send {
        padding: 12px 16px;
        min-width: 50px;
    }

    .ai-chat-messages {
        padding: 15px;
    }
}

@media (max-width: 400px) {
    .chat-message {
        max-width: 100%;
        font-size: 13px;
    }

    .ai-chat-input {
        font-size: 16px;
        /* Prevents zoom on iOS */
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {

    #ai-chat-container,
    .ai-chat-container,
    .ai-chat-messages-only,
    .ai-chat-input-only {
        /*background: #2c2c2c;*/
        /*border-color: #444;*/
    }

    .ai-chat-messages {
        /*background: #1a1a1a;*/
    }

    .ai-message {
        /*background: #333;*/
        /*color: #e0e0e0;*/
        /*border-color: #555;*/
    }

    .ai-chat-input-container {
        /*background: #2c2c2c;*/
        /*border-color: #444;*/
    }

    .ai-chat-input {
        /*background: #333;*/
        /*color: #e0e0e0;*/
        /*border-color: #555;*/
    }

    .ai-chat-loading {
        /*background: #1a1a1a;*/
        /*color: #ccc;*/
        /*border-color: #444;*/
    }

    .ai-chat-header-simple {
        /*background: #2c2c2c;*/
        /*border-color: #444;*/
    }

    .ai-chat-new-simple {
        background: rgba(0, 124, 186, 0.2);
        border-color: #007cba;
    }
}

.ai-chat-send::after {
    display: inline-block;
    width: 19px;
    height: 12px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='21px' height='14px' viewBox='0 0 21 14' version='1.1'%3E%3Ctitle%3Earrow-right%3C/title%3E%3Cg id='Page-1' stroke='none' stroke-width='1' fill='none' fill-rule='evenodd' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg id='24-10730_LC_Home_Dtp' transform='translate(-1243, -638)' stroke='%23998778' stroke-width='2'%3E%3Cg id='AI-Input' transform='translate(585, 619)'%3E%3Cg id='arrow-right' transform='translate(659, 20)'%3E%3Cline x1='0' y1='6' x2='16' y2='6' id='Shape'/%3E%3Cpolyline id='Shape' points='13 0 19 6 13 12'/%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-position: center center;
    background-size: cover;
}

.ai-chat-input-container {
    padding: 0 !important;
}

.ai-message-overflow {
    max-height: 400px;
    overflow-y: auto;
}

.main-content-chat {
    overflow-y: auto;
    width: 100%;
}

.ai-side-input>.ai-chat-header-simple {
    display: none;
}

/* Tiles styling */
.ai-tiles-container {
    margin-top: 10px;
    margin-bottom: 15px;
}

.ai-tile {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.ai-tile:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-tile-header {
    padding: 12px 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    user-select: none;
    border-bottom: 1px solid #dee2e6;
    transition: background 0.2s ease;
}

.ai-tile-header:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
}

.ai-tile-icon {
    font-size: 12px;
    color: #ed7d00;
    transition: transform 0.2s ease;
    min-width: 12px;
}

.ai-tile-title {
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.ai-tile-content {
    padding: 15px;
    background: #fff;
    color: #333;
    line-height: 1.6;
}

.ai-tile-content p {
    margin: 0.5em 0;
}

.ai-tile-content p:first-child {
    margin-top: 0;
}

.ai-tile-content p:last-child {
    margin-bottom: 0;
}

.ai-tile-content h3 {
    margin: 1em 0 0.5em 0;
    font-size: 1.1em;
    color: #ed7d00;
}

.ai-tile-content h3:first-child {
    margin-top: 0;
}

.ai-tile-content ul,
.ai-tile-content ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.ai-tile-content li {
    margin: 0.3em 0;
}

/* Responsive tile styling */
@media (max-width: 600px) {
    .ai-tile-header {
        padding: 10px 12px;
    }

    .ai-tile-title {
        font-size: 13px;
    }

    .ai-tile-content {
        padding: 12px;
        font-size: 14px;
    }
}

/* Call-to-Action buttons (Navigation Links) */
.ai-ctas-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    /*padding: 10px 0;*/
    animation: slideUp 0.3s ease-out;
}

/* Dedicated CTA section */
.ai-chat-ctas-only {
    min-height: 40px;
}

.ai-chat-ctas-only .ai-ctas-container {
    margin: 0;
    padding: 10px;
}

.ai-ctas-position-above .ai-ctas-container {
    margin-bottom: 15px;
}

.ai-ctas-position-below .ai-ctas-container {
    margin-top: 15px;
}

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

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

.ai-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px !important;
    padding: 8px;
    background: #f8f9fa;
    border: 1px solid #322C2E;
    border-radius: 5px;
    color: #322C2E !important;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
}

.ai-cta:hover {
    background: #ed7d00;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(237, 125, 0, 0.2);
}

.ai-cta:active {
    transform: translateY(0);
}

.ai-cta-icon {
    font-size: 16px;
}

.ai-cta-text {
    line-height: 1;
}

/* Responsive CTA styling */
@media (max-width: 600px) {
    .ai-ctas-container {
        gap: 6px;
    }

    .ai-cta {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* Redirect notice */
.ai-redirect-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin: 15px 0;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-left: 4px solid #2196f3;
    border-radius: 6px;
    color: #1565c0;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

.ai-redirect-icon {
    font-size: 18px;
    animation: bounce 1s infinite;
}

.ai-redirect-text {
    font-size: 14px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

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

@keyframes bounce {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(5px);
    }
}

/* Responsive CTA styling */
@media (max-width: 600px) {
    .ai-ctas-container {
        flex-direction: column;
    }

    .ai-cta {
        width: 100%;
        min-width: auto;
    }
}