/* Styles for the share page - Enhanced version with smoother animations */
:root {
    --primary-color: #bcadee;
    --primary-dark: #9a8dce;
    --user-message-bg: #e0e7ff;
    --assistant-message-bg: #d1e7dd;
    --tool-call-bg: #fdf2e9;
    --tool-name-color: #c65102;
    --gradient-start: #3d1c63;
    --gradient-end: #822629;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow-color-hover: rgba(0, 0, 0, 0.2);
    --animation-speed: 0.3s;
    --code-bg: #f6f8fa;
    --code-color: #24292e;
    --code-inline-bg: rgba(175, 184, 193, 0.2);
    --code-inline-color: #24292e;
    --blockquote-border: #dfe2e5;
    --blockquote-color: #6a737d;
    --table-border: #dfe2e5;
    --table-header-bg: #f6f8fa;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f5f5f7;
    color: #333;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    transition: background-color 0.5s ease;
}

.logo {
    display: block;
    margin: 20px;
    width: 150px;
    position: fixed;
    top: 0;
    left: 0;
    transition: transform var(--animation-speed) cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 4px 6px var(--shadow-color));
    will-change: transform;
    z-index: 100;
}

.logo:hover {
    transform: scale(1.05);
}

.chat-container {
    max-width: 800px;
    margin: 120px auto 50px;
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 30px var(--shadow-color);
    position: relative;
    transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1), box-shadow 0.8s ease;
    border: 1px solid rgba(188, 173, 238, 0.2);
    animation: fadeIn 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
    will-change: transform;
    transform: translate(0, 0);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 25px 20px;
    text-align: center;
    font-size: 1.8rem;
    color: #fff;
    position: relative;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s ease;
    border-radius: 16px 16px 0 0;
}

.created-on {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 8px;
    text-align: center;
    font-weight: 400;
    transition: opacity 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.chat-messages {
    padding: 30px;
    scroll-behavior: smooth;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Custom scrollbar for Webkit browsers - now for the whole body */
body::-webkit-scrollbar {
    width: 8px;
}

body::-webkit-scrollbar-track {
    background: #f0f0f0;
}

body::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 10px;
}

/* Scrollbar for Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) #f0f0f0;
}

.message {
    margin-bottom: 20px;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    position: relative;
    will-change: transform, opacity;
    max-width: 75%; /* Limit message width */
}

.message.user {
    background-color: var(--user-message-bg);
    margin-left: 30px;
    margin-right: 10px;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    margin-left: auto; /* Add this to align to the right */
}

