/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #404040;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #525252;
}

/* Markdown */
.markdown-content {
    line-height: 1.8;
    color: #e5e5e5;
    font-size: 0.9rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.markdown-content > *:first-child {
    margin-top: 0;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    color: #ffffff;
    margin-top: 1.75em;
    margin-bottom: 0.75em;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.markdown-content h1 {
    font-size: 1.5em;
    border-bottom: 1px solid #3f3f46;
    padding-bottom: 0.4em;
    background: linear-gradient(90deg, #f97316 0%, #fb923c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.markdown-content h2 {
    font-size: 1.25em;
    color: #f97316;
}

.markdown-content h3 {
    font-size: 1.1em;
    color: #fb923c;
}

.markdown-content h4 {
    font-size: 1em;
    color: #fdba74;
}

.markdown-content p {
    margin-bottom: 1.25em;
}

/* Inline code */
.markdown-content code {
    background: linear-gradient(135deg, #1c1917 0%, #292524 100%);
    color: #fdba74;
    padding: 0.2em 0.5em;
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.85em;
    border: 1px solid #44403c;
}

/* Code blocks */
.markdown-content pre {
    position: relative;
    background: linear-gradient(180deg, #0a0a0f 0%, #0f0f17 100%);
    padding: 1.25rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5em 0;
    border: 1px solid #27272a;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
}

.markdown-content pre::before {
    content: attr(data-language);
    position: absolute;
    top: 0;
    right: 0;
    padding: 0.25rem 0.75rem;
    font-size: 0.7rem;
    color: #6b7280;
    background: #18181b;
    border-radius: 0 8px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.markdown-content pre code {
    background: transparent;
    color: #e4e4e7;
    padding: 0;
    border: none;
    font-size: 0.85em;
    line-height: 1.6;
}

/* Copy button for code blocks */
.markdown-content .code-block-wrapper {
    position: relative;
}

.markdown-content .copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 6px 10px;
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    color: #a1a1aa;
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
}

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

.markdown-content .copy-code-btn:hover {
    background: #3f3f46;
    color: #ffffff;
}

.markdown-content .copy-code-btn.copied {
    background: #166534;
    border-color: #22c55e;
    color: #22c55e;
}

/* Lists */
.markdown-content ul,
.markdown-content ol {
    padding-left: 1.75em;
    margin-bottom: 1.25em;
}

.markdown-content ul {
    list-style-type: none;
}

.markdown-content ul li {
    position: relative;
}

.markdown-content ul li::before {
    content: "▹";
    position: absolute;
    left: -1.25em;
    color: #f97316;
    font-weight: bold;
}

.markdown-content ol {
    list-style-type: decimal;
}

.markdown-content ol li::marker {
    color: #f97316;
    font-weight: 600;
}

.markdown-content li {
    margin-bottom: 0.5em;
    padding-left: 0.25em;
}

.markdown-content li > ul,
.markdown-content li > ol {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

/* Blockquote */
.markdown-content blockquote {
    border-left: 3px solid #f97316;
    padding: 0.75em 1.25em;
    margin: 1.25em 0;
    background: linear-gradient(90deg, rgba(249, 115, 22, 0.1) 0%, transparent 100%);
    border-radius: 0 8px 8px 0;
    color: #a1a1aa;
    font-style: italic;
}

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

/* Links */
.markdown-content a {
    color: #fb923c;
    text-decoration: none;
    border-bottom: 1px dashed #fb923c;
    transition: all 0.2s ease;
}

.markdown-content a:hover {
    color: #fdba74;
    border-bottom-style: solid;
}

/* Tables */
.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.85em;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.markdown-content thead {
    background: linear-gradient(135deg, #431407 0%, #7c2d12 100%);
}

.markdown-content th {
    padding: 0.75em 1em;
    text-align: left;
    font-weight: 600;
    color: #fdba74;
    text-transform: uppercase;
    font-size: 0.75em;
    letter-spacing: 0.05em;
}

.markdown-content td {
    padding: 0.75em 1em;
    border-top: 1px solid #27272a;
}

.markdown-content tbody tr {
    background: #18181b;
    transition: background 0.2s ease;
}

.markdown-content tbody tr:hover {
    background: #1f1f23;
}

.markdown-content tbody tr:nth-child(even) {
    background: #0f0f12;
}

.markdown-content tbody tr:nth-child(even):hover {
    background: #1a1a1f;
}

/* Horizontal rule */
.markdown-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, #3f3f46, transparent);
    margin: 2em 0;
}

/* Strong and emphasis */
.markdown-content strong {
    color: #ffffff;
    font-weight: 600;
}

.markdown-content em {
    color: #fb923c;
    font-style: italic;
}

/* Task lists */
.markdown-content input[type="checkbox"] {
    appearance: none;
    width: 1em;
    height: 1em;
    border: 2px solid #f97316;
    border-radius: 3px;
    margin-right: 0.5em;
    vertical-align: middle;
    cursor: pointer;
    position: relative;
}

.markdown-content input[type="checkbox"]:checked {
    background: #f97316;
}

.markdown-content input[type="checkbox"]:checked::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #0f0f17;
    font-size: 0.7em;
    font-weight: bold;
}

/* Images */
.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1em 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Definition lists */
.markdown-content dl {
    margin: 1.25em 0;
}

.markdown-content dt {
    font-weight: 600;
    color: #fb923c;
    margin-top: 1em;
}

.markdown-content dd {
    margin-left: 1.5em;
    color: #a1a1aa;
}

/* Footnotes */
.markdown-content .footnotes {
    margin-top: 2em;
    padding-top: 1em;
    border-top: 1px solid #27272a;
    font-size: 0.85em;
    color: #71717a;
}

/* Keyboard keys */
.markdown-content kbd {
    background: linear-gradient(180deg, #27272a 0%, #18181b 100%);
    border: 1px solid #3f3f46;
    border-radius: 4px;
    padding: 0.15em 0.4em;
    font-size: 0.85em;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    box-shadow: 0 2px 0 #0a0a0a;
}

/* Mark/highlight */
.markdown-content mark {
    background: linear-gradient(135deg, rgba(250, 204, 21, 0.3) 0%, rgba(234, 179, 8, 0.3) 100%);
    color: #fef08a;
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

/* Response Loader */
.response-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1.5rem;
}

.loader-dots {
    display: flex;
    gap: 0.5rem;
}

.loader-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f97316;
    animation: loaderPulse 1.4s ease-in-out infinite;
}

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

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

.loader-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loaderPulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.4;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.loader-text {
    color: #737373;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.loader-text span {
    display: inline-block;
    animation: loaderTextFade 2s ease-in-out infinite;
}

@keyframes loaderTextFade {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 1;
    }
}

/* Range Slider */
input[type=range] {
    -webkit-appearance: none;
    background: transparent;
    width: 100%;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 12px;
    width: 12px;
    border-radius: 50%;
    background: #e5e5e5;
    margin-top: -4px;
    cursor: pointer;
    border: none;
}

input[type=range]::-moz-range-thumb {
    height: 12px;
    width: 12px;
    border: none;
    border-radius: 50%;
    background: #e5e5e5;
    cursor: pointer;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #404040;
    border-radius: 2px;
}

input[type=range]::-moz-range-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: #404040;
    border-radius: 2px;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 2px rgba(229, 229, 229, 0.2);
}

/* Selection */
::selection {
    background: #404040;
    color: #fafafa;
}

/* Focus states */
textarea:focus,
input:focus,
select:focus {
    outline: none;
}

/* Textarea placeholder */
textarea::placeholder {
    color: #525252;
}

/* Number input - hide spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}
