/* TripSaver AI Assistant Chat Interface Styles */

/* Card wrapper for landing page integration */
.tsai-chat-card-wrapper {
    max-width: 900px;
    margin: 40px auto;
    padding: 0;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

#tsai-chat-container {
    display: flex;
    flex-direction: column;
    height: 600px;
    max-height: 600px;
    max-width: 100%;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: #ffffff;
}

.tsai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 40px 20px 20px 20px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 0;
}

.tsai-chat-messages::-webkit-scrollbar {
    width: 8px;
}

.tsai-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.tsai-chat-messages::-webkit-scrollbar-thumb {
    background: #ED8F0C;
    border-radius: 4px;
}

.tsai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #E47B02;
}

.tsai-welcome-message {
    text-align: center;
    max-width: 768px;
    width: 100%;
    padding: 40px 20px;
}

.tsai-welcome-title {
    font-size: 32px;
    font-weight: 600;
    color: #333;
    margin: 0 0 40px 0;
    line-height: 1.3;
}

.tsai-example-questions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
}

.tsai-example-btn {
    width: 100%;
    max-width: 600px;
    padding: 14px 20px;
    background: #ffffff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.2s ease;
    font-family: inherit;
    text-align: left;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tsai-example-btn:hover {
    background: #f8f9fa;
    border-color: #ED8F0C;
    box-shadow: 0 2px 6px rgba(237, 143, 12, 0.15);
    transform: translateY(-1px);
}

.tsai-message-wrapper {
    width: 100%;
    max-width: 768px;
    display: flex;
    justify-content: flex-start;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

.tsai-message-wrapper.tsai-message-user-wrapper {
    justify-content: flex-end;
}

.tsai-message {
    display: flex;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}


@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tsai-message-user {
    justify-content: flex-end;
}

.tsai-message-assistant {
    justify-content: flex-start;
}

.tsai-message-content {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.tsai-message-user .tsai-message-content {
    background: #ED8F0C;
    color: white;
    border-bottom-right-radius: 4px;
}

.tsai-message-assistant .tsai-message-content {
    background: #f5f5f5;
    color: #333;
    border-bottom-left-radius: 4px;
}

.tsai-message-content p {
    margin: 0 0 10px 0;
}

.tsai-message-content p:last-child {
    margin-bottom: 0;
}

.tsai-message-content ul,
.tsai-message-content ol {
    margin: 10px 0 10px 20px;
    padding-left: 20px;
}

.tsai-message-content li {
    margin: 5px 0;
    line-height: 1.6;
}

.tsai-message-content a {
    color: #ED8F0C;
    text-decoration: underline;
    font-weight: 500;
}

.tsai-message-content a:hover {
    color: #E47B02;
}

.tsai-message-content strong {
    font-weight: 600;
    color: #333;
}

.tsai-message-content em {
    font-style: italic;
}

.tsai-message-content h1,
.tsai-message-content h2,
.tsai-message-content h3 {
    margin: 15px 0 10px 0;
    font-weight: 600;
    line-height: 1.3;
}

.tsai-message-content h1 {
    font-size: 1.5em;
}

.tsai-message-content h2 {
    font-size: 1.3em;
}

.tsai-message-content h3 {
    font-size: 1.1em;
}

.tsai-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin: 0 10px;
    flex-shrink: 0;
}

.tsai-logo-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.tsai-message-user .tsai-message-avatar {
    order: 2;
}

.tsai-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-style: italic;
    padding: 0;
    margin: 0;
}

#tsai-loading-message .tsai-message-content {
    padding: 8px 14px;
}

.tsai-loading-dots {
    display: inline-flex;
    gap: 4px;
}

.tsai-loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ED8F0C;
    animation: bounce 1.4s infinite ease-in-out both;
}

.tsai-loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.tsai-loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.tsai-chat-input-container {
    background: #ffffff;
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    position: relative;
    width: 100%;
    margin: 0;
    flex-shrink: 0;
}

.tsai-scroll-indicator {
    position: absolute;
    bottom: 100px;
    right: 48px;
    width: 40px;
    height: 40px;
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 100;
    transition: all 0.3s ease;
    animation: bounce-indicator 2s infinite;
}

