/* ============================================================
   ProEditor – Frontend content styles
   Use with: <div class="rich-content">{!! $html !!}</div>
   ============================================================ */

.rich-content {
    font-size: 16px;
    line-height: 1.8;
    color: inherit;
    word-wrap: break-word;
}

.rich-content::after {
    content: '';
    display: table;
    clear: both;
}

/* Typography */
.rich-content h1 { font-size: 2em; font-weight: 700; margin: 0.5em 0 0.4em; line-height: 1.2; }
.rich-content h2 { font-size: 1.6em; font-weight: 700; margin: 0.6em 0 0.4em; line-height: 1.25; }
.rich-content h3 { font-size: 1.3em; font-weight: 600; margin: 0.6em 0 0.4em; }
.rich-content h4 { font-size: 1.1em; font-weight: 600; margin: 0.5em 0 0.35em; }
.rich-content h5 { font-size: 1em; font-weight: 600; margin: 0.5em 0 0.3em; }
.rich-content h6 { font-size: 0.9em; font-weight: 600; margin: 0.5em 0 0.3em; opacity: 0.85; }

.rich-content p { margin-bottom: 0.75em; }
.rich-content p:last-child { margin-bottom: 0; }

.rich-content strong { font-weight: 700; }
.rich-content em { font-style: italic; }
.rich-content u { text-decoration: underline; }
.rich-content s { text-decoration: line-through; }
.rich-content sup { vertical-align: super; font-size: 0.75em; }
.rich-content sub { vertical-align: sub; font-size: 0.75em; }

.rich-content blockquote {
    border-left: 4px solid #4f46e5;
    padding: 10px 16px;
    background: #f4f3ff;
    border-radius: 0 4px 4px 0;
    margin: 1em 0;
    font-style: italic;
}

.rich-content pre,
.rich-content code {
    background: #1e1e2e;
    color: #cdd6f4;
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-size: 14px;
    border-radius: 4px;
}

.rich-content pre {
    padding: 14px 18px;
    overflow-x: auto;
    margin: 1em 0;
    white-space: pre-wrap;
}

.rich-content code { padding: 2px 5px; }

.rich-content a {
    color: #4f46e5;
    text-decoration: underline;
}

.rich-content a:hover { text-decoration: none; }

.rich-content ul,
.rich-content ol {
    padding-left: 1.5em;
    margin: 0.6em 0;
}

.rich-content li { margin: 0.2em 0; }

.rich-content hr {
    border: none;
    border-top: 2px solid rgba(0, 0, 0, 0.1);
    margin: 1.5em 0;
}

/* Task lists */
.rich-content ul.pe-tasklist {
    list-style: none;
    padding-left: 0;
}

.rich-content ul.pe-tasklist li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 2px 0;
}

.rich-content ul.pe-tasklist li input[type=checkbox] {
    margin-top: 4px;
    accent-color: #4f46e5;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.rich-content ul.pe-tasklist li.done span {
    text-decoration: line-through;
    opacity: 0.65;
}

/* Tables */
.rich-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1em 0;
    font-size: 15px;
}

.rich-content table td,
.rich-content table th {
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 8px 12px;
    min-width: 60px;
    vertical-align: top;
    text-align: left;
}

.rich-content table th {
    background: #f5f5f8;
    font-weight: 600;
}

.rich-content table tfoot td {
    background: #f5f5f8;
    font-weight: 600;
    border-top: 2px solid rgba(0, 0, 0, 0.12);
}

@media (max-width: 767px) {
    .rich-content {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    .rich-content table {
        display: block;
        width: max-content;
        min-width: 100%;
        max-width: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Images */
.rich-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    vertical-align: middle;
}

.rich-content [class*="page"],
.rich-content [class*="editor"],
.rich-content [class*="canvas"],
.rich-content [class*="sheet"] {
    max-width: 100% !important;
    width: auto !important;
    background: transparent !important;
    box-shadow: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.rich-content > img,
.rich-content p > img:only-child {
    margin: 1rem 0;
}

.rich-content .pe-img-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.rich-content .pe-img-wrap img {
    margin: 0;
    display: block;
}

.rich-content .pe-img-center {
    display: block;
    margin: 1em auto;
    text-align: center;
}

.rich-content .pe-img-left {
    float: left;
    margin: 0 16px 8px 0;
}

.rich-content .pe-img-right {
    float: right;
    margin: 0 0 8px 16px;
}

/* Video embeds */
.rich-content .pe-video-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
    margin: 1em 0;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.rich-content .pe-video-wrap iframe,
.rich-content .pe-video-wrap video {
    width: 100%;
    display: block;
    border: none;
    aspect-ratio: 16 / 9;
    height: auto;
}

/* Hide any editor-only artifacts if present in old content */
.rich-content .pe-col-resizer,
.rich-content .pe-row-resizer,
.rich-content .pe-resize-handle {
    display: none !important;
}

@media (max-width: 767px) {
    .rich-content .pe-img-left,
    .rich-content .pe-img-right {
        float: none;
        display: block;
        margin: 1em auto;
        text-align: center;
    }
}
