/* MOL-GOD Calculator v1.8.0-rc.4 — 13 improvements */
.molgod-calc { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }

/* Header with badges */
.molgod-calc-header {
    background: linear-gradient(90deg,#f4f6fb,#eaeff7);
    border: 1px solid #e0e4ee;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.molgod-calc-name { font-size: 15px; font-weight: 700; color: #1a1d2e; }
.molgod-calc-name-en { font-size: 12px; font-weight: 400; color: #64748b; font-style: italic; }
.molgod-calc-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.molgod-badge-mw, .molgod-badge-formula, .molgod-badge-cas {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    font-weight: 500;
}
.molgod-badge-mw { background: #E6F1FB; color: #0C447C; }
.molgod-badge-formula { background: #EEEDFE; color: #3C3489; font-family: ui-monospace, monospace; }
.molgod-badge-cas { background: #F1EFE8; color: #444441; font-family: ui-monospace, monospace; }
.molgod-badge-formula sub { font-size: 9px; }
.molgod-calc-warn {
    display: inline-block; background: #fef3c7; color: #78350f;
    padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600;
}

/* Panels grid */
.molgod-panels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}
.molgod-panel {
    background: #f8fafc;
    border-radius: 10px;
    padding: 14px;
    border: 1px solid #e2e8f0;
    transition: border-color .2s;
}
.molgod-panel:hover { border-color: #cbd5e1; }
.molgod-panel-inactive { opacity: 0.9; background: #fafbfc; }

.molgod-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}
.molgod-panel-label {
    font-size: 12px;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: none;
    letter-spacing: 0;
}
.molgod-panel-icon { color: #3b82f6; flex-shrink: 0; }
.molgod-reset-btn {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
}
.molgod-reset-btn:hover { background: #fee2e2; color: #dc2626; }

/* Fields */
.molgod-field {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px;
}
.molgod-field > label {
    width: 68px; flex-shrink: 0;
    font-size: 12px; color: #475569; font-weight: 500;
}
.molgod-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}
.molgod-input-wrap > input,
.molgod-dil-grid > input {
    flex: 1 1 0;
    min-width: 0;
    height: 32px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    font-family: ui-monospace, "Cascadia Mono", Menlo, monospace;
    background: #fff;
    color: #0f172a;
    transition: border-color .15s, box-shadow .15s, background .3s;
}
.molgod-input-wrap > input:focus,
.molgod-dil-grid > input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.molgod-input-wrap > input.molgod-result,
.molgod-dil-grid > input.molgod-result {
    background: #ecfdf5;
    border-color: #86efac;
    color: #065f46;
    font-weight: 700;
}
.molgod-input-wrap > input.molgod-error,
.molgod-dil-grid > input.molgod-error {
    background: #fef2f2 !important;
    border-color: #ef4444 !important;
    color: #991b1b;
}
.molgod-unit-sel {
    height: 32px;
    padding: 0 6px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #fff;
    font-size: 11px;
    color: #475569;
    flex-shrink: 0;
    min-width: 62px;
}
.molgod-unit-static {
    font-size: 11px; color: #64748b; min-width: 32px; font-weight: 500;
}
.molgod-copy {
    background: none; border: none; cursor: pointer;
    font-size: 13px; color: #94a3b8; padding: 2px 6px;
    border-radius: 4px; transition: color .15s, background .15s;
}
.molgod-copy:hover { color: #3b82f6; background: #eff6ff; }

/* Purity slider row */
.molgod-purity-row {
    display: flex; align-items: center; gap: 8px;
    font-size: 11px; margin-top: 10px;
    padding-top: 10px; border-top: 1px solid #e2e8f0;
}
.molgod-purity-row > label { color: #64748b; width: 68px; flex-shrink: 0; font-weight: 500; }
.molgod-purity-row input[type=range] { flex: 1; accent-color: #3b82f6; min-width: 60px; }
.molgod-purity-row input[type=number] {
    height: 26px; padding: 0 6px; border: 1px solid #cbd5e1;
    border-radius: 4px; font-size: 11px; width: 54px;
    font-family: ui-monospace, monospace;
}

/* "Naważyć" result row */
.molgod-result-row {
    background: #dcfce7;
    padding: 8px 10px;
    border-radius: 6px;
    margin-top: 10px;
    display: flex; align-items: baseline; gap: 6px;
    flex-wrap: wrap;
}
.molgod-result-row-label { font-size: 11px; font-weight: 600; color: #14532d; }
.molgod-big-result { font-size: 16px; font-weight: 700; color: #065f46; font-family: ui-monospace, monospace; }
.molgod-hint-extra { font-size: 10px; color: #b45309; font-weight: 500; margin-left: auto; }
.molgod-warn-slot { margin-top: 6px; }
.molgod-warn-yellow {
    display: block; background: #fef3c7; color: #78350f;
    padding: 4px 8px; border-radius: 4px; font-size: 10px; font-weight: 600;
}
.molgod-warn-red {
    display: block; background: #fee2e2; color: #991b1b;
    padding: 4px 8px; border-radius: 4px; font-size: 10px; font-weight: 600;
}

/* Dilution grid (Panel B) */
.molgod-dil-grid {
    display: grid;
    grid-template-columns: minmax(60px,auto) 1fr 70px;
    gap: 6px 8px;
    align-items: center;
}
.molgod-dil-grid > label {
    font-size: 12px; color: #334155; font-weight: 600;
    display: flex; flex-direction: column; gap: 1px;
}
.molgod-label-hint {
    font-size: 9px; color: #64748b; font-weight: 400; font-style: italic;
}
.molgod-dil-hint {
    margin-top: 8px;
    padding: 8px 12px;
    font-size: 11.5px;
    color: #065f46;
    background: #ecfdf5;
    border-left: 3px solid #10b981;
    border-radius: 0 6px 6px 0;
    line-height: 1.5;
    min-height: 14px;
}
.molgod-dil-hint:empty { display: none; }
.molgod-dil-error {
    margin-top: 6px;
    padding: 7px 11px;
    font-size: 11px;
    color: #991b1b;
    background: #fef2f2;
    border-left: 3px solid #ef4444;
    border-radius: 0 6px 6px 0;
    line-height: 1.5;
    display: none;
}
.molgod-dil-error.active { display: block; animation: molgod-shake .35s; }
@keyframes molgod-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}
.molgod-dil-error:empty { display: none; }

.molgod-serial { margin-top: 10px; padding-top: 8px; border-top: 1px dashed #cbd5e1; }
.molgod-serial > summary { font-size: 11px; font-weight: 600; color: #475569; cursor: pointer; padding: 4px 0; }
.molgod-serial-inputs { display: flex; gap: 6px; align-items: center; font-size: 11px; margin-top: 6px; flex-wrap: wrap; }
.molgod-serial-inputs label { color: #64748b; font-weight: 500; }
.molgod-serial-inputs input {
    width: 60px; height: 28px; padding: 0 6px; font-size: 12px;
    border: 1px solid #cbd5e1; border-radius: 4px;
    font-family: ui-monospace, monospace;
}

.molgod-sd-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 8px; background: #fff; border-radius: 6px; overflow: hidden; }
.molgod-sd-table th, .molgod-sd-table td {
    padding: 6px 10px; border-bottom: 1px solid #e2e8f0; text-align: left;
    font-family: ui-monospace, monospace;
}
.molgod-sd-table th { background: #f1f5f9; font-weight: 600; color: #475569; font-family: inherit; }
.molgod-sd-table tr:last-child td { border-bottom: none; }

/* Panel C inactive state */
.molgod-panel-inactive-msg {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: #eff6ff;
    border-radius: 8px;
    margin-bottom: 0;
}
.molgod-density-examples {
    font-size: 10.5px; color: #64748b; margin-top: 8px; line-height: 1.5;
}
.molgod-density-examples strong { color: #0f172a; font-family: ui-monospace, monospace; }
.molgod-density-info {
    font-size: 10.5px; color: #64748b; margin-top: 10px;
    padding: 6px 10px; background: #eff6ff;
    border-radius: 6px; border-left: 2px solid #3b82f6;
}
.molgod-source { color: #1e40af; font-weight: 600; }

/* Intent bar */
.molgod-intent-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(90deg,#ecfdf5,#d1fae5);
    border: 1.5px solid #5DCAA5;
    border-radius: 10px;
    color: #065f46;
    font-size: 13px;
    margin-top: 10px;
    flex-wrap: wrap;
    animation: molgod-slidein .25s ease;
}
.molgod-intent-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.molgod-intent-check {
    width: 22px; height: 22px;
    background: #10b981; color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: bold;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(16,185,129,0.4);
}
.molgod-intent-bar strong {
    font-size: 15px; font-weight: 700; color: #065f46;
    font-family: ui-monospace, monospace;
}
.molgod-intent-right {
    font-size: 11px; color: #047857;
    display: flex; align-items: center; gap: 5px;
    font-weight: 500;
}
@keyframes molgod-slidein {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.molgod-btn-secondary {
    margin-top: 6px; padding: 6px 14px;
    font-size: 11px; font-weight: 600;
    border: 1px solid #cbd5e1; border-radius: 6px;
    background: #fff; color: #475569; cursor: pointer;
    transition: all .15s;
}
.molgod-btn-secondary:hover { background: #f1f5f9; border-color: #94a3b8; color: #1e293b; }

@media (max-width: 500px) {
    .molgod-panels-grid { grid-template-columns: 1fr; }
    .molgod-dil-grid { grid-template-columns: 72px 1fr 64px; gap: 4px 6px; }
    .molgod-field > label { width: 60px; }
}
