/* static/style.css */

body {
    height: 100dvh;
    margin: 0;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 3px;
}

textarea {
    min-height: 48px;
    max-height: 200px;
    overflow-y: auto;
    -webkit-appearance: none;
    appearance: none;
    resize: none;
    outline: none;
    scrollbar-width: thin;
}
textarea::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
textarea::-webkit-scrollbar-thumb {
    background: #6b7280;
    border-radius: 4px;
}
textarea::-webkit-scrollbar-track {
    background: #374151;
    border-radius: 4px;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.spin-anim {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

select option {
    background-color: #374151;
    color: white;
}

.typing-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: #9ca3af;
    margin-right: 3px;
    animation: typing 1.4s infinite ease-in-out both;
}

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

.code-block-wrapper {
    margin: 0.75rem 0;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid #374151;
    background-color: #111827;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #1f2937;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    color: #9ca3af;
    border-bottom: 1px solid #374151;
    user-select: none;
}

.prose pre {
    background-color: #111827 !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 0 0.5rem 0.5rem;
}

.hljs {
    background: transparent !important;
    padding: 1rem !important;
    font-family: "JetBrains Mono", "Fira Code", Consolas, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

.prose {
    max-width: none !important;
}

/* Long text folding */
.user-msg-long {
    max-height: 5.5rem;
    overflow: hidden;
    position: relative;
}

.user-msg-long::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1.5rem;
    background: linear-gradient(transparent, rgba(17, 24, 39, 0.9));
}

.copy-btn {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ========== Table styles (Markdown Tables) ========== */
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.875rem;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    overflow: hidden;
}

.prose thead {
    background-color: #1f2937;
}

.prose th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #e5e7eb;
    border-bottom: 2px solid #4b5563;
    white-space: nowrap;
}

.prose td {
    padding: 0.625rem 1rem;
    color: #d1d5db;
    border-bottom: 1px solid #374151;
}

.prose tbody tr {
    background-color: #111827;
    transition: background-color 0.15s ease;
}

.prose tbody tr:nth-child(even) {
    background-color: #1a202c;
}

.prose tbody tr:hover {
    background-color: #1f2937;
}

.prose tbody tr:last-child td {
    border-bottom: none;
}

/* Table horizontal scroll (mobile friendly) */
.prose .table-wrapper {
    overflow-x: auto;
    margin: 1rem 0;
    border-radius: 0.5rem;
    border: 1px solid #374151;
}

/* ========== Task list styles ========== */
.prose ul.contains-task-list {
    list-style: none;
    padding-left: 0;
    margin: 0.75rem 0;
}

.prose li.task-list-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0.375rem 0;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.15s ease;
}

.prose li.task-list-item:hover {
    background-color: rgba(55, 65, 81, 0.5);
}

.prose input[type="checkbox"].task-list-item-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 1.125rem;
    height: 1.125rem;
    min-width: 1.125rem;
    border: 2px solid #4b5563;
    border-radius: 0.25rem;
    background-color: #1f2937;
    cursor: default;
    margin-top: 0.125rem;
    position: relative;
    transition: all 0.15s ease;
}

.prose input[type="checkbox"].task-list-item-checkbox:checked {
    background-color: #2563eb;
    border-color: #2563eb;
}

.prose input[type="checkbox"].task-list-item-checkbox:checked::after {
    content: "";
    position: absolute;
    left: 0.3125rem;
    top: 0.0625rem;
    width: 0.375rem;
    height: 0.625rem;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.prose input[type="checkbox"].task-list-item-checkbox:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.prose li.task-list-item > label,
.prose li.task-list-item > span {
    color: #d1d5db;
    line-height: 1.5;
    flex: 1;
}

/* Completed task item style */
.prose li.task-list-item.checked > label,
.prose li.task-list-item.checked > span {
    text-decoration: line-through;
    color: #6b7280;
}

/* ========== Other Markdown enhancements ========== */
.prose blockquote {
    border-left: 4px solid #3b82f6;
    padding-left: 1rem;
    margin: 1rem 0;
    color: #9ca3af;
    font-style: italic;
}

.prose hr {
    border: none;
    border-top: 1px solid #374151;
    margin: 1.5rem 0;
}

.prose del {
    color: #6b7280;
    text-decoration: line-through;
}

.prose ins {
    color: #4ade80;
    text-decoration: underline;
    text-decoration-color: #4ade80;
}

/* Footnote styles */
.prose sup a {
    color: #60a5fa;
    text-decoration: none;
    font-size: 0.75rem;
}

@media (max-width: 640px) {
    #provider-select {
        max-width: 90px;
    }
    #model-select {
        max-width: 110px;
    }

    .prose table {
        font-size: 0.75rem;
    }
    .prose th,
    .prose td {
        padding: 0.5rem;
    }
}

/* Prevent code blocks and tables from breaking mobile layout */
.prose pre,
.prose table {
    max-width: 100%;
    overflow-x: auto;
}

/* Image max width limit */
.prose img {
    max-width: 100%;
    height: auto;
}
