/* =========================================
   WRAPPER & SYSTEM STYLES (S-Tier Architecture)
   ========================================= */
.ioa-ozone-news-s-tier {
    position: relative;
    width: 100%;
}

.ioa-ozone-news-s-tier *,
.ioa-ozone-news-s-tier *::before,
.ioa-ozone-news-s-tier *::after {
    box-sizing: border-box;
}

/* =========================================
   TELEPORT SLOTS (Gold Standard Feature)
   ========================================= */
.ioa-teleport-slot {
    min-height: 0;
    transition: all 0.3s ease;
    margin-bottom: 0;
    width: 100%;
}

.ioa-teleport-slot.has-content {
    margin-bottom: 2rem;
    animation: ioa-fade-in 0.5s ease;
}

/* Editor Visuals - Visible only in Elementor Editor (.is-editor-mode added via PHP) */
.is-editor-mode .ioa-teleport-slot {
    min-height: 40px;
    border: 1px dashed rgba(30, 58, 138, 0.4);
    background: rgba(30, 58, 138, 0.05);
    margin: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.is-editor-mode .ioa-teleport-slot::before {
    content: attr(data-label);
    font-size: 11px;
    color: #1e3a8a;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

@keyframes ioa-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   CORE CONTAINER STYLES
   ========================================= */
.ea3g-news-container {
    /* Design System Palette */
    --color-primary: #1e3a8a;
    --color-primary-dark: #1e40af;
    --color-primary-light: rgba(30, 58, 138, 0.08);
    --color-surface: #ffffff;
    --color-surface-alt: #f3f4f6;
    --color-background: #f9fafb;
    --color-border: #e5e7eb;
    --color-text: #111827;
    --color-text-secondary: #374151;
    --color-text-tertiary: #6b7280;
    --color-accent-blue: #3b82f6;
    --color-accent-green: #10b981;

    /* Design System Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -1px rgba(0, 0, 0, 0.03);

    /* Design System Spacing */
    --space-xs: 0.75rem;   /* 12px */
    --space-sm: 1rem;      /* 16px */
    --space-md: 1.5rem;    /* 24px */
    --space-lg: 2rem;      /* 32px */
    --space-xl: 2.5rem;    /* 40px */
    --space-2xl: 3.5rem;   /* 56px */
    --space-3xl: 5rem;     /* 80px */

    /* Design System Border Radius */
    --radius-sm: 0.25rem;  /* 4px */
    --radius-md: 0.5rem;   /* 8px */
    --radius-lg: 0.75rem;  /* 12px */

    font-family: 'Inter', sans-serif; 
    font-weight: 400; 
    color: var(--color-text-secondary); 
    letter-spacing: 0.01em; 

    /* Layout Defaults */
    width: 100%;
    padding: var(--space-2xl) var(--space-md) var(--space-3xl); 
    position: relative;
    background-color: var(--color-background); 
    overflow-x: hidden;
}

/* BOXED LAYOUT (Standard) */
.ea3g-news-container.ioa-layout-boxed {
    max-width: 1280px; /* Default, overridden by JS/Controls */
    margin: 0 auto;
}

/* FLUID LAYOUT (Full Width) */
.ea3g-news-container.ioa-layout-fluid {
    max-width: 100%;
}

/* --- Typography "Gold Standard" --- */
.ea3g-news-container h2,
.ea3g-news-container h3 {
    font-family: 'Poppins', sans-serif;
    color: var(--color-text);
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin: 0;
}

.ea3g-news-container h2 {
    font-size: 42px; /* Main Section Title */
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-md);
    position: relative;
}

.ea3g-news-container h2::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background-color: var(--color-primary);
}

.ea3g-news-container h3 {
    font-size: 18px; /* Lede/Subtitle Size */
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
}

.ea3g-news-container .ea3g-info-text {
    font-size: 16px; /* Standard Body Paragraphs */
    line-height: 1.7;
    margin-bottom: var(--space-md);
}
.ea3g-news-container .ea3g-info-text p {
    margin-bottom: 1.5rem;
}
.ea3g-news-container .ea3g-info-text p:last-child {
    margin-bottom: 0;
}

.ea3g-news-container .ea3g-feature-text,
.ea3g-news-container .ea3g-contact-detail,
.ea3g-news-container .ea3g-member-note,
.ea3g-news-container .ea3g-contact-title {
    font-size: 15px; /* Secondary Text */
    line-height: 1.6;
}

.ea3g-news-container .ea3g-cover-title {
    font-family: 'Poppins', sans-serif;
    font-size: 17px;
    font-weight: 600;
    color: var(--color-primary);
    text-align: center;
    margin-bottom: 8px;
}

