/* WordPress Doc Post Magic - Word Document Style Preservation */

/* Global box-sizing for easier responsive layouts */
.wp-doc-post-magic-content *,
.wp-doc-post-magic-content *::before,
.wp-doc-post-magic-content *::after {
    box-sizing: border-box;
}

/* Base content styles */
.wp-doc-post-magic-content {
    font-family: inherit; /* Inherit from parent to allow Word document fonts */
    line-height: 1.6;
    white-space: pre-wrap; /* Preserve line breaks and spaces */
    max-width: 100%; /* Ensure content doesn't overflow container */
    overflow-x: hidden; /* Hide horizontal overflow that might occur due to fixed width elements */
}

/* Preserve Word document text styles */
.wp-doc-post-magic-content p,
.wp-doc-post-magic-content span,
.wp-doc-post-magic-content div {
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    font-style: inherit;
    text-decoration: inherit;
    color: inherit;
    background-color: inherit;
    vertical-align: inherit;
    margin: inherit; /* Preserve paragraph margins */
    padding: inherit; /* Preserve padding */
    line-height: inherit; /* Preserve line height */
    display: inherit; /* Preserve display property */
}

/* Ensure styles are not overridden by theme */
.wp-doc-post-magic-content * {
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    font-style: inherit !important;
    text-decoration: inherit !important;
    color: inherit !important;
    background-color: inherit !important;
    vertical-align: inherit !important;
    margin: inherit !important; /* Preserve margins */
    padding: inherit !important; /* Preserve padding */
    line-height: inherit !important; /* Preserve line height */
    white-space: inherit !important; /* Preserve whitespace */
    display: inherit !important; /* Preserve display property */
}

/* Ensure paragraphs maintain visual spacing, especially for empty ones */
.wp-doc-post-magic-content p {
    min-height: 1em !important; /* Ensure minimum height for paragraphs */
    margin-top: inherit !important;
    margin-bottom: inherit !important;
    padding-top: inherit !important;
    padding-bottom: inherit !important;
    display: block !important; /* Ensure paragraphs are always block level */
}

/* Preserve list styles */
.wp-doc-post-magic-content ul,
.wp-doc-post-magic-content ol {
    list-style-type: none !important;
    padding-left: 0;
    margin: inherit !important; /* Preserve list margins */
}

.wp-doc-post-magic-content li {
    list-style-type: none !important;
    margin: inherit !important; /* Preserve list item margins */
    padding: inherit !important; /* Preserve list item padding */
    line-height: inherit !important; /* Preserve list item line height */
    position: relative;
    display: list-item !important; /* Ensure list items are displayed correctly */
}

/* Preserve table styles and make them responsive */
.wp-doc-post-magic-content table {
    border-collapse: collapse;
    width: 100%;
    margin: inherit !important; /* Preserve table margins */
    border-spacing: inherit !important; /* Preserve cell spacing */
    display: table !important; /* Ensure tables are displayed correctly */
    overflow-x: auto; /* Enable horizontal scrolling for wide tables */
    display: block; /* Make table a block to enable overflow-x */
}

.wp-doc-post-magic-content th,
.wp-doc-post-magic-content td {
    border: 1px solid #ddd;
    padding: inherit !important; /* Preserve cell padding */
    text-align: inherit !important; /* Preserve cell alignment */
    vertical-align: inherit !important; /* Preserve vertical alignment */
    display: table-cell !important; /* Ensure table cells are displayed correctly */
    white-space: normal; /* Allow text in table cells to wrap */
}

/* Preserve heading styles */
.wp-doc-post-magic-content h1,
.wp-doc-post-magic-content h2,
.wp-doc-post-magic-content h3,
.wp-doc-post-magic-content h4,
.wp-doc-post-magic-content h5,
.wp-doc-post-magic-content h6 {
    font-family: inherit;
    font-weight: inherit;
    color: inherit;
    margin: inherit !important; /* Preserve heading margins */
    padding: inherit !important; /* Preserve heading padding */
    line-height: inherit !important; /* Preserve heading line height */
    display: block !important; /* Ensure headings are block level */
}

/* Preserve link styles */
.wp-doc-post-magic-content a {
    color: inherit;
    text-decoration: inherit;
    margin: inherit !important; /* Preserve link margins */
    padding: inherit !important; /* Preserve link padding */
    display: inline !important; /* Ensure links are inline */
}

