/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* DeepSeek Chat - Base Styles */

:root {
    --primaryColor: #0089cf;
    --secondColor: #ffb606;
    --listBackground: #fff;
    --fixed-width: 620px;
    --clr-primary-5: #49a6e9;
    --clr-primary-7: #8bcbf9;
    --radius: 0.25rem;
    --transition: all 0.3s linear;
    --dark-shadow: 0 5px 15px rgba(0,0,0,0.2);
    --light-shadow: 0 5px 15px rgba(0,0,0,0.1);
    --font-color: #2b394a;
    
    /* Legacy support */
    --primary-color: var(--primaryColor);
    --secondary-color: var(--secondColor);
    
    /* Button sizes */
    --btn-padding-y: 0.375rem;
    --btn-padding-x: 0.75rem;
    --btn-font-size: 0.875rem;
    
    /* Typography */
    --font-family-sans-serif: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 
                              Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-bold: 600;
    --line-height-base: 1.5;
}

body {
    font-family: var(--font-family-sans-serif);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-base);
    background-color: var(--listBackground);
    color: var(--font-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    max-width: 100%; /* Ensure content stays within viewport */
}

h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
}

main {
    flex: 1;
}

/* Markdown styling improvements */
.message-content p {
    margin-bottom: 0.75rem;
}

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

.message-content pre {
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid rgba(0,0,0,0.05);
}

/* Code block container */
.code-block-container {
    position: relative;
    margin: 1rem 0;
}

/* Improve code blocks in assistant messages */
.message.assistant .message-content pre {
    background: rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.08);
    position: relative;
    padding-top: 2rem;
}

/* Improve code blocks in user messages */
.message.user .message-content pre {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    position: relative;
    padding-top: 2rem;
}

/* Code language indicator */
.code-language {
    position: absolute;
    top: 0;
    left: 0;
    background: rgba(0,0,0,0.05);
    color: #6c757d;
    padding: 2px 8px;
    font-size: 0.75rem;
    border-bottom-right-radius: 4px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    z-index: 2;
}

.message.user .code-language {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
}

/* Copy button */
.copy-button {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0,0,0,0.05);
    border: none;
    padding: 2px 8px;
    font-size: 0.75rem;
    color: #6c757d;
    cursor: pointer;
    border-bottom-left-radius: 4px;
    transition: all 0.2s;
    z-index: 2;
}

.message.user .copy-button {
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
}

.copy-button:hover {
    background: rgba(0,0,0,0.1);
}

.message.user .copy-button:hover {
    background: rgba(255,255,255,0.25);
}

.copy-button.copied {
    color: var(--primary-color);
}

.message-content code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    border-radius: 3px;
}

/* Inline code styling */
.message-content :not(pre) > code {
    background: rgba(0,0,0,0.05);
    color: #e83e8c;
}

.message.user .message-content :not(pre) > code {
    background: rgba(255,255,255,0.15);
    color: #ffffff;
}

.message-content ul, .message-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.message-content li {
    margin-bottom: 0.5rem;
}

.message-content blockquote {
    border-left: 4px solid rgba(0,0,0,0.1);
    padding-left: 1rem;
    margin-left: 0;
    color: #6c757d;
}

.message.user .message-content blockquote {
    border-left-color: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.9);
}

.message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: var(--font-weight-bold);
    font-size: 1.25rem;
}

.chat-interface {
    height: 70vh;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Responsive Styles */
@media (max-width: 768px) {
    :root {
        --fixed-width: 100%;
        --btn-padding-x: 0.5rem;
        --btn-font-size: 0.825rem;
    }

    .navbar-brand {
        font-size: 1.125rem;
    }

    .chat-interface {
        height: 60vh;
    }
}

@media (max-width: 576px) {
    :root {
        --btn-padding-x: 0.25rem;
        --btn-font-size: 0.75rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    .navbar-brand {
        font-size: 1rem;
    }

    .chat-interface {
        height: 50vh;
    }
}

/* Global Responsive Styles */

/* Images */
img {
    max-width: 100%;
    height: auto;
}

/* Tables */
table {
    width: 100%;
    overflow-x: auto;
    display: block;
}

/* Form elements */
input, select, textarea {
    max-width: 100%;
}

/* Media queries for responsive layout */
@media (max-width: 1199px) {
    .container {
        max-width: 960px;
    }
    
    h1 {
        font-size: 2.25rem;
    }
    
    h2 {
        font-size: 1.75rem;
    }
}

@media (max-width: 991px) {
    .container {
        max-width: 720px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .hidden-md {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .container {
        max-width: 540px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.4rem;
    }
    
    .hidden-sm {
        display: none !important;
    }
    
    /* Adjust spacing */
    .section-padding {
        padding: 3rem 0;
    }
    
    /* Make buttons more touch-friendly */
    .btn, button {
        padding: 0.6rem 1.2rem;
        min-height: 44px; /* Minimum touch target size */
    }
}

@media (max-width: 575px) {
    .container {
        padding-right: 15px;
        padding-left: 15px;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.15rem;
    }
    
    .hidden-xs {
        display: none !important;
    }
    
    /* Stack columns on extra small devices */
    .row-xs-stack {
        flex-direction: column;
    }
    
    /* Center text on small devices */
    .text-xs-center {
        text-align: center;
    }
    
    /* Adjust margins */
    .mb-xs-3 {
        margin-bottom: 1rem !important;
    }
}

/* Ensure clickable elements are large enough on touch devices */
@media (hover: none) and (pointer: coarse) {
    button, 
    .btn, 
    a.btn,
    input[type="button"],
    input[type="submit"],
    .nav-link {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}
