/* ==================== MATHEMATICAL ELEMENTS CSS ==================== */

/* AdSense Ad Block Styling */
.ad-block, .adsense-container {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    text-align: center;
    display: block;
    page-break-inside: avoid;
    break-inside: avoid;
    clear: both;
}

.ad-block ins.adsbygoogle {
    display: block;
    text-align: center;
}

.ad-block .adsbygoogle {
    display: block !important;
}

.ad-block[data-mce-bogus="1"] {
    position: relative;
    outline: 2px dashed #2271b1;
    outline-offset: 2px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.ad-block[data-mce-bogus="1"]:hover {
    opacity: 1;
}

.ad-block[data-mce-bogus="1"]::before {
    content: "AdSense Ad Block";
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: #2271b1;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 10;
}

/* ==================== IMAGE CAPTIONS CSS ==================== */

/* Figure and Caption Styling - Editor and Published Views */
figure, .figure-wrapper {
    display: block;
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    page-break-inside: avoid;
    break-inside: avoid;
}

figure img, .figure-wrapper img {
    display: block;
    max-width: 100%;
    height: auto;
    margin-bottom: 0.75rem;
}

figcaption, .figure-caption {
    font-size: 13px;
    font-style: italic;
    color: #666;
    line-height: 1.5;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

/* Editor preview styling for figure elements */
figure[data-mce-bogus="1"] {
    position: relative;
    outline: 2px dashed #9c27b0;
    outline-offset: 2px;
    opacity: 0.85;
}

figure[data-mce-bogus="1"]:hover {
    opacity: 1;
}

figure[data-mce-bogus="1"]::before {
    content: "📸 Figure with Caption";
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: #9c27b0;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    z-index: 10;
}

/* Inline Math - for expressions in text */
.math, .math-inline {
    display: inline;
    font-family: 'Courier New', 'Courier', monospace;
    background: rgba(211, 47, 47, 0.08);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    color: #d32f2f;
    font-weight: 500;
    white-space: nowrap;
}

/* Display Math - for centered equations on their own line */
.math-display, .math-block {
    display: block;
    margin: 1.5rem 0;
    padding: 1.2rem;
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.03), rgba(211, 47, 47, 0.01));
    border-left: 4px solid #d32f2f;
    border-radius: 6px;
    text-align: center;
    overflow-x: auto;
    font-family: 'Courier New', 'Courier', monospace;
}

/* KaTeX rendered math */
.katex {
    color: #111827;
    font-size: 1em;
}

.katex-display {
    display: block;
    margin: 1.5rem 0;
    padding: 1.2rem;
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.03), rgba(211, 47, 47, 0.01));
    border-left: 4px solid #d32f2f;
    border-radius: 6px;
    text-align: center;
    overflow-x: auto;
}

/* Mathematical operators and symbols */
.math-operator {
    color: #d32f2f;
    font-weight: bold;
    margin: 0 0.15em;
}

.math-symbol {
    font-family: 'Times New Roman', serif;
    color: #d32f2f;
    font-style: italic;
    font-weight: 500;
}

.math-var {
    font-family: 'Courier New', monospace;
    color: #d32f2f;
    font-style: italic;
    font-weight: 600;
}

/* Superscript and Subscript */
sup, .math-sup {
    font-size: 0.75em;
    vertical-align: super;
    color: inherit;
    font-weight: 600;
}

sub, .math-sub {
    font-size: 0.75em;
    vertical-align: sub;
    color: inherit;
    font-weight: 600;
}

/* Mathematical expressions in tables */
table .math, table .math-inline {
    background: none;
    padding: 0.1rem 0.2rem;
    border-radius: 2px;
}

/* Fraction styling */
.fraction, .math-fraction {
    display: inline-block;
    text-align: center;
    margin: 0 0.15em;
    font-family: 'Courier New', monospace;
    vertical-align: middle;
}

.fraction-numerator {
    display: block;
    border-bottom: 1px solid currentColor;
    padding: 0 0.15em;
}

.fraction-denominator {
    display: block;
    padding: 0 0.15em;
}

/* Matrix and Vector styling */
.matrix, .math-matrix, .vector {
    display: inline-block;
    border: 1px solid rgba(211, 47, 47, 0.3);
    padding: 0.5rem;
    border-radius: 3px;
    background: rgba(211, 47, 47, 0.02);
    font-family: 'Courier New', monospace;
    margin: 0 0.2em;
    vertical-align: middle;
}

.matrix-row {
    display: block;
    line-height: 1.8;
}

.matrix-cell {
    display: inline-block;
    min-width: 2em;
    text-align: center;
    padding: 0.2rem 0.3rem;
}

/* Equation numbering */
.equation-number, .math-number {
    float: right;
    color: #4b5563;
    font-size: 0.9em;
    margin-left: 1rem;
    margin-top: 0.25rem;
}

/* Mathematical function highlighting */
.math-function, .function {
    color: #d32f2f;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.function-arg {
    color: #111827;
    font-style: italic;
}

/* Set notation */
.set, .math-set {
    display: inline-block;
    border: 1px solid rgba(211, 47, 47, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #d32f2f;
}

/* Formula highlighting */
.formula, .math-formula {
    background: rgba(211, 47, 47, 0.08);
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    display: block;
    margin: 1rem 0;
    font-family: 'Courier New', monospace;
    border-left: 3px solid #d32f2f;
    padding-left: 0.8rem;
}

/* ==================== SCIENCE ELEMENTS CSS ==================== */

/* Chemical formulas */
.chemical, .chem-formula {
    font-family: 'Courier New', monospace;
    color: #d32f2f;
    font-weight: 600;
    background: rgba(211, 47, 47, 0.08);
    padding: 0.15rem 0.3rem;
    border-radius: 3px;
    display: inline;
    white-space: nowrap;
}

/* Chemical reaction styling */
.chemical-reaction, .reaction {
    display: block;
    margin: 1.5rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.04), rgba(211, 47, 47, 0.01));
    border: 1px solid rgba(211, 47, 47, 0.15);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    text-align: center;
    overflow-x: auto;
}