/* Preserve image styles and make them responsive */
.wp-doc-post-magic-content img {
    max-width: 100% !important; /* Ensure images don't overflow their container */
    height: auto !important; /* Maintain aspect ratio */
    margin: inherit !important; /* Preserve image margins */
    padding: inherit !important; /* Preserve image padding */
    display: block !important; /* Ensure images are block level for proper spacing */
}

/* Preserve blockquote styles */
.wp-doc-post-magic-content blockquote {
    margin: inherit !important; /* Preserve blockquote margins */
    padding: inherit !important; /* Preserve blockquote padding */
    border-left: 4px solid #ddd;
    font-style: inherit;
    color: inherit;
    line-height: inherit !important; /* Preserve blockquote line height */
    display: block !important; /* Ensure blockquotes are block level */
}

/* Preserve code styles */
.wp-doc-post-magic-content code,
.wp-doc-post-magic-content pre {
    font-family: inherit;
    background-color: inherit;
    color: inherit;
    margin: inherit !important; /* Preserve code margins */
    padding: inherit !important; /* Preserve code padding */
    white-space: pre-wrap !important; /* Preserve code formatting */
    display: block !important; /* Ensure code blocks are block level */
    word-break: break-word; /* Break long words in code blocks */
}

/* Preserve shape styles */
.wp-doc-post-magic-content .wp-doc-shape {
    font-family: inherit;
    color: #ffffff !important; /* White text for dark background */
    background-color: #484848 !important; /* Dark gray background */
    border: inherit;
    margin: inherit !important; /* Preserve shape margins */
    padding: inherit !important; /* Preserve shape padding */
    line-height: inherit !important; /* Preserve shape line height */
    display: block !important; /* Ensure shapes are block level */
    max-width: 100%; /* Ensure shapes don't overflow */
    height: auto; /* Maintain aspect ratio */
}

/* Preserve cloud callout styles */
.wp-doc-post-magic-content .wp-doc-shape-cloudCallout {
    font-family: inherit;
    color: inherit;
    background-color: inherit;
    border: inherit;
    margin: inherit !important; /* Preserve callout margins */
    padding: inherit !important; /* Preserve callout padding */
    line-height: inherit !important; /* Preserve callout line height */
    display: block !important; /* Ensure callouts are block level */
    max-width: 100%; /* Ensure callouts don't overflow */
    height: auto; /* Maintain aspect ratio */
}

/* Preserve spacing between elements */
.wp-doc-post-magic-content > * {
    margin-top: inherit !important;
    margin-bottom: inherit !important;
    padding-top: inherit !important;
    padding-bottom: inherit !important;
}

/* Preserve indentation */
.wp-doc-post-magic-content p,
.wp-doc-post-magic-content div,
.wp-doc-post-magic-content blockquote {
    text-indent: inherit !important;
}

/* Preserve page breaks */
.wp-doc-post-magic-content {
    page-break-before: inherit !important;
    page-break-after: inherit !important;
    page-break-inside: inherit !important;
}

/* Preserve text alignment */
.wp-doc-post-magic-content p,
.wp-doc-post-magic-content div,
.wp-doc-post-magic-content h1,
.wp-doc-post-magic-content h2,
.wp-doc-post-magic-content h3,
.wp-doc-post-magic-content h4,
.wp-doc-post-magic-content h5,
.wp-doc-post-magic-content h6 {
    text-align: inherit !important;
}

/* Basic media queries for overall responsiveness */
@media screen and (max-width: 768px) {
    .wp-doc-post-magic-content {
        padding: 0 15px; /* Add some horizontal padding on smaller screens */
    }

    .wp-doc-post-magic-content h1 {
        font-size: clamp(1.4rem, 3.5vw, 2.2rem) !important; /* Fluid H1 for tablets, using rem for min/max */
    }

    .wp-doc-post-magic-content h2 {
        font-size: clamp(1.2rem, 3vw, 1.9rem) !important; /* Fluid H2 for tablets */
    }

    .wp-doc-post-magic-content h3 {
        font-size: clamp(1rem, 2.5vw, 1.7rem) !important; /* Fluid H3 for tablets */
    }

    .wp-doc-post-magic-content h4,
    .wp-doc-post-magic-content h5,
    .wp-doc-post-magic-content h6 {
        font-size: clamp(0.9rem, 2.2vw, 1.5rem) !important; /* Fluid smaller headings for tablets */
    }

    .wp-doc-post-magic-content p,
    .wp-doc-post-magic-content li,
    .wp-doc-post-magic-content th,
    .wp-doc-post-magic-content td {
        font-size: clamp(0.85rem, 2vw, 1rem) !important; /* Fluid body text for tablets */
        line-height: 1.5 !important;
    }

    /* Adjust list bullet positioning for smaller screens if needed */
    .wp-doc-bullet {
        margin-left: -1.5em; /* Adjust to ensure visibility */
    }
}

