/* Rich Text Editor Styles for Umbraco Content */
/* Fixes formatting issues where editor formatting doesn't appear in published content */

.rich-text-content {
    font-family: "Aptos-Display", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #292929;
}

/* Typography - Standardized Aptos fonts */
.rich-text-content h1,
.rich-text-content h2,
.rich-text-content h3,
.rich-text-content h4,
.rich-text-content h5,
.rich-text-content h6 {
    font-family: "Aptos-Bold", Helvetica, Arial, sans-serif;
    font-weight: 700;
    color: #292929;
    margin-top: 2em;
    margin-bottom: 1em;
    line-height: 1.2;
}

.rich-text-content h1 {
    font-size: 2.5em;
    line-height: 1.1;
}

.rich-text-content h2 {
    font-size: 2em;
    line-height: 1.15;
}

.rich-text-content h3 {
    font-size: 1.5em;
    line-height: 1.2;
}

.rich-text-content h4 {
    font-size: 1.25em;
    line-height: 1.25;
}

.rich-text-content h5 {
    font-size: 1.125em;
    line-height: 1.3;
}

.rich-text-content h6 {
    font-size: 1em;
    line-height: 1.35;
}

/* Paragraphs and Text */
.rich-text-content p {
    font-family: "Aptos-Display", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #292929;
    margin-bottom: 1.5em;
    margin-top: 0;
}

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

/* Text Formatting - Bold, Italic, etc. */
.rich-text-content strong,
.rich-text-content b {
    font-family: "Aptos-Bold", Helvetica, Arial, sans-serif;
    font-weight: 700;
    color: #292929;
}

.rich-text-content em,
.rich-text-content i {
    font-style: italic;
    font-family: "Aptos-Display", Helvetica, Arial, sans-serif;
}

.rich-text-content u {
    text-decoration: underline;
}

.rich-text-content s,
.rich-text-content del {
    text-decoration: line-through;
}

.rich-text-content mark {
    background-color: #ffff99;
    padding: 0.1em 0.2em;
}

.rich-text-content sup {
    font-size: 0.8em;
    vertical-align: super;
}

.rich-text-content sub {
    font-size: 0.8em;
    vertical-align: sub;
}

/* Lists - Bullets and Numbering */
.rich-text-content ul,
.rich-text-content ol {
    font-family: "Aptos-Display", Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #292929;
    margin: 1.5em 0;
    padding-left: 2em;
}

.rich-text-content ul {
    list-style-type: disc;
}

.rich-text-content ol {
    list-style-type: decimal;
}

.rich-text-content li {
    margin-bottom: 0.5em;
    line-height: 1.6;
}

.rich-text-content li:last-child {
    margin-bottom: 0;
}

