/* Shared sanitized rich-content rendering for Articles and Products */
.rich-content {
    direction: rtl;
    line-height: 1.95;
    font-size: 1rem;
    color: #222;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.rich-content > *:first-child {
    margin-top: 0;
}

.rich-content h2,
.rich-content h3,
.rich-content h4 {
    margin: 1.5rem 0 0.75rem;
    font-weight: 800;
    line-height: 1.5;
}

.rich-content p {
    margin-bottom: 1rem;
}

.rich-content ul,
.rich-content ol {
    padding-inline-start: 1.5rem;
    margin-bottom: 1rem;
}

.rich-content blockquote {
    margin: 1.25rem 0;
    padding: 0.75rem 1rem;
    border-inline-start: 4px solid #0d6efd;
    background: #f8f9fa;
}

.rich-content a {
    color: #0d6efd;
    text-decoration: underline;
    display: inline;
    font-weight: inherit;
}

.rich-content a:hover,
.rich-content a:focus {
    color: #0a58ca;
    text-decoration: underline;
}

.rich-content code {
    font-family: Consolas, Monaco, monospace;
    background: #f1f3f5;
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
}

.rich-content pre {
    direction: ltr;
    text-align: left;
    background: #212529;
    color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

.rich-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.rich-content hr {
    margin: 1.5rem 0;
    border: 0;
    border-top: 1px solid #dee2e6;
}

/* Typography helpers */
.rich-content .rich-font-size--small { font-size: 0.875rem; }
.rich-content .rich-font-size--normal { font-size: 1rem; }
.rich-content .rich-font-size--large { font-size: 1.125rem; }
.rich-content .rich-font-size--xlarge { font-size: 1.25rem; }

.rich-content .rich-align--right { text-align: right; }
.rich-content .rich-align--center { text-align: center; }
.rich-content .rich-align--left { text-align: left; }
.rich-content .rich-align--justify { text-align: justify; }

.rich-content .rich-text-color--body { color: #222; }
.rich-content .rich-text-color--muted { color: #6c757d; }
.rich-content .rich-text-color--primary { color: #0d6efd; }
.rich-content .rich-text-color--accent { color: #0dcaf0; }
.rich-content .rich-text-color--danger { color: #dc3545; }
.rich-content .rich-text-color--success { color: #198754; }

/* Inline images */
.rich-content figure.image,
.rich-content figure.rich-image {
    margin: 1.25rem 0;
    max-width: 100%;
}

.rich-content figure.image img,
.rich-content figure.rich-image img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
}

.rich-content figure.rich-image--25 { width: 25%; }
.rich-content figure.rich-image--50 { width: 50%; }
.rich-content figure.rich-image--75 { width: 75%; }
.rich-content figure.rich-image--100 { width: 100%; }

.rich-content figure.rich-image--right {
    float: inline-end;
    margin-inline-start: 1rem;
    margin-inline-end: 0;
}

.rich-content figure.rich-image--left {
    float: inline-start;
    margin-inline-end: 1rem;
    margin-inline-start: 0;
}

.rich-content figure.rich-image--center {
    float: none;
    margin-inline: auto;
    text-align: center;
}

.rich-content figure.image figcaption,
.rich-content figure.rich-image figcaption {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #6c757d;
    text-align: center;
}

.rich-content::after {
    content: "";
    display: block;
    clear: both;
}

/* Tables */
.rich-content .rich-table-responsive {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.25rem;
    max-width: 100%;
}

.rich-content table,
.rich-content figure.table table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
}

.rich-content th,
.rich-content td {
    border: 1px solid #dee2e6;
    padding: 0.5rem 0.75rem;
    vertical-align: top;
}

.rich-content .rich-table--bordered th,
.rich-content .rich-table--bordered td {
    border-width: 2px;
}

.rich-content .rich-table--striped tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.rich-content .rich-table--compact th,
.rich-content .rich-table--compact td {
    padding: 0.35rem 0.5rem;
}

.rich-content .rich-table--accent thead th {
    background: #e7f1ff;
}

@media (max-width: 767.98px) {
    .rich-content figure.rich-image--25,
    .rich-content figure.rich-image--50,
    .rich-content figure.rich-image--75 {
        width: 100%;
        float: none;
        margin-inline: 0;
    }
}

/* Admin CKEditor preview uses ck-content instead of rich-content wrapper */
.ck-content a {
    color: #0d6efd;
    text-decoration: underline;
    display: inline;
    font-weight: inherit;
}

.ck-content a:hover,
.ck-content a:focus {
    color: #0a58ca;
    text-decoration: underline;
}

.ck-content figure.image,
.ck-content figure.rich-image {
    margin: 1.25rem 0;
    max-width: 100%;
}

.ck-content figure.image img,
.ck-content figure.rich-image img {
    display: block;
    max-width: 100%;
    height: auto;
}

.ck-content figure.rich-image--25 { width: 25%; }
.ck-content figure.rich-image--50 { width: 50%; }
.ck-content figure.rich-image--75 { width: 75%; }
.ck-content figure.rich-image--100 { width: 100%; }

.ck-content figure.rich-image--right {
    float: inline-end;
    margin-inline-start: 1rem;
    margin-inline-end: 0;
}

.ck-content figure.rich-image--left {
    float: inline-start;
    margin-inline-end: 1rem;
    margin-inline-start: 0;
}

.ck-content figure.rich-image--center {
    float: none;
    margin-inline: auto;
    text-align: center;
}

.ck-content .rich-table--striped tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.ck-content .rich-table--accent thead th {
    background: #e7f1ff;
}

.rich-editor-tool-btn.active {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}
