html {
    scroll-behavior: smooth;
}

body {
    padding-bottom: 5rem;
    overflow-wrap: break-word; 
    word-wrap: break-word;
}

*:focus-visible {
    outline: 2px solid hsl(var(--p));
    outline-offset: 2px;
    border-radius: var(--rounded-btn, 0.5rem);
}

[x-cloak] {
    display: none !important;
}

main.border-x {
    border-color: hsl(var(--b3));
}

/* Animations & Keyframes */
@keyframes highlight-and-fade {
    0% { background-color: hsla(var(--p) / 0.2); }
    100% { background-color: transparent; }
}

@keyframes slide-in-fade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

.highlight-new,
.highlight-new-message {
    animation: highlight-and-fade 3s ease-out;
}

.new-comment-animate {
    animation: slide-in-fade 0.5s ease-out;
}

.animate-message-sent {
    animation: slideInFromRight 0.3s ease-out;
}

.animate-message-received {
    animation: slideInFromLeft 0.3s ease-out;
}

/* Component Styles */
.dropdown-content-glass {
    background-color: hsla(var(--b2) / 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid hsla(var(--b3) / 0.3);
}

.auth-left-pane {
    color: hsl(var(--pc));
    background: linear-gradient(45deg, hsl(var(--p)), hsl(var(--a)));
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.auth-left-pane i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.chat-bubble {
    overflow: visible;
}

.lg-sidebar-scroll {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.lg-sidebar-scroll::-webkit-scrollbar {
    display: none;
}

/* Responsive Embed Container */
.embed-container {
    max-width: 100%;
    overflow-x: auto; 
    margin-left: auto;
    margin-right: auto;
    display: flex;
    justify-content: center;
}

.embed-container iframe,
.embed-container blockquote {
    max-width: 100% !important;
    width: 100% !important;
    min-width: 250px !important; 
    margin: auto !important; 
    border-radius: var(--rounded-box, 1rem) !important;
}

/* Utility Styles */
.break-words {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.aspect-w-16 {
    position: relative;
    padding-bottom: 56.25%;
}

.aspect-h-9 > * {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.prose-fade::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5rem;
    background: linear-gradient(to top, hsl(var(--b1)), transparent);
    pointer-events: none;
}

/* Prose (Markdown) Styles */
.prose {
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    color: hsl(var(--bc));
    line-height: 1.7;
    max-width: 100%;
}

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
    color: hsl(var(--bc));
    line-height: 1.3;
    margin-top: 1.5em;
    margin-bottom: 0.75em;
}

.prose h1 {
    font-size: 2.25em;
    font-weight: 800;
    padding-bottom: 0.3em;
    border-bottom: 2px solid hsl(var(--b3));
}

.prose h2 {
    font-size: 1.8em;
    font-weight: 700;
    padding-bottom: 0.3em;
    border-bottom: 1px solid hsl(var(--b3));
}

.prose h3 {
    font-size: 1.5em;
    font-weight: 600;
}

.prose h4 {
    font-size: 1.25em;
    font-weight: 600;
}

.prose h5, .prose h6 {
    font-size: 1.1em;
    font-weight: 600;
    color: hsla(var(--bc) / 0.85);
}

.prose p {
    margin-top: 0;
    margin-bottom: 1.25em;
}

.prose a {
    color: #5865F2;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color 0.2s ease-in-out;
    font-weight: 500;
}

.prose a:hover {
    color: #434ed1;
}

html[data-theme="dark"] .prose a {
    color: #7289da;
}

html[data-theme="dark"] .prose a:hover {
    color: #99aab5;
}

.prose strong {
    font-weight: 700;
    color: hsl(var(--bc));
}

.prose ul, .prose ol {
    margin-top: 1.25em;
    margin-bottom: 1.25em;
    padding-left: 1.75rem;
}

.prose ul { list-style-type: disc; }
.prose ol { list-style-type: decimal; }
.prose li { margin-top: 0.5em; margin-bottom: 0.5em; }

.prose blockquote {
    background-color: #f3f4f6;
    color: #374151;
    padding: 15px 20px !important;
    margin: 1em 0 !important;
    border-radius: 4px !important;
    border-left: 4px solid #7289da !important;
    border-right: none !important;
    font-style: italic;
}

.prose blockquote p {
    margin: 0;
}

html[data-theme="dark"] .prose blockquote {
    background-color: #2f3136 !important;
    color: #ffffff !important;
}

html[dir="rtl"] .prose blockquote {
    border-left: none !important;
    border-right: 4px solid #7289da !important;
}

.prose pre {
    background-color: #f3f4f6 !important;
    color: #111827 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    padding: 15px !important;
    overflow-x: auto !important;
    font-size: 0.875rem;
    line-height: 1.71;
    margin-top: 1.5em;
    margin-bottom: 1.5em;
}

.prose code {
    background-color: #e5e7eb !important;
    color: #be123c !important;
    padding: 3px 6px !important;
    border-radius: 3px !important;
    font-family: Consolas, "Liberation Mono", Courier, monospace !important;
    font-weight: 600;
}
.prose code::before, .prose code::after { content: ""; }

.prose pre code {
    background-color: transparent !important;
    color: inherit !important;
    padding: 0 !important;
    font-weight: normal;
}

.prose kbd {
    background-color: #e5e7eb !important;
    color: #374151 !important;
    border: 1px solid #d1d5db !important;
    box-shadow: 0 2px 0 0 #9ca3af !important;
    padding: 2px 6px !important;
    border-radius: 3px !important;
    font-family: sans-serif !important;
    font-size: 0.9em !important;
    white-space: nowrap !important;
}

html[data-theme="dark"] .prose pre {
    background-color: #282c34 !important;
    color: #abb2bf !important;
    border: 1px solid #3e4451 !important;
}

html[data-theme="dark"] .prose code {
    background-color: #3e4451 !important;
    color: #d19a66 !important;
}

html[data-theme="dark"] .prose pre code {
    background-color: transparent !important;
    color: inherit !important;
}

html[data-theme="dark"] .prose kbd {
    background-color: #3e4451 !important;
    color: #abb2bf !important;
    border: 1px solid #5a6272 !important;
    box-shadow: 0 2px 0 0 #5a6272 !important;
}

.prose table {
    width: 100%;
    table-layout: auto;
    text-align: left;
    margin-top: 2em;
    margin-bottom: 2em;
    font-size: 0.875rem;
    line-height: 1.71;
}

.prose thead {
    border-bottom: 2px solid hsl(var(--b3));
    color: hsl(var(--bc));
    font-weight: 600;
}

.prose tbody tr {
    border-bottom: 1px solid hsl(var(--b3));
}

.prose th, .prose td {
    padding: 0.5rem 1rem;
}

.prose-sm {
    font-size: 0.875rem;
    line-height: 1.5;
}


.modal-box-glass {
    background-color: hsla(var(--b2) / 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid hsla(var(--b3) / 0.4);
}

/* --- Tooltips on Small Screens --- */
.tooltip {
    max-width: 100%;
}

.tooltip::before {
    max-width: 100vw !important; 
    width: auto !important;
    white-space: normal !important; 
} 

@media (max-width: 640px) {
    .tooltip::before {
        left: 0 !important; 
        right: 0 !important;
        margin-left: 0.5rem !important;
        margin-right: 0.5rem !important;
        max-width: calc(100vw - 1rem) !important; 
    }
}