.ea3g-news-container .ea3g-cover-issue,
.ea3g-news-container .ea3g-cover-section-title,
.ea3g-news-container .ea3g-cover-text,
.ea3g-news-container .ea3g-cover-footer {
    font-size: 12px; /* Metadata */
    color: var(--color-text-tertiary);
    line-height: 1.5;
}

/* --- Layout and Static Visuals --- */
.ea3g-newsletter-visual {
    display: flex;
    gap: var(--space-lg);
    margin: 0;
    position: relative;
    align-items: flex-start;
}

.ea3g-newsletter-image {
    position: relative;
    flex: 0 0 350px;
    background-color: var(--color-surface-alt);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: visible;
}

.ea3g-newsletter-stack {
    position: relative;
    width: 100%;
    height: 380px;
}

.ea3g-newsletter-cover {
    position: absolute;
    width: 250px;
    height: 320px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    padding: var(--space-sm);
}

/* Static positioning for newsletter stack */
.ea3g-cover-1 { top: 30px; left: 50px; z-index: 3; transform: rotate(-5deg); transition: transform 0.3s ease; }
.ea3g-cover-2 { top: 25px; left: 60px; z-index: 2; transform: rotate(3deg); }
.ea3g-cover-3 { top: 35px; left: 40px; z-index: 1; transform: rotate(-8deg); }

/* Interactive Hover (Diplomatic Protocol) */
.ea3g-newsletter-image:hover .ea3g-cover-1 {
    transform: rotate(0deg) scale(1.02);
    z-index: 10;
}

/* Newsletter cover content styling */
.ea3g-cover-header {
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 12px;
    margin-bottom: var(--space-sm);
}

.ea3g-cover-content {
    flex-grow: 1;
}

.ea3g-cover-section { margin-bottom: var(--space-sm); }

.ea3g-cover-section-title {
    font-weight: 600;
    color: var(--color-text-secondary);
    border-left: 3px solid var(--color-primary-light);
    padding-left: 12px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ea3g-cover-lines { display: flex; flex-direction: column; gap: 3px; margin-top: var(--space-sm); }
.ea3g-cover-line { height: 3px; background-color: var(--color-border); border-radius: 1.5px; }
.ea3g-cover-line-1 { width: 100%; } .ea3g-cover-line-2 { width: 85%; } .ea3g-cover-line-3 { width: 90%; } .ea3g-cover-line-4 { width: 65%; } .ea3g-cover-line-5 { width: 75%; }

.ea3g-cover-footer { text-align: right; margin-top: var(--space-sm); }

.ea3g-newsletter-info { flex: 1; }
.ea3g-info-section { margin-bottom: var(--space-xl); }
.ea3g-info-section:last-child { margin-bottom: 0; }

.ea3g-info-icon {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    fill: var(--color-primary);
    flex-shrink: 0;
}

.ea3g-feature-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.ea3g-feature-item {
    display: flex;
    align-items: flex-start;
}

.ea3g-feature-icon {
    width: 18px;
    height: 18px;
    fill: var(--color-primary);
    opacity: 0.8;
    margin-right: var(--space-sm);
    margin-top: 4px;
    flex-shrink: 0;
}

.ea3g-contact-box {
    background-color: var(--color-surface-alt);
    border-left: 4px solid var(--color-primary);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-top: var(--space-xl);
}

.ea3g-contact-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: var(--space-sm);
}

.ea3g-contact-detail p {
    margin-bottom: 12px;
}
.ea3g-contact-detail p:last-child {
    margin-bottom: 0;
}
.ea3g-contact-detail strong { font-weight: 500; color: var(--color-text); }

.ea3g-member-note {
    display: inline-block;
    font-weight: 500;
    color: var(--color-primary);
    margin-bottom: var(--space-md);
}

/* =========================================
   SCIENTIFIC CALCULATOR & TAB SYSTEM (Refined)
   ========================================= */

.ioa-tools-wrapper {
    margin-top: var(--space-3xl);
    padding-top: var(--space-xl);
    border-top: 1px solid #e5e7eb;
    position: relative;
}

/* Refined Tabs - Clean Segmented Control */
.ioa-tabs-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f3f4f6;
    padding: 3px;
    border-radius: 8px;
    margin: 0 auto var(--space-xl) auto;
    width: fit-content;
    border: 1px solid #e5e7eb;
}

