/* =========================================
   WRAPPER & SYSTEM STYLES (Gold Standard)
   ========================================= */
.ioa-conversion-tool-s-tier {
    position: relative;
    width: 100%;
}

.ioa-conversion-tool-s-tier *,
.ioa-conversion-tool-s-tier *::before,
.ioa-conversion-tool-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 */
.is-editor-mode .ioa-teleport-slot {
    min-height: 40px;
    border: 1px dashed rgba(30, 58, 138, 0.3);
    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
   ========================================= */
.ioa-tool-container {
    /* DEFAULT CORE PALETTE (Overridden by PHP Controls) */
    --color-primary: #1e3a8a;
    --color-primary-dark: #1e40af;
    --color-primary-light: rgba(30, 58, 138, 0.08);
    --color-primary-ultra-light: rgba(30, 58, 138, 0.03);
    --color-ea3g-blue: #0284c7;
    --color-ea3g-light: rgba(2, 132, 199, 0.12);
    --color-surface: #ffffff;
    --color-surface-alt: #f3f4f6;
    --color-background: #f9fafb;
    --color-border: #e5e7eb;
    --color-text-primary: #111827;
    --color-text-secondary: #374151;

    --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);

    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 2.5rem;
    --radius-lg: 0.5rem;

    font-family: 'Inter', sans-serif;
    color: var(--color-text-secondary);
    width: 100%;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-md);
    background-color: var(--color-background);
}

/* Layout Modes */
.ioa-tool-container.ioa-layout-boxed {
    max-width: 1280px; 
    margin-left: auto;
    margin-right: auto;
}

.ioa-tool-container.ioa-layout-fluid {
    max-width: 100%;
}

/* =========================================
   HERO / HEADER SECTION
   ========================================= */
.ioa-tool-hero {
    display: flex;
    background: linear-gradient(90deg, var(--color-primary-light) 0%, var(--color-ea3g-light) 100%);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: var(--space-xl);
    min-height: 250px;
    border: 1px solid var(--color-border);
    position: relative;
}

.ioa-tool-hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, var(--color-primary), rgba(255,255,255,0));
    opacity: 0.7;
    z-index: 1;
}

.ioa-hero-content {
    flex: 1;
    padding: var(--space-lg) var(--space-xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.ioa-hero-visual {
    flex: 0 0 35%;
    background-color: var(--color-primary);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    overflow: hidden;
}

/* Visual Pattern */
.ioa-hero-visual::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 60%);
    pointer-events: none;
}

.ioa-hero-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 32px;
    color: var(--color-text-primary);
    margin: 0 0 1rem 0;
    line-height: 1.2;
}

.ioa-hero-subtitle {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-bottom: 0.75rem;
    display: inline-block;
    position: relative;
    width: fit-content;
    font-size: 0.875rem;
}

.ioa-hero-subtitle::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 30px;
    height: 2px;
    background-color: var(--color-primary);
}

.ioa-hero-desc {
    font-size: 16px;
    line-height: 1.8;
    color: var(--color-text-secondary);
    max-width: 600px;
}

.ioa-hero-visual h2 {
    color: #ffffff;
    font-family: 'Poppins', sans-serif;
    font-size: 28px;
    font-weight: 700;
    text-align: right;
    margin: 0;
    line-height: 1.3;
}

.ioa-hero-visual span {
    color: #93c5fd; 
    display: block;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 8px;
    font-weight: 500;
}

/* =========================================
   CALCULATOR STYLES
   ========================================= */
.ioa-tools-wrapper {
    margin-top: var(--space-lg);
    position: relative;
}

.ioa-tabs-nav {
    display: flex;
    justify-content: center;
    background: var(--color-surface-alt);
    padding: 4px;
    border-radius: var(--radius-lg);
    margin: 0 auto var(--space-xl) auto;
    width: fit-content;
    border: 1px solid var(--color-border);
}

.ioa-tab-btn {
    background: transparent;
    border: none;
    padding: 8px 24px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.ioa-tab-btn.active {
    background: var(--color-surface);
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

.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); }
}

.ioa-calc-container {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: var(--space-lg);
    align-items: start;
}

/* Panels */
.ioa-calc-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.ioa-calc-panel.dark {
    background: #111827;
    color: #f3f4f6;
    border: 1px solid #1f2937;
    box-shadow: var(--shadow-md);
}

.ioa-calc-header {
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--color-surface-alt);
    padding-bottom: 12px;
}

.ioa-calc-header svg {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    fill: var(--color-primary);
}

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

.ioa-form-group {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ioa-form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
}

/* Inputs */
.ioa-input-wrapper {
    display: flex;
    align-items: center;
    width: 170px;
    position: relative;
    border-radius: 6px;
    background: #ffffff;
    border: 1px solid var(--color-border);
    transition: all 0.2s ease;
    overflow: hidden;
}

.ioa-input-wrapper:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ultra-light);
}

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

.ioa-calc-unit {
    background: var(--color-surface-alt);
    padding: 10px 12px 10px 8px;
    font-size: 12px;
    color: var(--color-text-secondary);
    font-weight: 500;
    min-width: 50px;
    text-align: center;
    border-left: 1px solid var(--color-border);
}

.ioa-calc-divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--space-md) 0;
}

/* Result Rows */
.ioa-result-row {
    background: var(--color-surface-alt);
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--color-border);
}

.ioa-result-value {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    color: var(--color-primary);
    font-size: 18px;
}

/* Parameter Grid */
.ioa-params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    background: var(--color-surface-alt);
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 24px;
}

.ioa-param-item {
    display: flex;
    flex-direction: column;
}

.ioa-param-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    margin-bottom: 4px;
    font-weight: 600;
}

.ioa-param-value {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
}

/* Reference Table */
.ioa-ref-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    margin-bottom: 20px;
}

.ioa-ref-table td {
    padding: 10px 0;
    border-bottom: 1px solid #374151;
    color: #d1d5db;
}

.ioa-ref-table td:last-child {
    text-align: right;
    font-weight: 600;
    color: #ffffff;
}

.ioa-ref-title {
    font-size: 11px;
    font-weight: 600;
    color: #fbbf24;
    margin-bottom: 12px;
    margin-top: 24px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'Poppins', sans-serif;
}

.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 */
@media (max-width: 1100px) {
    .ioa-tool-hero { flex-direction: column; }
    .ioa-hero-visual { min-height: 160px; flex: 0 0 auto; }
    .ioa-calc-container { grid-template-columns: 1fr; gap: var(--space-lg); }
}

@media (max-width: 768px) {
    .ioa-tool-container { padding: 2rem 1rem; }
    .ioa-hero-title { font-size: 26px; }
    .ioa-form-group { flex-direction: column; align-items: flex-start; gap: 8px; }
    .ioa-input-wrapper { width: 100%; }
}