.message.user::before {
    content: "User";
    position: absolute;
    top: -20px;
    right: 0;
    left: auto;
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.message.assistant {
    background-color: var(--assistant-message-bg);
    margin-right: 30px;
    margin-left: 10px;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.assistant::before {
    content: "Geneplore AI";
    position: absolute;
    top: -20px;
    left: 0;
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.message.system {
    background-color: #f0f0f0;
    margin-left: auto;
    margin-right: auto;
    align-self: center;
    max-width: 85%;
    text-align: center;
    border-radius: 12px;
}

.message.system::before {
    content: "System";
    position: absolute;
    top: -20px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

/* Tool call message styling */
.tool-call-message {
    background-color: var(--tool-call-bg);
    border-left: 3px solid var(--tool-name-color);
    padding: 8px 12px;
    border-radius: 6px;
}

.tool-call-header {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.tool-icon {
    font-size: 1.2rem;
}

.tool-name {
    color: var(--tool-name-color);
}

.tool-description {
    font-size: 0.95rem;
    color: #444;
    line-height: 1.5;
}

/* Message content styles */
.message-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Markdown styling */
.markdown-content {
    line-height: 1.6;
}

.markdown-content p {
    margin: 0 0 16px 0;
}

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

.markdown-content h1, 
.markdown-content h2, 
.markdown-content h3, 
.markdown-content h4, 
.markdown-content h5, 
.markdown-content h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-content h1 {
    font-size: 1.5em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--blockquote-border);
}

.markdown-content h2 {
    font-size: 1.3em;
    padding-bottom: 0.3em;
    border-bottom: 1px solid var(--blockquote-border);
}

.markdown-content h3 {
    font-size: 1.2em;
}

.markdown-content h4 {
    font-size: 1.1em;
}

.markdown-content ul, 
.markdown-content ol {
    margin-top: 0;
    margin-bottom: 16px;
    padding-left: 2em;
}

.markdown-content ul ul, 
.markdown-content ul ol, 
.markdown-content ol ul, 
.markdown-content ol ol {
    margin-top: 0;
    margin-bottom: 0;
}

.markdown-content li {
    margin-bottom: 4px;
}

.markdown-content a {
    color: var(--primary-dark);
    text-decoration: none;
    transition: color 0.2s ease;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content blockquote {
    padding: 0 1em;
    color: var(--blockquote-color);
    border-left: 4px solid var(--blockquote-border);
    margin: 0 0 16px 0;
}

.markdown-content pre {
    background-color: var(--code-bg);
    border-radius: 6px;
    padding: 16px;
    overflow: auto;
    margin: 0 0 16px 0;
}

.markdown-content code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    padding: 0.2em 0.4em;
    margin: 0;
    font-size: 85%;
    background-color: var(--code-inline-bg);
    color: var(--code-inline-color);
    border-radius: 3px;
}

.markdown-content pre code {
    background-color: transparent;
    padding: 0;
    margin: 0;
    font-size: 90%;
    color: var(--code-color);
    word-break: normal;
    white-space: pre;
    overflow: visible;
}

.markdown-content img {
    max-width: 100%;
    box-sizing: border-box;
    border-radius: 6px;
}

.markdown-content hr {
    height: 0.25em;
    padding: 0;
    margin: 24px 0;
    background-color: var(--blockquote-border);
    border: 0;
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 0 0 16px 0;
    display: block;
    overflow: auto;
}

.markdown-content table th {
    font-weight: 600;
    background-color: var(--table-header-bg);
}

.markdown-content table th,
.markdown-content table td {
    padding: 6px 13px;
    border: 1px solid var(--table-border);
}

.markdown-content table tr {
    background-color: #fff;
    border-top: 1px solid var(--table-border);
}

.markdown-content table tr:nth-child(2n) {
    background-color: #f8f8f8;
}

.content-text {
    white-space: pre-wrap;
    line-height: 1.6;
}

.content-image-container {
    margin-top: 8px;
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
}

.content-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

.content-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Fullscreen image view */
.fullscreen-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    cursor: zoom-out;
}

.fullscreen-overlay {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.fullscreen-overlay img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.close-button {
    position: absolute;
    top: -40px;
    right: -40px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 10px;
    opacity: 0.8;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.close-button:hover {
    opacity: 1;
    transform: scale(1.1);
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.try-now-btn {
    display: block;
    width: fit-content;
    margin: 30px auto;
    background: linear-gradient(45deg, var(--gradient-start), var(--gradient-end));
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
    padding: 14px 30px;
    border-radius: 30px;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 12px rgba(61, 28, 99, 0.3);
    position: relative;
    overflow: hidden;
    z-index: 1;
    will-change: transform, box-shadow;
}

.try-now-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--gradient-end), var(--gradient-start));
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
    z-index: -1;
}

.try-now-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(61, 28, 99, 0.4);
}

.try-now-btn:hover::before {
    opacity: 1;
}

.try-now-btn:active {
    transform: translateY(-2px);
}

/* Loading animation */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    height: 100px;
}

.loading-dots {
    display: flex;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    margin: 0 5px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: loadingDot 1.4s infinite cubic-bezier(0.455, 0.03, 0.515, 0.955) both;
}

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

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

@keyframes loadingDot {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Responsive design */
@media screen and (max-width: 768px) {
    .chat-container {
        margin: 100px 20px 40px;
        width: calc(100% - 40px);
        border-radius: 12px;
    }
    
    .logo {
        width: 120px;
    }
    
    .chat-header {
        padding: 20px;
        font-size: 1.5rem;
    }
    
    .chat-messages {
        padding: 20px;
    }
    
    .message.user {
        margin-right: 15px;
        margin-left: auto; /* Keep right alignment on mobile */
    }
    
    .message.assistant {
        margin-right: 15px;
    }
    
    .content-image {
        max-height: 300px;
    }
    
    .close-button {
        top: -30px;
        right: -10px;
    }
}

@media screen and (max-width: 480px) {
    .chat-container {
        margin-top: 80px;
    }
    
    .logo {
        width: 100px;
        margin: 15px;
    }
    
    .chat-header {
        font-size: 1.3rem;
        padding: 15px;
    }
    
    .try-now-btn {
        font-size: 1rem;
        padding: 12px 24px;
    }
    
    .content-image {
        max-height: 250px;
    }
}