/* Rich Editor Content - Responsive Styles (Shrink to Fit) */
.prose {
    max-width: 100%;
    overflow: hidden;
}

/* Tables - Shrink to fit viewport, no scrolling */
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.875rem;
    table-layout: auto;
}

.prose table td,
.prose table th {
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    text-align: left;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.prose table th {
    background: #f8fafc;
    font-weight: 600;
    color: #1e293b;
}

/* Mobile: Shrink table to fit */
@media (max-width: 768px) {
    .prose table {
        font-size: 0.75rem;
    }

    .prose table td,
    .prose table th {
        padding: 0.5rem 0.5rem;
        font-size: 0.75rem;
        line-height: 1.4;
    }
}

@media (max-width: 480px) {
    .prose table {
        font-size: 0.6875rem;
    }

    .prose table td,
    .prose table th {
        padding: 0.375rem 0.375rem;
        font-size: 0.6875rem;
        line-height: 1.3;
    }
}

/* Images - Responsive and contained */
.prose img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 1.5rem auto;
    border-radius: 0.5rem;
}

.prose figure {
    margin: 1.5rem 0;
    max-width: 100%;
}

.prose figure img {
    width: 100%;
    height: auto;
}

/* Videos and iframes - Responsive container */
.prose iframe,
.prose video,
.prose embed,
.prose object {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
}

/* Code blocks - Smaller on mobile */
.prose pre {
    max-width: 100%;
    padding: 1rem;
    border-radius: 0.5rem;
    background: #1e293b;
    color: #e2e8f0;
    overflow-x: auto;
    font-size: 0.8125rem;
}

@media (max-width: 640px) {
    .prose pre {
        font-size: 0.6875rem;
        padding: 0.75rem;
    }
}

.prose code {
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 0.875em;
}

.prose pre code {
    word-wrap: normal;
    white-space: pre-wrap;
}

/* Lists - Better spacing on mobile */
.prose ul,
.prose ol {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

@media (max-width: 640px) {

    .prose ul,
    .prose ol {
        padding-left: 1.25rem;
        font-size: 0.875rem;
    }
}

/* Blockquotes - Responsive */
.prose blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid #4f46e5;
    background: #f8fafc;
    border-radius: 0.5rem;
    font-style: italic;
}

@media (max-width: 640px) {
    .prose blockquote {
        padding: 0.75rem 1rem;
        margin: 1rem 0;
        font-size: 0.875rem;
    }
}

/* Headings - Responsive sizing */
.prose h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 2rem 0 1rem;
    color: #1e293b;
}

.prose h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 1.75rem 0 0.875rem;
    color: #1e293b;
}

.prose h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
    color: #334155;
}

@media (max-width: 640px) {
    .prose h1 {
        font-size: 1.5rem;
    }

    .prose h2 {
        font-size: 1.25rem;
    }

    .prose h3 {
        font-size: 1.125rem;
    }
}

/* Paragraphs */
.prose p {
    margin: 1rem 0;
    line-height: 1.75;
    color: #475569;
}

@media (max-width: 640px) {
    .prose p {
        font-size: 0.9375rem;
        line-height: 1.65;
    }
}

/* Links */
.prose a {
    color: #4f46e5;
    text-decoration: underline;
    text-decoration-color: rgba(79, 70, 229, 0.3);
    text-underline-offset: 2px;
    transition: all 0.2s;
}

.prose a:hover {
    color: #4338ca;
    text-decoration-color: rgba(79, 70, 229, 0.6);
}

/* Ensure content doesn't break layout */
.prose * {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Strong and emphasis */
.prose strong {
    font-weight: 600;
    color: #1e293b;
}

.prose em {
    font-style: italic;
}

/* Horizontal rules */
.prose hr {
    margin: 2rem 0;
    border: none;
    border-top: 1px solid #e2e8f0;
}

@media (max-width: 640px) {
    .prose hr {
        margin: 1.5rem 0;
    }
}