.reaction-arrow {
    color: #d32f2f;
    font-weight: bold;
    margin: 0 0.5em;
}

/* Chemical bond representation */
.bond-single {
    border-bottom: 2px solid #d32f2f;
    display: inline-block;
    margin: 0 2px;
    min-width: 1em;
}

.bond-double {
    border-bottom: 4px double #d32f2f;
    display: inline-block;
    margin: 0 2px;
    min-width: 1em;
}

.bond-triple {
    border-bottom: 6px solid #d32f2f;
    display: inline-block;
    margin: 0 2px;
    min-width: 0.5em;
}

/* Scientific notation */
.scientific-notation, .sci-notation {
    font-family: 'Courier New', monospace;
    color: #d32f2f;
    font-weight: 600;
    display: inline;
}

.exponent, .sci-exp {
    font-size: 0.75em;
    vertical-align: super;
    font-weight: 700;
}

/* Units and measurements */
.unit, .measurement, .measure {
    font-family: 'Courier New', monospace;
    color: #711128;
    font-weight: 500;
    margin-left: 0.15em;
    display: inline;
}

.quantity {
    font-weight: 600;
    color: #111827;
}

/* Physical constants */
.constant, .physical-constant {
    font-family: 'Courier New', monospace;
    color: #d32f2f;
    font-weight: 700;
    background: rgba(211, 47, 47, 0.08);
    padding: 0.1rem 0.3rem;
    border-radius: 2px;
    display: inline;
}

/* Element symbols (Chemistry) */
.element, .element-symbol {
    font-weight: 700;
    color: #d32f2f;
    font-size: 1em;
    display: inline-block;
    min-width: 1.5em;
    text-align: center;
}

/* Equation display with background */
.equation, .science-equation {
    display: block;
    margin: 1.5rem 0;
    padding: 1rem 1.2rem;
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.03), rgba(211, 47, 47, 0.01));
    border-left: 4px solid #d32f2f;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    text-align: center;
    overflow-x: auto;
    font-size: 1.05em;
}

/* Temperature units */
.temperature, .temp {
    color: #711128;
    font-weight: 600;
    font-size: 1em;
}

/* Percentage and ratios */
.percentage, .percent {
    color: #d32f2f;
    font-weight: 600;
    font-size: 1em;
}

.ratio {
    font-family: 'Courier New', monospace;
    color: #d32f2f;
    font-weight: 600;
    display: inline;
}

/* Physics notation */
.vector-notation, .physics-vector {
    font-family: 'Times New Roman', serif;
    font-style: italic;
    color: #d32f2f;
    font-weight: 600;
    text-decoration: overline;
}

/* Wavelength and frequency */
.wavelength, .frequency {
    color: #d32f2f;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    display: inline;
}

/* Highlighted science terms */
.science-term, .scientific-term {
    color: #d32f2f;
    font-weight: 600;
    background: rgba(211, 47, 47, 0.08);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    display: inline;
}

/* Molecular structure container */
.molecular-structure, .molecule {
    display: block;
    margin: 1.5rem auto;
    padding: 1rem;
    background: #f9fafb;
    border: 1px solid #e6e8eb;
    border-radius: 8px;
    text-align: center;
    max-width: 100%;
    overflow-x: auto;
}

/* Scientific data tables */
.data-table, .science-data {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95em;
    background: #f9fafb;
}

.data-table th, .science-data th {
    background: linear-gradient(135deg, rgba(211, 47, 47, 0.1), rgba(211, 47, 47, 0.05));
    color: #111827;
    font-weight: 700;
    padding: 0.75rem;
    text-align: left;
    border-bottom: 2px solid rgba(211, 47, 47, 0.2);
}

.data-table td, .science-data td {
    padding: 0.65rem;
    border-bottom: 1px solid #e6e8eb;
}

.data-table tr:hover td {
    background: rgba(211, 47, 47, 0.04);
}

/* Inline highlight for science/math content */
.highlight-math, .highlight-science {
    background: rgba(211, 47, 47, 0.15);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    color: #d32f2f;
    font-weight: 600;
}

/* Formula reference styling */
.formula-ref, .eq-ref {
    color: #d32f2f;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dotted rgba(211, 47, 47, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.formula-ref:hover, .eq-ref:hover {
    border-bottom-color: #d32f2f;
    background: rgba(211, 47, 47, 0.08);
}

/* Math expression container */
.math-container, .science-container {
    display: block;
    margin: 1.5rem 0;
    padding: 1.2rem;
    background: rgba(211, 47, 47, 0.02);
    border: 1px solid rgba(211, 47, 47, 0.15);
    border-radius: 8px;
    overflow-x: auto;
}

/* Responsive adjustments for math/science */
@media (max-width: 768px) {
    .math-display, .math-block,
    .equation, .science-equation,
    .chemical-reaction, .reaction,
    .math-container, .science-container {
        margin: 1rem 0;
        padding: 1rem;
        font-size: 0.95em;
    }

    .katex-display {
        margin: 1rem 0;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .math, .math-inline,
    .chemical, .chem-formula,
    .science-term, .scientific-term {
        font-size: 0.9em;
        padding: 0.1rem 0.25rem;
    }
}