@media screen and (max-width: 480px) {
    .wp-doc-post-magic-content h1 {
        font-size: clamp(1.2rem, 3vw, 1.8rem) !important; /* More aggressive fluid H1 for phones */
    }

    .wp-doc-post-magic-content h2 {
        font-size: clamp(1rem, 2.5vw, 1.6rem) !important; /* More aggressive fluid H2 for phones */
    }

    .wp-doc-post-magic-content h3 {
        font-size: clamp(0.9rem, 2.2vw, 1.4rem) !important; /* More aggressive fluid H3 for phones */
    }

    .wp-doc-post-magic-content h4,
    .wp-doc-post-magic-content h5,
    .wp-doc-post-magic-content h6 {
        font-size: clamp(0.8rem, 1.8vw, 1.2rem) !important; /* More aggressive fluid smaller headings for phones */
    }

    .wp-doc-post-magic-content p,
    .wp-doc-post-magic-content li,
    .wp-doc-post-magic-content th,
    .wp-doc-post-magic-content td {
        font-size: clamp(0.75rem, 1.8vw, 0.95rem) !important; /* Further reduce body text on very small screens */
    }

    /* Ensure images and tables remain fluid and don't cause horizontal scroll on very small screens */
    .wp-doc-post-magic-content img {
        width: 100% !important; 
        min-width: 0 !important;
    }
    .wp-doc-post-magic-content table {
        min-width: 0 !important; 
    }
}

/* Word Document Text Decoration Styles */

/* Basic text decorations */
.wp-doc-content {
    font-family: inherit;
    line-height: 1.6;
}

/* Underline styles */
.wp-doc-content [style*="text-decoration: underline"] {
    text-decoration: underline;
}

.wp-doc-content [style*="text-decoration: double underline"] {
    text-decoration: double underline;
}

.wp-doc-content [style*="text-decoration: dotted underline"] {
    text-decoration: dotted underline;
}

.wp-doc-content [style*="text-decoration: dashed underline"] {
    text-decoration: dashed underline;
}

.wp-doc-content [style*="text-decoration: dot-dash underline"] {
    text-decoration: underline;
    border-bottom: 1px dotted;
}

.wp-doc-content [style*="text-decoration: dot-dot-dash underline"] {
    text-decoration: underline;
    border-bottom: 1px dotted;
}

.wp-doc-content [style*="text-decoration: wavy underline"] {
    text-decoration: wavy underline;
}

.wp-doc-content [style*="text-decoration: thick underline"] {
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

/* Bold and Italic */
.wp-doc-content [style*="font-weight: bold"] {
    font-weight: bold;
}

.wp-doc-content [style*="font-style: italic"] {
    font-style: italic;
}

/* Strikethrough */
.wp-doc-content [style*="text-decoration: line-through"] {
    text-decoration: line-through;
}

/* Highlight colors */
.wp-doc-content [style*="background-color"] {
    padding: 0 2px;
}

/* Font sizes */
.wp-doc-content [style*="font-size"] {
    line-height: 1.4;
}

/* Vertical alignment */
.wp-doc-content [style*="vertical-align: sub"] {
    vertical-align: sub;
    font-size: smaller;
}

.wp-doc-content [style*="vertical-align: super"] {
    vertical-align: super;
    font-size: smaller;
}

/* Combined styles */
.wp-doc-content [style*="font-weight: bold"][style*="font-style: italic"] {
    font-weight: bold;
    font-style: italic;
}

/* Ensure text decorations work together */
.wp-doc-content [style*="text-decoration"] {
    text-decoration-skip-ink: none;
    text-underline-offset: 2px;
} 