/* =========================================================
   FAST WORKSPACE - MARKDOWN TYPOGRAPHY & TABLE ENGINE
   Memperbaiki reset Tailwind CSS agar hasil generate teks AI
   memiliki hierarki visual, indentasi list, spasi proporsional,
   dan tabel responsif di desktop maupun mobile.
   ========================================================= */

/* --- 1. SPACING PARAGRAF & HIERARKI JUDUL (HEADINGS) --- */
.prose p,
.mobile-msg-ai p,
.project-content-text p {
    margin-top: 0.65rem !important;
    margin-bottom: 0.65rem !important;
    line-height: 1.72 !important;
    word-break: break-word;
}

.prose h1, .mobile-msg-ai h1, .project-content-text h1 {
    font-size: 1.45rem !important;
    font-weight: 700 !important;
    color: #f4f4f5 !important;
    margin-top: 1.5rem !important;
    margin-bottom: 0.6rem !important;
    line-height: 1.35 !important;
}

.prose h2, .mobile-msg-ai h2, .project-content-text h2 {
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    color: #f4f4f5 !important;
    margin-top: 1.3rem !important;
    margin-bottom: 0.5rem !important;
    line-height: 1.4 !important;
}

.prose h3, .mobile-msg-ai h3, .project-content-text h3 {
    font-size: 1.05rem !important;
    font-weight: 600 !important;
    color: #e4e4e7 !important;
    margin-top: 1.1rem !important;
    margin-bottom: 0.4rem !important;
    line-height: 1.45 !important;
}

.prose h4, .mobile-msg-ai h4, .project-content-text h4 {
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    color: #d4d4d8 !important;
    margin-top: 0.9rem !important;
    margin-bottom: 0.35rem !important;
}

/* --- 2. NUMBERING, BULLET POINTS & INDENTASI BERTINGKAT --- */
.prose ul,
.mobile-msg-ai ul,
.project-content-text ul {
    list-style-type: disc !important;
    padding-left: 1.6rem !important;
    margin-top: 0.5rem !important;
    margin-bottom: 0.65rem !important;
}

.prose ol,
.mobile-msg-ai ol,
.project-content-text ol {
    list-style-type: decimal !important;
    padding-left: 1.6rem !important;
    margin-top: 0.5rem !important;
    margin-bottom: 0.65rem !important;
}

.prose li,
.mobile-msg-ai li,
.project-content-text li {
    margin-top: 0.3rem !important;
    margin-bottom: 0.3rem !important;
    line-height: 1.65 !important;
    padding-left: 0.25rem !important;
}

/* Sub-list (Tingkat 2) */
.prose ul ul,
.mobile-msg-ai ul ul,
.project-content-text ul ul {
    list-style-type: circle !important;
    padding-left: 1.4rem !important;
    margin-top: 0.25rem !important;
    margin-bottom: 0.25rem !important;
}

.prose ol ol,
.mobile-msg-ai ol ol,
.project-content-text ol ol {
    list-style-type: lower-alpha !important;
    padding-left: 1.4rem !important;
    margin-top: 0.25rem !important;
    margin-bottom: 0.25rem !important;
}

/* Sub-list (Tingkat 3) */
.prose ul ul ul,
.mobile-msg-ai ul ul ul,
.project-content-text ul ul ul {
    list-style-type: square !important;
    padding-left: 1.3rem !important;
}

/* --- 3. FORMAT TABEL MODERN & RESPONSIF (MINIMALIS SEAMLESS) --- */
.table-responsive-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    margin-top: 0.75rem !important;
    margin-bottom: 0.75rem !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    -webkit-overflow-scrolling: touch !important;
}

.prose table,
.mobile-msg-ai table,
.project-content-text table,
.table-interactive-form {
    width: 100% !important;
    min-width: 100% !important;
    table-layout: auto !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    margin: 0 !important;
    font-size: 12.5px !important;
    border: none !important;
    border-radius: 0 !important;
    background-color: transparent !important;
    box-shadow: none !important;
}

