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

:root {
    --header-height: 3.5rem;
    --input-height: 7.5rem;
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

body {
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
}

.safe-area-top {
    padding-top: var(--safe-area-top);
}

.safe-area-bottom {
    padding-bottom: var(--safe-area-bottom);
}

.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.message-user {
    animation: slideInRight 0.3s ease-out forwards;
    max-width: 90%;
}

.message-bot {
    animation: slideInLeft 0.3s ease-out forwards;
    max-width: 90%;
}

@keyframes slideInRight {
    from {
        transform: translateX(10px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-10px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.code-block {
    position: relative;
    background: #1e1e1e;
    border-radius: 6px;
    padding: 1rem;
    margin: 0.5rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
}

.code-copy-btn {
    position: absolute;
    right: 0.5rem;
    top: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    color: white;
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.code-block:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.prose {
    max-width: 100%;
}

.prose code:not(.code-block code) {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.9em;
    font-family: 'Courier New', monospace;
}

.prose strong {
    font-weight: 600;
    color: #fff;
}

/* Mobile-specific styles */
@media (max-width: 640px) {
    #message-canvas {
        padding: 0.75rem;
        padding-bottom: var(--input-height);
        height: calc(100vh - var(--header-height) - var(--safe-area-top) - var(--safe-area-bottom)) !important;
    }
    
    .message-bot, .message-user {
        max-width: 85%;
    }
    
    #usertext {
        padding-right: 2.5rem;
        font-size: 1rem;
    }
    
    header {
        padding: 0.5rem 1rem;
    }
    
    .bg-gray-700, .bg-gray-800 {
        border-radius: 0.75rem;
    }
    
    /* Larger tap targets for mobile */
    button, [role="button"] {
        min-width: 44px;
        min-height: 44px;
    }
    
    /* Input area adjustments */
    .h-input {
        height: auto;
        padding-bottom: var(--safe-area-bottom);
    }
}

@media (max-width: 400px) {
    #message-canvas {
        padding: 0.5rem;
    }
    
    #usertext {
        padding: 0.75rem 2.25rem 0.75rem 0.75rem;
        font-size: 0.9rem;
    }
    
    #send-button {
        padding: 0.5rem;
    }
    
    .message-bot, .message-user {
        max-width: 95%;
    }
}

@media (max-width: 480px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

@supports (height: 100dvh) {
    body {
        min-height: 100dvh;
    }
    
    #message-canvas {
        height: calc(100dvh - var(--header-height) - var(--input-height) - var(--safe-area-top) - var(--safe-area-bottom)) !important;
    }
}