.tsai-scroll-indicator:hover {
    background: #F5F5F5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: scale(1.05);
}

.tsai-scroll-indicator svg {
    width: 20px;
    height: 20px;
}

.tsai-scroll-indicator svg path {
    fill: #1D1D1F;
}

.tsai-scroll-indicator.show {
    display: flex;
}

@media (max-width: 767px) {
    .tsai-scroll-indicator {
        bottom: 80px;
        right: 16px;
    }
}

@keyframes bounce-indicator {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

.tsai-error-message {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #c62828;
}

.tsai-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 8px 8px 8px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tsai-input-wrapper:focus-within {
    border-color: #ED8F0C;
    box-shadow: 0 2px 12px rgba(237, 143, 12, 0.15);
}

.tsai-question-input {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: transparent;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    outline: none;
    min-height: 24px;
    max-height: 200px;
    line-height: 24px;
}

.tsai-question-input::placeholder {
    color: #999;
}

.tsai-question-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.tsai-send-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    background: #ED8F0C;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tsai-send-btn:hover:not(:disabled) {
    background: #E47B02;
    transform: scale(1.05);
}

.tsai-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.tsai-send-btn svg {
    width: 18px;
    height: 18px;
}

/* Rate limit message */
.tsai-rate-limit-message {
    background: #fff3cd;
    color: #856404;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #ffc107;
}

.tsai-rate-limit-message p {
    margin: 0 0 10px 0;
}

.tsai-rate-limit-message ul {
    margin: 10px 0 0 20px;
    padding: 0;
}

.tsai-rate-limit-message a {
    color: #667eea;
    text-decoration: underline;
}

/* Daily Limit Popup */
.tsai-limit-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tsai-limit-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.tsai-limit-popup-content {
    position: relative;
    background: #ffffff;
    border-radius: 16px;
    padding: 32px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 10001;
    animation: popupFadeIn 0.3s ease;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.tsai-limit-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: color 0.2s ease;
    border-radius: 50%;
}

.tsai-limit-popup-close:hover {
    color: #333;
    background: #f5f5f5;
}

.tsai-limit-popup-content h3 {
    margin: 0 0 16px 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.tsai-limit-popup-content p {
    margin: 0 0 24px 0;
    font-size: 16px;
    line-height: 1.6;
    color: #666;
}

.tsai-limit-popup-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.tsai-popup-contact-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #ED8F0C;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tsai-popup-contact-btn:hover {
    background: #E47B02;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(237, 143, 12, 0.3);
}

/* Limit Banner (small message over prompt bar) */
.tsai-limit-banner {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 14px;
    color: #856404;
    text-align: center;
}

.tsai-limit-banner a {
    color: #ED8F0C;
    text-decoration: underline;
    font-weight: 500;
}

.tsai-limit-banner a:hover {
    color: #E47B02;
}

@media (max-width: 480px) {
    .tsai-limit-popup-content {
        padding: 24px 20px;
        max-width: 95%;
    }
    
    .tsai-limit-popup-content h3 {
        font-size: 20px;
        margin-bottom: 12px;
    }
    
    .tsai-limit-popup-content p {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .tsai-popup-contact-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .tsai-chat-card-wrapper {
        margin: 20px 12px;
        border-radius: 12px;
        width: calc(100% - 24px);
    }
    
    #tsai-chat-container {
        height: 600px;
        max-height: 600px;
    }
    
    .tsai-chat-messages {
        padding: 20px 16px;
    }
    
    .tsai-welcome-title {
        font-size: 28px;
        margin-bottom: 30px;
    }
    
    .tsai-message {
        max-width: 90%;
    }
    
    .tsai-chat-input-container {
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .tsai-chat-card-wrapper {
        margin: 16px 8px;
        border-radius: 12px;
        width: calc(100% - 16px);
    }
    
    #tsai-chat-container {
        height: 550px;
        max-height: 550px;
    }
    
    .tsai-welcome-title {
        font-size: 24px;
        margin-bottom: 24px;
    }
    
    .tsai-example-btn {
        font-size: 14px;
        padding: 12px 16px;
    }
    
    .tsai-message {
        max-width: 95%;
    }
    
    .tsai-message-content {
        font-size: 14px;
        padding: 10px 14px;
    }
}