/* Header Tabel */
.prose th,
.mobile-msg-ai th,
.project-content-text th,
.table-interactive-form th,
.table-form-th {
    font-weight: 600 !important;
    padding: 0.65rem 0.9rem !important;
    text-align: left !important;
    letter-spacing: 0.015em !important;
    white-space: nowrap !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
}
html.dark .prose th,
html.dark .mobile-msg-ai th,
html.dark .project-content-text th,
html.dark .table-interactive-form th,
html.dark .table-form-th {
    background-color: #242421 !important;
    color: #f4f4f5 !important;
    border-bottom: 1px solid #383834 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
}
html:not(.dark) .prose th,
html:not(.dark) .mobile-msg-ai th,
html:not(.dark) .project-content-text th,
html:not(.dark) .table-interactive-form th,
html:not(.dark) .table-form-th,
html:not(.dark) thead th,
html:not(.dark) table th,
html:not(.dark) th {
    background-color: #edebe4 !important;
    color: #18181b !important;
    font-weight: 700 !important;
    border-bottom: 2px solid #dcd8cd !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
}
html:not(.dark) .text-[#e0e0ce],
html:not(.dark) #chat-thread .text-[#e0e0ce] {
    color: #18181b !important;
}

.prose th:last-child,
.mobile-msg-ai th:last-child,
.project-content-text th:last-child {
    border-right: none !important;
}

/* Sel Data Tabel */
.prose td,
.mobile-msg-ai td,
.project-content-text td,
.table-interactive-form td {
    padding: 0.6rem 0.9rem !important;
    border-bottom: 1px solid #262623 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    color: #d4d4d8 !important;
    line-height: 1.55 !important;
    vertical-align: top !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
}

.prose td:last-child,
.mobile-msg-ai td:last-child,
.project-content-text td:last-child {
    border-right: none !important;
}

.prose tr:last-child td,
.mobile-msg-ai tr:last-child td,
.project-content-text tr:last-child td {
    border-bottom: none !important;
}

/* Zebra Striping Halus & Hover */
.prose tbody tr:nth-child(even),
.mobile-msg-ai tbody tr:nth-child(even),
.project-content-text tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.015) !important;
}

.prose tbody tr:hover,
.mobile-msg-ai tbody tr:hover,
.project-content-text tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.035) !important;
}

/* Container pembungkus tabel agar di mobile bisa di-scroll horizontal */
@media (max-width: 768px) {
    .prose table,
    .mobile-msg-ai table,
    .project-content-text table {
        font-size: 11.5px !important;
    }
}

/* --- 4. PENETRAL KATEX ERROR & OVERRIDE TEKS MERAH --- */
.katex-error {
    color: inherit !important;
    background-color: transparent !important;
    border: none !important;
    white-space: normal !important;
    word-break: break-word !important;
}

/* --- 5. BLOCKQUOTE, HORIZONTAL RULE, & INLINE CODE --- */
.prose blockquote,
.mobile-msg-ai blockquote,
.project-content-text blockquote {
    border-left: 3px solid #da6942 !important;
    padding: 0.5rem 0.85rem !important;
    margin: 0.85rem 0 !important;
    background-color: rgba(218, 105, 66, 0.06) !important;
    color: #c4c4be !important;
    font-style: italic !important;
    border-radius: 0 0.5rem 0.5rem 0 !important;
}

.prose hr,
.mobile-msg-ai hr,
.project-content-text hr {
    border: 0 !important;
    border-top: 1px solid #2e2e2a !important;
    margin: 1.25rem 0 !important;
}

.prose :not(pre) > code,
.mobile-msg-ai :not(pre) > code,
.project-content-text :not(pre) > code {
    background-color: #242421 !important;
    border: 1px solid #2e2e2a !important;
    color: #e5e5e5 !important;
    padding: 0.15rem 0.4rem !important;
    border-radius: 0.375rem !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 0.825em !important;
    word-break: break-word !important;
}
/* Gambar hasil generator AI (FLUX) di dalam balon jawaban - Desktop: thumbnail kompak dengan kursor zoom */
.prose img,
.project-content-text img {
    display: block;
    max-width: 320px;
    max-height: 320px;
    width: auto;
    height: auto;
    object-fit: cover;
    margin: 12px 0;
    border-radius: 12px;
    border: 1px solid #2e2e2a;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    background: #141413;
    cursor: zoom-in;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.prose img:hover,
.project-content-text img:hover {
    transform: scale(1.02);
    border-color: rgba(249, 115, 22, 0.6);
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.25);
}

/* Gambar hasil generator AI di versi Mobile tetap fleksibel selebar gelembung */
#mobile-chat-thread .prose img,
.mobile-msg-ai img {
    display: block;
    max-width: 100%;
    max-height: 380px;
    height: auto;
    margin: 12px auto;
    border-radius: 12px;
    border: 1px solid #2e2e2a;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    background: #141413;
    cursor: zoom-in;
}

.prose p:has(> img),
.mobile-msg-ai p:has(> img),
.project-content-text p:has(> img) {
    margin: 0;
}