/* Nested lists */
.rich-text-content ul ul,
.rich-text-content ol ol,
.rich-text-content ul ol,
.rich-text-content ol ul {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.rich-text-content ul ul {
    list-style-type: circle;
}

.rich-text-content ul ul ul {
    list-style-type: square;
}

/* Links */
.rich-text-content a {
    color: var(--nbg-blue-2, #007a85);
    text-decoration: underline;
    font-family: inherit;
    transition: color 0.2s ease;
}

.rich-text-content a:hover {
    color: var(--nbg-blue-1, #00adbf);
    text-decoration: none;
}

.rich-text-content a:visited {
    color: var(--nbg-blue-3, #003a3e);
}

/* Blockquotes */
.rich-text-content blockquote {
    font-family: "Aptos-Display", Helvetica, Arial, sans-serif;
    font-size: 1.1em;
    line-height: 1.5;
    color: #696969;
    margin: 2em 0;
    padding: 1em 2em;
    border-left: 4px solid var(--nbg-blue-1, #00adbf);
    background-color: #f6f8f6;
    font-style: italic;
}

.rich-text-content blockquote p:last-child {
    margin-bottom: 0;
}

/* Code and Pre-formatted Text */
.rich-text-content code {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    background-color: #f4f4f4;
    padding: 0.2em 0.4em;
    border-radius: 3px;
    color: #d14;
}

.rich-text-content pre {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    background-color: #f4f4f4;
    padding: 1em;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1.5em 0;
    line-height: 1.4;
}

.rich-text-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

/* Tables */
.rich-text-content table {
    font-family: "Aptos-Display", Helvetica, Arial, sans-serif;
    width: 100%;
    border-collapse: collapse;
    margin: 2em 0;
    font-size: 16px;
}

.rich-text-content table th,
.rich-text-content table td {
    padding: 0.75em;
    text-align: left;
    border-bottom: 1px solid #ddd;
    line-height: 1.4;
}

.rich-text-content table th {
    font-family: "Aptos-Bold", Helvetica, Arial, sans-serif;
    font-weight: 700;
    background-color: #f6f8f6;
    border-bottom: 2px solid #ccc;
}

.rich-text-content table tr:nth-child(even) {
    background-color: #fafafa;
}

.rich-text-content table tr:hover {
    background-color: #f0f0f0;
}

/* Horizontal Rules */
.rich-text-content hr {
    border: none;
    border-top: 2px solid #e0e0e0;
    margin: 3em 0;
}

/* Images in Rich Text */
.rich-text-content img {
    max-width: 100%;
    height: auto;
    margin: 1.5em 0;
    border-radius: 8px;
}

.rich-text-content figure {
    margin: 2em 0;
    text-align: center;
}

.rich-text-content figure img {
    margin: 0;
}

.rich-text-content figcaption {
    font-family: "Aptos-Display", Helvetica, Arial, sans-serif;
    font-size: 0.9em;
    color: #696969;
    margin-top: 0.5em;
    font-style: italic;
}

/* Definition Lists */
.rich-text-content dl {
    margin: 1.5em 0;
}

.rich-text-content dt {
    font-family: "Aptos-Bold", Helvetica, Arial, sans-serif;
    font-weight: 700;
    color: #292929;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

.rich-text-content dd {
    margin-left: 2em;
    margin-bottom: 1em;
    font-family: "Aptos-Display", Helvetica, Arial, sans-serif;
    line-height: 1.6;
}

/* Text Alignment Classes */
.rich-text-content .text-left {
    text-align: left;
}

.rich-text-content .text-center {
    text-align: center;
}

.rich-text-content .text-right {
    text-align: right;
}

.rich-text-content .text-justify {
    text-align: justify;
}

/* Responsive Design */
@media (max-width: 768px) {
    .rich-text-content h1 {
        font-size: 2em;
    }

    .rich-text-content h2 {
        font-size: 1.5em;
    }

    .rich-text-content h3 {
        font-size: 1.25em;
    }

    .rich-text-content ul,
    .rich-text-content ol {
        padding-left: 1.5em;
    }

    .rich-text-content blockquote {
        padding: 0.75em 1em;
        margin: 1.5em 0;
    }

    .rich-text-content table {
        font-size: 14px;
    }

    .rich-text-content table th,
    .rich-text-content table td {
        padding: 0.5em;
    }
}

/* Print Styles */
@media print {
    .rich-text-content {
        font-size: 12pt;
        line-height: 1.4;
    }

    .rich-text-content h1,
    .rich-text-content h2,
    .rich-text-content h3,
    .rich-text-content h4,
    .rich-text-content h5,
    .rich-text-content h6 {
        break-after: avoid;
    }

    .rich-text-content blockquote,
    .rich-text-content table,
    .rich-text-content pre {
        break-inside: avoid;
    }
}

/* Embedded Videos (YouTube, Vimeo, etc.) - Responsive & Styled */
.rich-text-content iframe {
    max-width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin: 2em 0;
    display: block;
}

/* Enhanced container for embedded media */
.rich-text-content .media-wrapper,
.rich-text-content .video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin: 2em 0;
    background-color: #000;
}

.rich-text-content .media-wrapper iframe,
.rich-text-content .video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
    margin: 0;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .rich-text-content iframe {
        border-radius: 8px;
        margin: 1.5em 0;
    }
    
    .rich-text-content .media-wrapper,
    .rich-text-content .video-wrapper {
        border-radius: 8px;
        margin: 1.5em 0;
    }
}