.ioa-tab-btn {
    background: transparent;
    border: none;
    padding: 8px 20px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.ioa-tab-btn:hover {
    color: #111827;
}

.ioa-tab-btn.active {
    background: #ffffff;
    color: #111827;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.ioa-tab-content {
    display: none;
    animation: ioa-fade-up 0.4s ease-out;
}

.ioa-tab-content.active {
    display: block;
}

@keyframes ioa-fade-up {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Calculator Grid System */
.ioa-calc-container {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 32px;
    align-items: start;
}

/* Minimalist Clean Panels */
.ioa-calc-panel {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

/* The Dark Reference Panel (Matte Professional) */
.ioa-calc-panel.dark {
    background: #111827; /* Dark Slate / Charcoal */
    color: #f3f4f6;
    border: 1px solid #1f2937;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.ioa-calc-header {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: -0.01em;
    margin-bottom: 24px;
    color: #111827;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 12px;
}

.ioa-calc-panel.dark .ioa-calc-header {
    color: #f9fafb;
    border-bottom: 1px solid #374151;
}

/* Refined Form Groups */
.ioa-form-group {
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ioa-form-group label {
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
}

/* Inputs - Professional, Crisp */
.ioa-input-wrapper {
    display: flex;
    align-items: center;
    width: 170px; /* Increased width to prevent cramping */
    position: relative;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    transition: all 0.2s ease;
    overflow: hidden;
}

.ioa-input-wrapper:focus-within {
    border-color: #3b82f6; /* Professional Blue */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ioa-calc-input {
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-size: 14px;
    text-align: right;
    font-family: 'Inter', sans-serif;
    color: #111827;
    font-weight: 500;
    outline: none;
}

.ioa-calc-unit {
    background: #f9fafb;
    padding: 8px 10px 8px 6px;
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    min-width: 45px;
    text-align: center;
    border-left: 1px solid #f3f4f6;
    user-select: none;
    white-space: nowrap; /* Forces units (like mg/L) to stay on one line */
}

.ioa-calc-input[readonly] {
    color: #6b7280;
    background-color: #f9fafb;
}

/* Subtle Divider */
.ioa-calc-divider {
    height: 1px;
    background: #f3f4f6;
    margin: 24px 0;
}

/* Clean Result Rows */
.ioa-result-row {
    background: #f9fafb;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #f3f4f6;
}

.ioa-result-row label {
    font-weight: 600;
    color: #374151;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.ioa-result-value {
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    color: #2563eb; /* Solid Blue */
    font-size: 16px;
}

/* Reference Tables - Clean Dark Mode */
.ioa-ref-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
    margin-bottom: 20px;
}

.ioa-ref-table th,
.ioa-ref-table td {
    padding: 8px 0;
    border-bottom: 1px solid #374151;
    text-align: left;
    color: #d1d5db;
}

.ioa-ref-table tr:last-child td {
    border-bottom: none;
}

.ioa-ref-table td:last-child {
    text-align: right;
    color: #ffffff;
    font-family: 'Roboto Mono', monospace;
}

.ioa-ref-title {
    font-size: 11px;
    font-weight: 600;
    color: #fbbf24; /* Amber */
    margin-bottom: 10px;
    margin-top: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ioa-citation {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 24px;
    font-style: italic;
    line-height: 1.5;
    padding-top: 16px;
    border-top: 1px solid #374151;
}

/* Responsive styles */
@media (max-width: 1100px) {
    .ea3g-newsletter-visual { flex-direction: column; align-items: center; }
    .ea3g-newsletter-image { max-width: 320px; height: auto; margin-bottom: var(--space-lg); }
    .ea3g-newsletter-stack { height: 350px; }
    .ioa-calc-container { grid-template-columns: 1fr; gap: var(--space-lg); }
    .ioa-calc-panel { padding: 24px; }
}

@media (max-width: 768px) {
    .ea3g-news-container { padding: var(--space-xl) var(--space-sm) var(--space-2xl); }
    .ea3g-news-container h2 { font-size: 36px; }
    .ea3g-newsletter-stack { height: 320px; }
    .ea3g-newsletter-cover { width: 200px; height: 280px; padding: 12px; }
    .ea3g-feature-list { grid-template-columns: 1fr; }
    .ioa-form-group { flex-direction: column; align-items: flex-start; gap: 8px; }
    .ioa-input-wrapper { width: 100%; }
}

@media (max-width: 480px) {
    .ea3g-news-container h2 { font-size: 32px; }
    .ea3g-newsletter-image { max-width: 280px; }
    .ea3g-newsletter-stack { height: 300px; }
    .ea3g-newsletter-cover { width: 180px; height: 250px; }
    .ea3g-news-container h3 { font-size: 16px; }
}